├── .gitignore ├── archetypes ├── .gitkeep └── default.md ├── config.toml ├── content ├── .gitkeep ├── _index.md ├── blog │ ├── all.md │ ├── asset-upload-oembed.md │ ├── heartbleed.md │ ├── live-reloading-css.md │ ├── my-zen-mode.md │ ├── new-processors.md │ ├── pro-processors.md │ ├── protection.md │ ├── security-limited-output.md │ ├── ssl-for-all.md │ ├── ssl.md │ ├── the-return-and-the-refactor.md │ ├── twdtw-1-sass-tern-security.md │ ├── twdtw-10-jshint-linehighlight-pro.md │ ├── twdtw-2.md │ ├── twdtw-3-codemirror-settings.md │ ├── twdtw-4-tern-pro-features.md │ ├── twdtw-5-settings-dropbox-heartbleed.md │ ├── twdtw-6-syncing-pro-accounts.md │ ├── twdtw-7-processors-search.md │ ├── twdtw-8-svg-settings.md │ ├── twdtw-9-tweaks-maintenance.md │ ├── urls.md │ └── welcome.md ├── help │ ├── 2-second-setup.md │ ├── _index.md │ ├── about.md │ ├── adding-custom-libraries.md │ ├── adding-libraries.md │ ├── adding-processors.md │ ├── ajax-requests.md │ ├── api.md │ ├── asset-uploading.md │ ├── change-your-password.md │ ├── clearing-the-console.md │ ├── customise-editor-settings.md │ ├── debugging-preferences.md │ ├── defaults-in-bins.md │ ├── delete-a-bin.md │ ├── design-principles.md │ ├── disabling-all-keyboard-shortcuts.md │ ├── dropbox.md │ ├── embed-doesnt-load.md │ ├── experimental-features.md │ ├── export-gist.md │ ├── faq.md │ ├── features.md │ ├── free-preview-expired.md │ ├── getting-started.md │ ├── github-username.md │ ├── how-can-i-embed-jsbin.md │ ├── import-gists.md │ ├── keyboard-shortcuts.md │ ├── linking-bins.md │ ├── object-doesnt-work.md │ ├── populating-bins.md │ ├── private-bins.md │ ├── pro.md │ ├── pronounceable-urls.md │ ├── running-a-local-copy-of-jsbin.md │ ├── sandbox-mode.md │ ├── sass-import.md │ ├── session-secret.md │ ├── share-latest-bin.md │ ├── ssl-opt-in.md │ ├── ssl.md │ ├── stickers.md │ ├── test-code-on-other-devices.md │ ├── toggle-line-numbers.md │ ├── transfer-a-bin.md │ ├── vanity-urls.md │ ├── versions.md │ ├── vision.md │ ├── what-is-jsbin.md │ ├── when-do-revisions-change.md │ └── why-register.md ├── legals │ ├── _data.json │ ├── _index.md │ └── privacy.md └── writing-a-post.md ├── data ├── .gitkeep ├── authors.json └── categories.json ├── docsearch-config.json ├── layouts ├── .gitkeep ├── 404.html ├── _default │ ├── baseof.html │ ├── feed.json │ ├── list.html │ └── single.html ├── blog │ ├── feed.xml │ └── list.html ├── help │ └── list.html ├── index.html ├── legals │ ├── list.html │ └── single.html └── partials │ └── author.html ├── package.json └── static ├── .gitkeep ├── _headers ├── css ├── github.css ├── help.css ├── highlight.css └── syntax.css ├── images ├── api-key.png ├── avatars │ ├── danny.jpg │ ├── fabien.jpg │ ├── giulia.jpg │ └── remy.jpg ├── bin-info-expanded.png ├── blog │ ├── auto-disabled.png │ ├── dave-loves-you.jpg │ ├── early-v5.png │ ├── loop-protect.gif │ ├── new-share.png │ ├── oembed-pr.png │ ├── processors.png │ ├── ssl-for-all.png │ └── v1.jpg ├── change-your-password.png ├── chrome-revoke.png ├── comment.svg ├── debugging-prefs-devtools.png ├── default-prefs.png ├── deleted-bin.png ├── disable-cmd-n.png ├── do-not-own-bin.png ├── embed-small.gif ├── enable-experiments.png ├── export-as-gist.png ├── export-complete.png ├── favicon.png ├── favicon.svg ├── flat-design.png ├── free-preview-expired.png ├── jsbin-32.png ├── jsbin-start.png ├── jsbin-zen-mode-1.png ├── layout-selection1.png ├── libraries.png ├── line-numbers-pref.png ├── line-numbers.gif ├── panel-configure.gif ├── panel-options.png ├── private-bins.gif ├── private-menu.png ├── rss_alt.svg ├── save-as-template.png ├── share-menu1.png ├── ssl-cert.png ├── ssl.png ├── stickers.jpg ├── transfer.png ├── twdtw │ ├── 1 │ │ ├── login.png │ │ ├── sass.png │ │ └── tern.gif │ ├── 2 │ │ ├── fold.png │ │ └── hack.jpg │ ├── 3 │ │ ├── cm4.gif │ │ ├── dance.gif │ │ └── settings.png │ ├── 5 │ │ └── preferences.png │ ├── 6 │ │ └── baby.png │ ├── 7 │ │ ├── scss.gif │ │ ├── search.png │ │ └── tv-brain-melt.jpg │ ├── 8 │ │ └── settings.png │ ├── 10 │ │ ├── jshint-prefs.png │ │ └── line-highlight.png │ └── 11 │ │ ├── linting.png │ │ └── ssl.png └── url-example.png └── js ├── back-button.js ├── blog.js ├── highlight.pack.js ├── html5shiv.min.js ├── keyboard.js ├── min.js ├── moment.js ├── notify.js ├── permalink.js ├── search.js └── xhr.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .DS_Store 3 | public 4 | -------------------------------------------------------------------------------- /archetypes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/archetypes/.gitkeep -------------------------------------------------------------------------------- /archetypes/default.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "{{ replace .TranslationBaseName "-" " " | title }}" 3 | date: {{ .Date }} 4 | draft: true 5 | --- 6 | 7 | -------------------------------------------------------------------------------- /config.toml: -------------------------------------------------------------------------------- 1 | baseURL = "/" 2 | languageCode = "en-gb" 3 | title = "JS Bin help" 4 | googleAnalytics = "UA-1656750-13" 5 | pygmentsCodeFences = true 6 | enableGitInfo = true 7 | pygmentsStyle = "vs" 8 | 9 | [outputs] 10 | home = ["RSS", "HTML"] 11 | page = ["HTML", "JSON"] 12 | 13 | [outputFormats] 14 | [outputFormats.RSS] 15 | mediatype = "application/rss" 16 | baseName = "feed" 17 | 18 | [outputFormats.JSON] 19 | mediatype = "application/json" 20 | baseName = "all" 21 | 22 | [params] 23 | helpRoot = "https://help.jsbin.com/" 24 | -------------------------------------------------------------------------------- /content/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/content/.gitkeep -------------------------------------------------------------------------------- /content/_index.md: -------------------------------------------------------------------------------- 1 | Nothing to see 2 | -------------------------------------------------------------------------------- /content/blog/all.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: feed 3 | outputs: 4 | - json 5 | --- 6 | -------------------------------------------------------------------------------- /content/blog/asset-upload-oembed.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Asset uploads & oEmbed 3 | author: remy 4 | date: '2015-02-04' 5 | published: true 6 | --- 7 | 8 | 9 | We said we'd be working on more pro features, and we are. Also, since we're open source, this awesome stuff happens from time to time: oEmbed as a community submitted feature. 10 | 11 | ![Pull request that landed oEmbed](/images/blog/oembed-pr.png) 12 | 13 | ## Asset uploads 14 | 15 | As of today, I've released the asset upload feature to **all existing Pro users**. Simply drag & drop your assets into JS Bin and it'll upload instantly and insert an image tag with your newly uploaded asset. 16 | 17 | Each pro user can host up to 1GB of assets - so that gives you a bit of freedom to sling up your images as quickly as you create bins. 18 | 19 | To manage your assets, head over to the [assets](/account/assets) account page and you can delete files and check your usage. 20 | 21 | So what are you waiting for? Support JS Bin's continued development and [go pro today](/upgrade). 22 | 23 | You can see a demo of upload in action below: 24 | 25 |
26 | 27 | 28 | ## oEmbed 29 | 30 | Thanks to an awesome (and relatively simple) [pull request](https://github.com/jsbin/jsbin/pull/1984), JS Bin now also supports oEmbed for rich content - allowing you to oEmbed the *embed* view of your bin. 31 | 32 | A simple call to http://jsbin.com/oembed?url=http://jsbin.com/fajac/3 (the Dave's demo page) yeilds the following JSON: 33 | 34 | ```json 35 | { 36 | "type": "rich", 37 | "version": "1.0", 38 | "title": "JS Bin", 39 | "url": "http://jsbin.com/fajac/3/edit?html,output", 40 | "width": 640, 41 | "height": 480, 42 | "html": "" 43 | } 44 | ``` 45 | 46 | And just like that, JS Bin links posted in [Gitter](https://gitter.im/) (the awesome chat client) pulls in a live embeded bin. 47 | -------------------------------------------------------------------------------- /content/blog/heartbleed.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Heartbleed and JS Bin 3 | author: remy 4 | date: '2014-04-10' 5 | published: true 6 | --- 7 | 8 | 9 | If you've not heard about [Heartbleed](http://heartbleed.com), means that **potentially** all your passwords can be compromised. This isn't a bug that's specific to JS Bin, it affects most sign in forms that go over HTTPS. Yes, it's **that** scary. 10 | 11 | Note that if you registered with JS Bin after 9-April 2014 10pm UK time, then you won't be affected, but I still strongly recommend you familiar yourself with the issue. 12 | 13 | Here's what *we've* done: 14 | 15 | - We've patched all our versions of OpenSSL 16 | - We've re-issued our SSL certificate for our login and register 17 | - We're recommending that you [change your password](/help/change-your-password) 18 | 19 | We can't control when the old SSL certificate gets revoked (serial number 842265), but we've already seen people on the new certificate (serial number 1169237). You can check you have the updated certificate by clicking on the "padlock", and digging into the certificate details, where you should see the issue "Not Valid Before" date, which will be 8 April 2014: 20 | 21 | ![/images/ssl-cert.png](/images/ssl-cert.png) 22 | 23 | Note that if you use Chrome, you'll also need to ensure your browser checks for revoked SSL certificate by default: 24 | 25 | ![/images/chrome-revoke.png](/images/chrome-revoke.png) 26 | 27 | And importantly, what **you'll** need to (or I'm suggesting you) do: 28 | 29 | * Change your password 30 | * Log out and log back in again (to clear your session based on the old SSL certificate) 31 | * Read up and share what you learn about Heartbleed 32 | 33 | We could (technically) reset everyone's password, but it's not that simple for us to code up, and really the complexity is in the user flow, and getting it right. So I decided against it in the end. 34 | 35 | Some good resources I've found are: 36 | 37 | * [Everything you need to know about Heartbleed](http://www.troyhunt.com/2014/04/everything-you-need-to-know-about.html) - very good if you're at all technical and need to get a grip on the issues 38 | * [Big web sites affected](http://mashable.com/2014/04/09/heartbleed-bug-websites-affected/) - I found this pretty useful for what to tell non-technical people I know -------------------------------------------------------------------------------- /content/blog/live-reloading-css.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Live reloading CSS 3 | author: remy 4 | date: '2015-07-04' 5 | published: true 6 | --- 7 | 8 | 9 | 10 | Due to a few recent optimisations in the JS Bin rendering logic, we now have live reloading CSS in the editor. 11 | 12 | This means that when you change any content in the CSS panel, as always, the output is updated in real time, except now *only* the CSS will change. 13 | 14 | So any JavaScript or existing DOM state will remain in it's current state and your styles will change. This also applies to any of the CSS processors, such as Sass, SCSS, Myth, etc. 15 | 16 | You can see a short demo below - note that the JavaScript canvas animation continues to run and the counter increases: 17 | 18 |
19 | 20 | ## Technical behind the scenes 21 | 22 | This change is due to a small optimisation I made to JS Bin's rendering. We use [promises](http://www.html5rocks.com/en/tutorials/es6/promises/) under the hood, but before we would always create a new promise for all the panels when *any* panel changed. 23 | 24 | [Now the code](https://github.com/jsbin/jsbin/blob/4644d8518868e4f8bcf330eafeeb1daa535c8ca3/public/js/render/render.js#L35-L52) will *only* re-render the promise of the focused panel. Since you can call the `.then` on a fulfilled promise over and over, it allows me to re-use the previously rendered promises. 25 | 26 | The two benefits are that it was easy to add live reloading of CSS, but also live rendering is also now faster, as there's less work for your browser to do. 27 | 28 | -------------------------------------------------------------------------------- /content/blog/my-zen-mode.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: How I run JS Bin in Zen mode! 3 | author: fabien 4 | date: '2014-05-09' 5 | published: true 6 | --- 7 | 8 | 9 | Since using JS Bin, I've discovered a number of ways to customise it to my liking, and I wanted to share how I'm running in *Zen mode*! 10 | 11 | ![Zen mode](/images/jsbin-zen-mode-1.png) 12 | 13 | ## Vim mode 14 | 15 | ```javascript 16 | jsbin.settings.addons.vim = true; 17 | ``` 18 | 19 | Since we upgraded CodeMirror to version 4, we've added a lot of [addons](/blog/twdtw-2#userenabledaddons) for 20 | CodeMirror, including Vim mode, which you can turn on by running the above command 21 | in the console. Just note that not all of the Vim functionality comes with the plugin, 22 | visual block mode, for example, doesn't work. But a lot of the Ex commands are there, 23 | including search and replace, which is great, as JS Bin doesn't support this in normal mode. 24 | 25 | ## Custom theme 26 | 27 | ```javascript 28 | jsbin.settings.editor.theme = 'solarized light'; 29 | ``` 30 | 31 | Solarized is a beautiful theme that I use everywhere (Terminal and text editors). We support 32 | both light and dark solarized themes, I use the light theme in the browser. 33 | 34 | ## Default template 35 | 36 | Default templates in JS Bin really make it your own, you can add default content 37 | to all three of the input panels, so if you always use jQuery, you can have JS Bin 38 | always include it for you. [My default template](http://jsbin.com/allouis-template/1/edit?html,css,js) 39 | is pretty simple. Our help articles have a [post on default templates](/help/defaults-in-bins). 40 | 41 | ### HTML 42 | 43 | My default html panel just adds two metatags for webapps, and a custom title. 44 | 45 | ```html 46 | 47 | 48 | 49 | 50 | 51 | 52 | @allouis_ 53 | 54 | 55 | 56 | 57 | 58 | ``` 59 | 60 | ### CSS 61 | 62 | The default css panel just contains a basic reset. 63 | 64 | ```css 65 | html, body { 66 | margin: 0; 67 | padding: 0; 68 | } 69 | ``` 70 | 71 | ### JavaScript 72 | 73 | This is my favourite of the panel templates, a single line, it just clears the console everytime 74 | the code is run! 75 | 76 | ```javascript 77 | console.clear(); 78 | ``` 79 | 80 | ## Hidden toolbar 81 | 82 | ctrl+shift+\ 83 | 84 | The hidden topbar lets me really focus on the code, most of the items in the menus 85 | can be accessed via keyboard shortcuts and for everything else, when I *do* need 86 | it, the topbar pops open when you hover near it. 87 | 88 | ## Keyboard shortcuts 89 | 90 | ctrl+enter 91 | 92 | My favourite JS Bin keyboard shortcut, this command will force a re-render on your output, on 93 | all devices, so it's pretty handy for mobile testing. It also runs all your JavaScript 94 | so if you just have the console open, you can use it to run your code each time 95 | you make changes. Here is our complete list of [keyboard shortcuts](/help/keyboard-shortcuts) 96 | 97 | ## Panel configuration 98 | 99 | I like to place my console panel *underneath* my JavaScript panel, you can do this 100 | kind of panel configuration with all of the panels in JS Bin like so: 101 | 102 | ![Panel Moving](/images/panel-configure.gif) 103 | 104 | Do note, that currently panel configuration won't save so you'll need to do this 105 | each time you visit. 106 | -------------------------------------------------------------------------------- /content/blog/new-processors.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: New processors. We need your input 3 | author: remy 4 | date: '2014-06-17' 5 | published: true 6 | --- 7 | 8 | 9 | We're doing the final testing on our new processor code. Sass and SCSS have been in high demand for a long time ([#176](https://github.com/jsbin/jsbin/issues/176)), which has driven this rewrite ([#1229](https://github.com/jsbin/jsbin/pull/1229)). 10 | 11 | But we now need input from **you**. 12 | 13 | ## Compass, Bourbon, et al 14 | 15 | Currently our thinking is this: we'll run both Sass and SCSS using the Compass compile tool. So if you want to include Bourbon, you just import it. 16 | 17 | I'm not particularly a pro user of CSS preprocessors, so I'm not 100% sure if this what people expect or not. I like that everything is just there, and you don't have to mess around selecting the right config option in your bin. 18 | 19 | **A question to you:** what extensions would you want to be available? 20 | 21 | A nice benefit to our system, is that imports from one bin to another just works. The same way as being able to [reference the JavaScript from one bit to another](/help/linking-bins) to create Ajax requests. 22 | 23 | ## Other processors 24 | 25 | We're in the process of [documenting](/help/adding-processors) how you add more processors, and currently support (in our rewrite): 26 | 27 | * **JavaScript**: CoffeeScript, React (JSX), Traceur, Processing, TypeScript 28 | * **CSS**: Less, Stlyus, Sass, SCSS 29 | * **HTML**: Jade, Markdown 30 | 31 | **A question to you:** are there others that we should add? 32 | 33 | I've thought about adding [sweet.js](http://sweetjs.org/), and equally I can see how all the new processors might just spiral the options out of control! 34 | 35 | JS Bin's ethos is that the processor should work in the client side, but I've made an exception for Sass and SCSS (due to the sheer demand), so I'm willing to make exceptions for other processors if there's the demand. 36 | 37 | ## Get yourself heard 38 | 39 | This is your oppotunity to tell us what you think. What's important to you and whether there's something obvious we're missing. 40 | 41 | Either comment below, or comment directly on the [pull request for the feature](https://github.com/jsbin/jsbin/pull/1229). 42 | -------------------------------------------------------------------------------- /content/blog/pro-processors.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Announcements: Pro & Processors' 3 | author: remy 4 | date: '2014-07-24' 5 | published: true 6 | --- 7 | 8 | 9 | The last few weeks we've all been busy on that last stretch of work, that last 5% of work that always eeks itself out to be longer than you expect. 10 | 11 | But now, we're live and two huge updates for you: Pro and processors. 12 | 13 | ## Pro 14 | 15 | We've been working on Pro accounts for the last 6 months (amongst a lot of other work) and our initial offering is now live. 16 | 17 | ![Dave loves you, because you're a pro](/images/blog/dave-loves-you.jpg) 18 | 19 | To upgrade to pro, first you'll need a free account, then head to the [upgrade page](http://jsbin.com/upgrade). Pro accounts are available monthly or yearly subscriptions currently offering 2 months free. 20 | 21 | By upgrading to Pro accounts, your contribution helps support JS Bin as a continued open source project. Plus, you'll have access to [private bins](/help/private-bins), [dropbox support](/help/dropbox), vanity URLs and [more](/help/pro). 22 | 23 | ## Processors 24 | 25 | The biggest news is that Sass & SCSS both with Compass and Bourbon support has landed. Also, we've restored Stylus, updated LESS and added [Myth](http://www.myth.io/) to the CSS processors. Full specifics on [versions](/help/versions) are also available. 26 | 27 | ![Processors on JS Bin](/images/blog/processors.png) 28 | 29 | In keeping with JS Bin being open source, our processor server is also open source, found under [Pennyworth](https://github.com/jsbin/pennyworth). 30 | 31 | You can use Pennyworth for your own project if you want "Processors as a Service", or perhaps extend it to be a CLI tool, or a sublime plugin? It's online, documented and available under [MIT](http://jsbin.mit-license.org). 32 | 33 | So for forth and hack, learn, fix and teach! 34 | 35 | ## Totally aside 36 | 37 | With all the seriousness aside, you got to take a break, and frankly, this video sours into amazing at 2m49s! Enjoy. This guy is a genius. 38 | 39 |
40 | -------------------------------------------------------------------------------- /content/blog/protection.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Protecting you from yourself 3 | author: remy 4 | date: '2014-08-08' 5 | published: true 6 | --- 7 | 8 | 9 | JS Bin has recently had some subtle changes that help protect you from bugs in your own code. 10 | 11 | ## Crash protection 12 | 13 | Although we have loop protection in JS Bin, it's entirely possible that your JavaScript might side-step our protection, and crash the browser anyway. 14 | 15 | If that happens, JS Bin will automatically disable the *live JavaScript rendering* when the page is refresh. This means that HTML & CSS is still live rendered, but the JavaScript waits for you to click "run with JS" (or use the ctrl+return shortcut). 16 | 17 | ![Automatically disabled](/images/blog/auto-disabled.png) 18 | 19 | ## Loop protection 20 | 21 | We've long had [loop protection](https://www.youtube.com/watch?v=EA74ODg1qKE) (video) in JS Bin which meant if you accidently wrote an infinite loop, JS Bin would quietly exit out and warn in the browser console. 22 | 23 | > To disable the loop protection: add the following in your JavaScript: 24 | > ``` 25 | > // noprotect 26 | > ``` 27 | 28 | Now you'll see a warning either in the footer of the JavaScript panel, or in the gutter (if you have gutter warnings enabled in your [preferences](/account/preferences)). 29 | 30 | ![Loop protection in JS Bin](/images/blog/loop-protect.gif) 31 | 32 | We've also made the [loop protection module available](http://github.com/jsbin/loop-protect) in our git repo under MIT, so you're welcome re-use it in your own projects. 33 | -------------------------------------------------------------------------------- /content/blog/security-limited-output.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'TWDTW #11: A week of security' 3 | author: remy 4 | date: '2014-07-09' 5 | published: true 6 | --- 7 | 8 | 9 | This last week has had a particularly strong focus on security. Some of these changes might also have a direct impact on the way you use JS Bin. 10 | 11 | ## Lint all the things! 12 | 13 | After last week's release of JSHint setting control, [Giulia](https://github.com/electricg) released the new HTML, CSS and CofeeScript linting control. All available under the [preferences](http://jsbin.com/account/preferences) and all of them take a JSON object to control your defaults. 14 | 15 | The error reporting has also had an upgrade, so you can set if you want errors in the footer of the panel, next to the line or under the line - or even all three! 16 | 17 | ![Example of full linting options in editor](/images/twdtw/11/linting.png) 18 | 19 | ## Limited full output for anonymous bins 20 | 21 | If a bin is created by an anonymous user, the full output (that is: with the JS Bin editor stripped away) is only available for 90 minutes after creation. After which the URL will redirect to the editor view. 22 | 23 | If you're (freely) registered *anyone* can always view your full output. This change applies to all anonymously created bins as of around July 3, 2014 at 4pm GMT. 24 | 25 | JS Bin has long been a target for spam and phishing and this is first change that would outwardly impact our users. After speaking to many of you, and taking your feedback, I feel like this change is the right balance between starting to address the issue, but also maintaining flexibility for those of you who use JS Bin for teaching. 26 | 27 | ## General security 28 | 29 | We've updated our SSL certificate for another 4 years until 2018 and recently closed latest [openssl security issue](https://www.openssl.org/news/secadv_20140605.txt) (which you should read up on if you manage servers). 30 | 31 | There was also an issue reporting that the `jsbin.state` and user object could be accessed, which has been also closed. The impact of which is that JS Bin can't be set in an iframe anymore *but* of course you can still [embed](/help/how-can-i-embed-jsbin) (and if you happen to point an iframe to JS Bin, it'll automagically switch to embed mode for you). 32 | 33 | Finally, if you're security concious, we'll be [adding SSL for all](/help/ssl#enablingsslforallofjsbin) of JS Bin for pro users as a configurable preference (you just need to make sure your external assets are [protocol relative](http://www.paulirish.com/2010/the-protocol-relative-url/) because you can run into trouble): 34 | 35 | ![All of JS Bin under SSL](/images/twdtw/11/ssl.png) -------------------------------------------------------------------------------- /content/blog/ssl-for-all.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SSL now available to all 3 | author: remy 4 | date: '2015-06-21' 5 | published: true 6 | --- 7 | 8 | 9 | As the web moves towards using HTTPS everywhere, JS Bin has *moved* SSL from being a "pro only" feature to making it available to **everyone** as of today. 10 | 11 | ![SSL for all](/images/blog/ssl-for-all.png) 12 | 13 | This means that you can now swap HTTP for HTTPS and [JS Bin will load](https://jsbin.com). Remember there are [considerations with SSL](/help/ssl) so if you're using HTTPS and the content doesn't load, it's likely there's an HTTP based script in there somewhere. 14 | 15 | If you're stickler for security, registered users can opt-in to default to SSL via the [account preferences](https://jsbin.com/account/preferences) - which means whenever you visit a JS Bin edit page, you'll be put on HTTPS. 16 | 17 | You *do* need a pro account to embed bins over SSL, and this will remain a pro feature. 18 | 19 | What this does mean is that I've started to lay the foundations to add offline support via Service Worker - **and pro users, I have something new for you in a few days too** - so stay tuned! 20 | 21 | ## Google's 203 on HTTPS everywhere 22 | 23 | I also highly recommend checking out Jake & Paul's 203 conversation on HTTPS everywhere: 24 | 25 |
26 | -------------------------------------------------------------------------------- /content/blog/ssl.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'SSL: A secure login' 3 | author: fabien 4 | date: '2014-03-19' 5 | published: true 6 | --- 7 | 8 | 9 | 10 | Up until now all of JS Bin has been served over standard HTTP. This is fine for most of the site, however we've decided to upgrade the login and register (and eventually the account settings) pages to use SSL (i.e. encrypted data transmission). 11 | 12 | This means your email and password are always sent over a secure connection, keeping those details safe. 13 | 14 | If you're already logged into JS Bin you'll notice that the next time you visit you'll receive a message and be prompted to sign in again, just the once, using the newer, SSL login. 15 | 16 | If you have any questions, or find any problems with the process, [please submit an issue on github](http://github.com/jsbin/jsbin/issues/new?title=Problem%20with%20new%20SSL%20Login). 17 | 18 | **Possibly related** [Why don't we use SSL on all of JS Bin?](/help/ssl) 19 | -------------------------------------------------------------------------------- /content/blog/the-return-and-the-refactor.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: The Return and The Refactor 3 | author: remy 4 | date: 2018-01-31 5 | --- 6 | 7 | 8 | Hello there dear reader. Remember me? 😃 It's been almost 2 years since the last blog post and I can imagine it has felt like JS Bin has been the same for a little while now. 9 | 10 | The issue tracker was building up (a high of over 650 *open* issues) and various server problems have continued to roll in. The height of which was a notification from Amazon (where JS Bin hosts on AWS), telling me the server JS Bin runs on, will be terminated and removed from usage in 7 days! 😱 11 | 12 | That last issue prompted a "quick" upgrade from node 0.10 to node 4, and then node 7. Which then triggered a cascade of problems to which eventually I threw my toys out of the pram and decided it was time to return to simpler times. 13 | 14 | I started, from scratch, to write a _new_ JS Bin. The first (working, but utterly limited) version was this: 15 | 16 | ![early v5](/images/blog/early-v5.png) 17 | 18 | In fact, this isn't much of a departure from the original, v1 of JS Bin from back in 2008 (sure, it's less orange though!): 19 | 20 | ![v1](/images/blog/v1.jpg) 21 | 22 | So, I've been working on this new refactor since July 2017 on and off between "real" paid work and making slow progress. The current alpha version of JS Bin v5 is quite a decent way along, thought there's still [lots to do](https://github.com/jsbin/jsbin/blob/feat/next-v5/TODO.md), there's quite a few nice toys tucked inside new JS Bin too. Here's one to whet your appetite: 23 | 24 |

Imports on (new) jsbin are pretty cool I think. Downloaded result includes full working version *plus* original source. pic.twitter.com/ARVH89ij9u

— @rem (@rem) January 25, 2018
25 | 26 | 27 | 28 | ## What does this mean? 29 | 30 | It means there's going to be a new, streamlined, modern JS Bin available soon. Just as importantly, _all_ of the legacy code will be dispatched and the new code based entirely on modern development practises. 31 | 32 | The biggest driver for the refactor is the constant downtime that JS Bin suffers for various reasons. This new, v5, version will run from entirely static content served over a CDN. It will have _minimal_ reliance on online servers so the webapp aims to be fully offline capable. 33 | 34 | There will be a number of features that will be dropped, and there will be some functionality yet to be written (for instance, mobile support is great on current JS Bin, but terrible in v5). 35 | 36 | The aim: back to simple. Simple and fast is what JS Bin was good at. Now I want to add reliable to those principles. 37 | 38 | ## Can you try it out? 39 | 40 | Why yes, you can! And, if you don't like it, you can always "eject" back to JS Bin v4 (from the palette menu). 41 | 42 | 43 | 44 | Keep in mind that v5 is still in alpha, and there _will_ be some undocumented parts, some broken parts, some missing parts. If you feel there's something important or unobvious that's going wrong, there's a dedicated support link in v5 that you file an issue. 45 | 46 | Thanks for reading, and I'll be in touch again with updates the progress of v5 development. 47 | -------------------------------------------------------------------------------- /content/blog/twdtw-1-sass-tern-security.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'TWDTW #1: Sass, Tern, Security' 3 | author: remy 4 | date: '2014-03-07' 5 | published: true 6 | --- 7 | 8 | 9 | This is the first installment of "things we did this week". Where we'll share some of the features or changes or fixes we've been working on. Sometimes it will be small features, sometimes BIG exciting features and other times it'll be progress to much longer term goals. 10 | 11 | We're working on local branches of JS Bin with a few cool features. 12 | 13 | ## Sass 14 | 15 | There's been [tons of demand](https://github.com/jsbin/jsbin/issues/176) for Sass support, but until we could pull it off on the client side, I wasn't sure it would land. Now thanks to [sass.js](https://github.com/medialize/sass.js/) and a few hours of hacking, JS Bin has a development branch with Sass (or more specifically SCSS) in a PR [feature/scss](https://github.com/jsbin/jsbin/pull/1229) (see [Rodney Rehm's post](http://blog.rodneyrehm.de/archives/33-libsass.js-An-Emscripten-Experiment.html) on porting to sass.js). 16 | 17 | It does mean that Bourbon, Compass, et al aren't supported, but it's still a good step forward (and the changes also mean it's now easy to add server-based support for Sass - which will come soon). 18 | 19 | ![/images/twdtw/1/sass.png](/images/twdtw/1/sass.png) 20 | 21 | (Demo pitched from [red-team-design.com](http://red-team-design.com/simple-scss-spinner-animation/)) 22 | 23 | ## Tern 24 | 25 | I'm proud to say that my company, [Left Logic](http://leftlogic.com) was the first to back big behind the Tern project last year. And this week [Giulia](http://github.com/electricg) has been adding support to JS Bin. 26 | 27 | It'll be a user preference to enable, and we're working on dynamically loading definition files based on the contents of your bin (i.e. if you have jQuery, it'll automatically load the jQuery definition file for you). 28 | 29 | ![/images/twdtw/1/tern.gif](/images/twdtw/1/tern.gif) 30 | 31 | ## Security 32 | 33 | Finally, [Fabien](http://github.com/allouis) has been doing lots of behind the scenes work that's starting to land in production behind feature flags (which allows us to test new features and letting us control how many people see them). 34 | 35 | Specifically we've reinstated SSL support for login and register. We tried to apply SSL to all of JS Bin some many months back, but because the iframe that your output is rendered in is under https, it would block *all* assets in the iframe pointing to http - this would usually be included libraries, images, CSS, etc, etc. So we had to abandon it, and return with SSL for login and register: 36 | 37 | ![/images/twdtw/1/login.png](/images/twdtw/1/login.png) 38 | 39 | SSL is likely to land next week, and this will also open the door to [editor settings and preferences](https://github.com/jsbin/jsbin/pull/1224) - without having to open devtools to have on the console! 40 | 41 | ## Totally aside 42 | 43 | How seriously sweet is this! 44 | 45 |
46 | 47 | And yes, I have actually asked myself: how could I get JS Bin to control a drone...insane, I completely appreciate. -------------------------------------------------------------------------------- /content/blog/twdtw-10-jshint-linehighlight-pro.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'TWDTW #10: JSHint, line highlighting and update on pro' 3 | author: remy 4 | date: '2014-06-20' 5 | published: true 6 | --- 7 | 8 | 9 | Today we pushed a fairly hefty release containing a few PRs to update libraries, but also a few extra features for all our users. 10 | 11 | ## JSHint 12 | 13 | We've finally got around to updating JSHint (whilst still providing support to IE8 by serving an old version for them). More importantly, for those of you who have [registered](http://jsbin.com/register), you can now configure your default JSHint [preferences](http://jsbin.com/account/preferences): 14 | 15 | ![/images/twdtw/10/jshint-prefs.png](/images/twdtw/10/jshint-prefs.png) 16 | 17 | ## Line highlighting 18 | 19 | The original precursor to JS Bin had line highlighting and sharing (from back in 2007), and it's a great feature that we use all the time in Github, so I went ahead and implemented support in JS Bin. You need line numbers enabled (either from preferences, or the shortcut double click on the panel title, like "HTML"). 20 | 21 | Now when you click in the gutter, it'll highlight that line for sharing. You can also shift+click to select a range: 22 | 23 | ![/images/twdtw/10/line-highlight.png](/images/twdtw/10/line-highlight.png) 24 | 25 | ## An update on Pro 26 | 27 | Pro is all about making JS Bin sustainable so we can continue to keep JS Bin free and for education and making JS Bin the best tool it can be for teaching. 28 | 29 | Tweets like this is why we need you to go pro: 30 | 31 | > Best @CodeClub ever! @js_bin you are a life saver... – [Oli Evans on Twitter](https://twitter.com/olizilla/status/480011434513162240) 32 | 33 | We've been working hard towards releasing Pro which will initially include: vanity URLs, read/write API access, private bins, dropbox sync, beta access to features and first line support. 34 | 35 | So tell your friends, your co-workers, help support JS Bin and look out for the release coming very soon. -------------------------------------------------------------------------------- /content/blog/twdtw-2.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'TWDTW #2: Addons, Collaboration, Hardware' 3 | author: remy 4 | date: '2014-03-14' 5 | published: true 6 | --- 7 | 8 | 9 | This week we released more experiments, discovered one experiment going wrong (sad face), little two day retreat playing with arduinos and where I'll be about giving away some sweet [JS Bin stickers](http://www.flickr.com/photos/remysharp/9576228318/) and maybe even a [t-shirt](http://www.flickr.com/photos/remysharp/10805438263/) or two. 10 | 11 | ## User enabled addons 12 | 13 | Code folding, matched brackets, trailing white spaces, and more. We all have our favourite features in the editors we love, and CodeMirror comes with a great deal of addons that historically I've been careful about enabling (since it adds to the footprint of the jsbin.js script request). 14 | 15 | I've releases a dev feature (i.e. there's no interface, [yet](https://github.com/jsbin/jsbin/pull/1224)) that allows you to enable to lazy-load in a slew of addons from your browser console. For example, in the console if you run the following then refresh: 16 | 17 | ```js 18 | jsbin.settings.addons.fold = true; 19 | ``` 20 | 21 | Gets you code folding: 22 | 23 | ![/images/twdtw/2/fold.png](/images/twdtw/2/fold.png) 24 | 25 | Or maybe you're a Vim beast, easy: 26 | 27 | ```js 28 | jsbin.settings.addons.vim = true; 29 | ``` 30 | 31 | [Addons will be documented](/help/addons) soon, but there are details in the pull request: [#1273](https://github.com/jsbin/jsbin/pull/1273). 32 | 33 | ## First pass at collaboration 34 | 35 | [Giulia](http://github.com/electricg) took [together.js](http://togetherjs.com) and implemented under an experimental flag. 36 | 37 | Sadly, and due to no fault of Giulia's, using together.js just doesn't do the job properly. The way it works is this: whenever anyone makes a change, all of the text is sent and replaced in the collaborators window. This results in the *cursor position being reset* when this happens. 38 | 39 | As it turns out, this already affects *all* the sites that already use together.js with CodeMirror (the embedded editor that JS Bin uses). 40 | 41 | So we're looking at whether we fork together.js and send a pull request to fix this, or go down the [share.js](https://github.com/share/ShareJS) route (which I personally think is highly likely for a few other reasons). 42 | 43 | ## A hardware retreat 44 | 45 | Well, we didn't actually leave the office, but we did take a complete break from coding on JS Bin to experiment with [Arduinos](http://arduino.cc/), [Sparks](https://www.spark.io/), soldering irons, [Johnny Five](https://github.com/rwaldron/johnny-five/) and lots of LEDs. 46 | 47 | ![/images/twdtw/2/hack.jpg](/images/twdtw/2/hack.jpg) 48 | 49 | Overall, great little fun. Though none of us managed to produce anything that we'll be recording videos for Kickstarter, we have now broadened the amount of things we don't know! 50 | 51 | ## Out and about 52 | 53 | I'll be venturing out of sunny Brighton to a couple of London events, and I'll have a fistfull of JS Bin stickers (which are *really* nice quality) and a few t-shirts at [Edge London](http://lanyrd.com/2014/edgeconf/) and [LNUG](http://lanyrd.com/2014/lnug-march/). So come grab me! 54 | 55 | ## Totally aside 56 | 57 | This shouldn't be funny, but it's utterly hypnotic... 58 | 59 |
-------------------------------------------------------------------------------- /content/blog/twdtw-3-codemirror-settings.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'TWDTW #3: CodeMirror, User settings, Hacks' 3 | author: remy 4 | date: '2014-04-01' 5 | published: true 6 | --- 7 | 8 | 9 | Last week we rolled out [SSL support](/blog/ssl) for our sign in (long overdue), and this week we've had two pretty cool releases: CodeMirror 4 and (in private testing) user settings UI. 10 | 11 | ## CodeMirror 4 12 | 13 | [CodeMirror](http://codemirror.net) is the excellent editor that backs JS Bin. Version 4 was released last week and on Tuesday it landed in JS Bin. The highlights for me personally are multiple cursors and sublime mode (via `jsbin.settings.addons.sublime = true`): 14 | 15 | ![/images/twdtw/3/cm4.gif](/images/twdtw/3/cm4.gif) 16 | 17 | But isn't setting these [sweet addons](/blog/twdtw-2#userenabledaddons) via the console a bit tricky and maybe for the hacker?! Well, we've been working hard to introduce a "proper" UI which has gone live behind alpha flags so we can give it some production testing, so I'm expecting to release to public next week. 18 | 19 | ## User Settings 20 | 21 | But take a look: 22 | 23 | ![/images/twdtw/3/settings.png](/images/twdtw/3/settings.png) 24 | 25 | These settings will give you full control over how your editor works, and if you think anything is missing, we're looking for *your* input. We're also working on adding a JS Bin preferences panel to help manage your default templates and default processors (like Less or CoffeeScript) and more. 26 | 27 | ## The Autoprefixer hack - did you know...? 28 | 29 | Last Friday I saw a [tweet asking for Autoprefixer support](https://twitter.com/pepelsbey_/status/449460914941853696) (which coincidently landed in our friendly neighbour CodePen about two hours after we replied with...): JS Bin is extremely maluable. 30 | 31 | So we hacked together a bin that lets you run Autoprefixer entirely client side, and uses the CSS panel and the magical `%css%` value to post process *your* CSS through Autoprefixer. 32 | 33 | Then in the afternoon [Giulia](http://github.com/electricg) added this to our library drop down, so if you select Autoprefixer, you can use the CSS panel without prefixes. All without a server side change. [Have a play](http://jsbin.com/xewil/1/edit). 34 | 35 | 36 | ## Totally aside 37 | 38 | Fabien found and shared this site [8tracks](http://8tracks.com) that you can give it a tag, say "programming", and you can listen to tracks to suit that mood. So get your groove on. 39 | 40 | ![/images/twdtw/3/dance.gif](/images/twdtw/3/dance.gif) -------------------------------------------------------------------------------- /content/blog/twdtw-4-tern-pro-features.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'TWDTW #4: Tern live, and our upcoming Pro features' 3 | author: remy 4 | date: '2014-04-07' 5 | published: true 6 | --- 7 | 8 | 9 | We've now released Tern to live for everyone, and we've been hard at work on our Pro features and working on improving the JS Bin core code. 10 | 11 | ## Tern 12 | 13 | A few weeks ago we showed off the [demo of Tern](/blog/twdtw-1-sass-tern-security#tern), and now it's live. You need to manually turn it on via the `addons`: 14 | 15 | ```js 16 | jsbin.settings.addons.tern = true; 17 | ``` 18 | 19 | ...then refresh and Tern is enabled in the JavaScript panel. 20 | 21 | ## Upcoming Pro feature: vanity urls 22 | 23 | We're all working hard on Pro features for JS Bin (whilst also pushing out more and more features for *all* users), and I've just finished the first version of vanity URLs. 24 | 25 | This means your shared URLs will include your username to your editable bins, like [http://rem.jsbin.com/kuzef/2/](http://rem.jsbin.com/kuzef/2/) and more importantly, you can *publish to your vanity url*, as so: [http://rem.jsbin.com](http://rem.jsbin.com). 26 | 27 | The vanity URL will also support pointing your own domain directly at JS Bin (like code.rem.io). 28 | 29 | Also in the works is Dropbox support (for your own copy of you bins but also quickly embedding external resources). More on that soon. 30 | 31 | Most importantly, Pro is the way that JS Bin will continuing to be open source and **free for education**. And we need your help to do that. So spread the word, and [sign up too](https://jsbin.com/register) so you're ready for when it lands! 32 | 33 | ## Totally aside 34 | 35 | Fabien had been catching up on some classic movies, in particular Sneakers, which reminded me of this amazing story by Moran Cerf, about a particular point in life where his group decided to say "yes". 36 | 37 |
38 | -------------------------------------------------------------------------------- /content/blog/twdtw-5-settings-dropbox-heartbleed.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'TWDTW #5: Heartbleed, Settings, User Backups' 3 | author: fabien 4 | date: '2014-04-11' 5 | published: true 6 | --- 7 | 8 | 9 | This week we've been dealing with the Heartbleed issue, but more positively have also shipped (for internal, but live testing) updates to user settings and a new pro feature: real-time backup of your bins. 10 | 11 | ## Heartbleed, no more 12 | 13 | The Heartbleed bug definately took it's toll on [Remy](https://twitter.com/rem/status/454293558317821952) as he patched our OpenSSL, reissued SSL certificates and fixed weird [MySQL issues](http://stackoverflow.com/questions/22968867/error-1018-hy000-cant-read-dir-of-db-errno-13-not-a-permission/23014237), but we were [no longer vulnerable](/blog/heartbleed)! 14 | 15 | This, from [xkcd](http://xkcd.com/1354/), does a good job of explaining the issue: 16 | 17 | ![Are you still there, server? It's me, Margaret.](http://imgs.xkcd.com/comics/heartbleed_explanation.png) 18 | 19 | ## JS Bin settings & preferences 20 | 21 | [Giulia](https://github.com/electricg) has been continuing work on [our new account pages](/blog/twdtw-3-codemirror-settings#usersettings), with a new page for managing your default preferences, such as your starting open panels, templates, processors and so on. 22 | 23 | We're hoping to release this to you all next week. 24 | 25 | ![Preferences page](/images/twdtw/5/preferences.png) 26 | 27 | 28 | ## User backups 29 | 30 | For the past couple of weeks, I've been working on a new part of JS Bin called [Jobsworth](https://github.com/jsbin/jobsworth). This is a task manager that communicates using [zeromq](http://zeromq.org/) and contrary to it's name, will do our bidding. Initially backing up all my new bins to Dropbox in real-time (and we intend to add other services, like SkyDrive, Drive, etc). 31 | 32 | The format of the file saved in which the bins are saved is a single HTML file that includes the full source of the bin, including pre-processor's source, which acts as an API for JS Bin importing too [#609](https://github.com/jsbin/jsbin/issues/609). 33 | 34 | ## Totally aside 35 | 36 | If you've not seen the oscar winning [Gravity](http://www.imdb.com/title/tt1454468/), well, you should, but this is Gravity for those of you without much time on your hands - enjoy! 37 | 38 |
39 | 40 |
41 | 42 | -------------------------------------------------------------------------------- /content/blog/twdtw-6-syncing-pro-accounts.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'TWDTW #6: Bin files, Dropbox, Pro Accounts' 3 | author: fabien 4 | date: '2014-04-25' 5 | published: true 6 | --- 7 | 8 | 9 | This week we've been doing mostly internal updates to JS Bin, so not much to see. I've been working on updating the way in which we create HTML 10 | files from bins and we're going to start experimenting with two-way syncing with [Dropbox](http://dropbox.com) 11 | 12 | ## Bin files 13 | 14 | Transforming a Bin into a html file has always been done by JS Bin - to display your output in the iframe, but this week I've been creating a module 15 | to create more than just a renderable file, but a file that stores both the raw panel content and the content *after* it has gone through 16 | preproccesors. This will eventually allow files in this format to be dropped into JS Bin and populate all the panels, cool! 17 | 18 | ## Dropbox 19 | 20 | [Remy](https://twitter.com/rem) and I were talking about our Dropbox linking being more than just saving - but syncing, where any changes made to your files on Dropbox would then be reflected in JS Bin. We're hoping to have two-way syncing of bins to Dropbox ready to be tested internally by next week. Here's how the current dropbox linking works: 21 | 22 |
23 | 24 |
25 | 26 | ## Pro Accounts 27 | 28 | Our pro account offering is being polished for when Remy returns to the office and we can release them, [Danny](https://twitter.com/yandle) popped in this week to go over the designs and user flow from registered or anonymous to pro and I've been compiling a list of all JS Bins current and future features, it's a lot bigger than I thought! 29 | 30 | ## Totally aside 31 | 32 | Also, a very big congratulations to Remy and [Julie](https://twitter.com/julieanne) - they've had a beautiful baby girl :D! 33 | 34 | ![](/images/twdtw/6/baby.png) 35 | -------------------------------------------------------------------------------- /content/blog/twdtw-7-processors-search.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'TWDTW #7: SCSS, Compass and search' 3 | author: remy 4 | date: '2014-05-02' 5 | published: true 6 | --- 7 | 8 | 9 | Whilst Fabien continues with [Pro user integration](/blog/twdtw-6-syncing-pro-accounts) and Giulia [goes on holiday](https://twitter.com/electric_g/status/460844432649355264), I've snuck out of paternity leave and cheekily completed a bit of dev. 10 | 11 | ## SCSS, Compass and processors total upgrade 12 | 13 | In the last year, I had to remove the Stylus processor because there was a weird bug that caused an infinite loop (both client *and* server side). Since JS Bin is single threaded(!) Stylus can't be reintroduced until it's running in a separate process. 14 | 15 | In the same vein as [Jobsworth](/blog/twdtw-5-settings-dropbox-heartbleed#userbackups) (our zeromq based bin backup server), I've created [Pennyworth](https://github.com/jsbin/pennyworth): a server for running processors and spitting out rendered CSS, JavaScript or HTML. 16 | 17 | There's a simple [markdown](https://github.com/jsbin/pennyworth/blob/master/targets/markdown/index.js) module, but more importantly to user demand, there's modules for [SCSS](https://github.com/jsbin/pennyworth/blob/master/targets/scss/index.js) and [SCSS with Compass](https://github.com/jsbin/pennyworth/blob/master/targets/sass-with-compass/index.js) (and more being adding before we go live). 18 | 19 | Here's a couple of shots using a couple of [Ana Tudor's](http://twitter.com/thebabydino) excellent SCSS demos: 20 | 21 | ![SCSS demos](/images/twdtw/7/scss.gif) 22 | 23 | Once I'm back from paternity leave (in 2 weeks) I'll be focused on releasing this entirely. 24 | 25 | ## Help & blog search 26 | 27 | This part of JS Bin (the blog and help) are statically generated using [Harp](http://harpjs.com/), which makes search a little tricky (and bin searching is also on the roadmap, but a separate issue for now). 28 | 29 | I've hacked in a simple solution that generates a static JSON file with all the words from the content on help & blog. It's not perfect, and requires JavaScript right now (and no keyboard support yet), but it's a start to jump to content a little quicker. 30 | 31 | ![Search example](/images/twdtw/7/search.png) 32 | 33 | ## Totally aside 34 | 35 | It's a bank holiday weekend here in the UK, which means most of us have Monday off. So what to do with all this free time? How about melting your brain on TV? 36 | 37 | [Huffington Post](http://www.huffingtonpost.com/2014/05/01/binge-watching-chart-_n_5246342.html) rescues us from a hard decision: 38 | 39 | ![TV brain melt](/images/twdtw/7/tv-brain-melt.jpg) -------------------------------------------------------------------------------- /content/blog/twdtw-8-svg-settings.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'TWDTW #8: SVG support and settings live' 3 | author: fabien 4 | date: '2014-05-15' 5 | published: true 6 | --- 7 | 8 | 9 | With [Giulia](https://twitter.com/electric_g) back from holiday and [Remy](https://twitter.com/rem) easing back into work, the Left Logic offices 10 | have been a bit more lively, and pushing a few more bits to production. 11 | 12 | ## SVG Support 13 | 14 | We just landed SVG support in JS Bin. Simply add `.svg` to the bin URL, and JS Bin will correctly serve up the HTML content panel as SVG with the correct headers. So now you can easily [prototype SVG](http://jsbin.com/gecew.svg) using JS Bin: 15 | 16 | ```html 17 | Source: http://jsbin.com/gecew/edit 18 | ``` 19 | 20 | Source: http://jsbin.com/gecew/edit 21 | 22 | Thanks to @jorgeATGU for the SVG madness! 23 | 24 | The feature request came through from [Emil on twitter](https://twitter.com/ThatEmil/status/464665080005951488), suggesting that the `.svg` extension serve up the right headers. So we opened a [feature request](http://github.com/jsbin/jsbin/issues/1466), and [one simple change](https://github.com/jsbin/jsbin/commit/59d729f3cade53ba10ca3c817daa51c1e36bce15) later it was live. 25 | 26 | Emil also [blogged about his own workflow](http://thatemil.com/blog/2014/05/14/using-js-bin-as-an-svg-playground/) with JS Bin and SVGs. It's *that* easy to help make JS Bin a better product. 27 | 28 | ## User settings live 29 | 30 | ![/images/twdtw/8/settings.png](/images/twdtw/8/settings.png) 31 | 32 | We've spoken a [fair](/blog/twdtw-3-codemirror-settings#usersettings) [bit](/blog/twdtw-4-tern-pro-features#tern) [about](/blog/twdtw-5-settings-dropbox-heartbleed#jsbinsettingspreferences) the upcoming user settings in JS Bin and today we've started our staggered release. 33 | 34 | We're releasing to 10% of users ([using our feature flags](https://github.com/remy/feature-gateway#ab-testing)) to start with to monitor the affect on our infrastructure (since we've moved to a memcache system for our sessions), and we'll quickly increase this to 100% over the coming days (and weeks). 35 | 36 | ## Want a JS Bin sticker? At BACON conf? 37 | 38 | I'll be attending the [BACON conference](http://devslovebacon.com/) and I'll be armed with a swathe of JS Bin stickers, I look pretty much like my avatar, 39 | so hit me up if you want one for your laptop! 40 | 41 | ## Totally aside 42 | 43 | Myself and Giulia were in tears this week watching this clip over and over and over: Nick Cage knows how to dive: 44 | 45 |
46 | -------------------------------------------------------------------------------- /content/blog/twdtw-9-tweaks-maintenance.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'TWDTW #9: Tweaks and maintenance' 3 | author: giulia 4 | date: '2014-06-09' 5 | published: true 6 | --- 7 | 8 | 9 | These past three weeks we have been mainly working on bug fixes and internal maintenance, so no big announcement except that we have released to 100% of our users the [settings and preferences pages](/blog/twdtw-8-svg-settings#usersettingslive). Go and have fun with it! 10 | 11 | ## The small things that matter 12 | 13 | We're often releasing multiple times throughout the week with small bug fixes and tweaks, a few that you might have noticed: 14 | 15 | - Github changed their URL format for gists, so we fixed [gist import](/help/import-gists) (which was broken for a short time) [#1507](https://github.com/jsbin/jsbin/pull/1507) 16 | - Logged in users can archive using keyboard shortcut ctrl+Y [#1000](https://github.com/jsbin/jsbin/issues/1000) 17 | - All the [JS Bin keyboard shortcuts](/help/keyboard-shortcuts) are documented in detail 18 | - We changed "Bins" to "File" in the top menu [#1414](https://github.com/jsbin/jsbin/issues/1414) (more on why in a later post) 19 | 20 | ## Spread your love 21 | 22 | We love when you help us improving JS Bin by raising [issues](https://github.com/jsbin/jsbin/issues), bugs and pull requests, and we love it just as much when you tell us that you love JS Bin: 23 | 24 | > [Why I Love JS Bin](http://www.jimmylauzau.com/blog/2014/05/28/why-i-love-js-bin/) by Jimmy Lauzau [@jimmay5469](http://twitter.com/jimmay5469) 25 | 26 | Where Jimmy talks about using the Ember branded version of JS Bin, his preferences and default templates. 27 | 28 | ## Totally aside 29 | 30 | We like the classics and we like geeky strange ideas, so what's better than Star Wars, re-edited in alphabetical order..? 31 | 32 |
33 | -------------------------------------------------------------------------------- /content/blog/urls.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: A change to the way our URLs work 3 | author: remy 4 | date: '2015-06-16' 5 | published: true 6 | --- 7 | 8 | 9 | We've just landed a change to the way JS Bin URLs work, and though the new way aims to be intuitive and backward compatible, some of you sharp sighted users might have spotted the change already and wondering what changed and why. 10 | 11 | ## In short 12 | 13 | - Revisions are referred to as "snapshots". 14 | - Snapshots (the numerical identifier) only appear in the URL when take a snapshot (and want to share that snapshot). 15 | - The latest version is the default (i.e. without a number in the URL). 16 | - The share menu has been updated to be simpler, whilst also more powerful. 17 | 18 | ## Revisions are now called snapshots 19 | 20 | There's been some confusion of exactly what a revision was, and when they're created. There was also language that talked about creating "milestones". 21 | 22 | So we've changed this all to read as a "snapshot". 23 | 24 | A snapshot is a static moment in a bin's lifetime. The shortcut is ctrl+ s to create a snapshot of the current code. 25 | 26 | ## Snapshot numbers in URLs 27 | 28 | A difference in the URLs you might notice is that you'll only see the snapshot number in the URL when you're looking at a *snapshot*. If you're looking at the **latest state of the bin, then there's no snapshot number**. 29 | 30 | This makes URLs simpler, but also means it's easy for you to read a URL and know immediately if you're looking at the latest state or not. 31 | 32 | ## Sharing simplified 33 | 34 | The share menu has also been updated to reflect this move to snapshots. *This* is where we feel the clarification will be intuitive. If you want to share a snapshot, there's no "lock revision" confusion, just the option to share the latest state or a snapshot (and changing what you want to share, automatically updates the URLs you can share). 35 | 36 | ![New share menu](/images/blog/new-share.png) 37 | 38 | As you can see from the screenshot, the share menu also offers you direct links to the different sources. In my particular case, the JavaScript panel contains JSON, so the share menu has detected that giving me a direct link to the [JSON content](https://rem.jsbin.com/colefa.json). 39 | 40 | ## Codecasting by default 41 | 42 | Now if you share the edit view of your bin and the latest state (ie. not a snapshot), then the viewer will automatically see a code casting view (where the code changes in real time as you change your code). 43 | 44 | Although the old `/watch` URL will still work, you can share the regular `/edit` URL and this has all the code casting built in. -------------------------------------------------------------------------------- /content/blog/welcome.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Welcome to the new help & blog 3 | author: remy 4 | date: '2014-02-27' 5 | published: true 6 | --- 7 | 8 | 9 | JS Bin for years has done an absolutely superb job of giving its users an editor and the live output of the HTML, CSS & JavaScript. Something the project has been terrible at is exposing features and new information. 10 | 11 | We try hard to recess the application of JS Bin to let you get on with coding right away. This way *everyone gets a cursor*. You visit JS Bin, you type: you get a bin. 12 | 13 | But we're also very aware of the cost of recessing away like this. Often I see tweets and issues along the lines of "it would be great if I could do X", and I reply along the lines of "yeah, we did that back in 2011, it's here...". 14 | 15 | It's our own fault, but *this* new area of JS Bin will be the home for all the [help](/help) and the blog will be used to share our workings on new features and ideas—and hopefully share some of the process we use. 16 | 17 | There's a few ways you can keep track of what's going on: 18 | 19 | * Via twitter, follow [@js_bin](http://twitter.com/js_bin) 20 | * [Subscribe](/feed.xml) to the blog RSS feed 21 | * Watch the [github projects](http://github.com/jsbin) 22 | 23 | ## Say Hello to the Team 24 | 25 | I wanted to introduce you to the team that's working hard on JS Bin to day to make it all that it can be: 26 | 27 | * Remy Sharp ([twitter](http://twitter.com/rem), [github](http://github.com/remy)) - dev and direction 28 | * Danny Hope ([twitter](http://twitter.com/yandle), [github](http://github.com/dannyhope)) - UX and design 29 | * Fabien O'Carroll ([twitter](http://twitter.com/allouis_), [github](http://github.com/allouis)) - dev 30 | * Giulia Alfonsi ([twitter](http://twitter.com/electric_g), [github](http://github.com/electricg)) - dev 31 | 32 | And an equal hello to all the [contributors](https://github.com/jsbin/jsbin/graphs/contributors) over the years. 33 | 34 | ## What's shipped just recently 35 | 36 | - Subtle, flatter design 37 | - [Delete a bin revision](/help/delete-a-bin) 38 | - Windows & Mavericks support is now solid for the [local npm install](/help/2-second-setup) 39 | 40 | ## What we're working on 41 | 42 | There's a slew of projects going on at the moment, and we'll be posting as progress is made: 43 | 44 | - Pro accounts and white-labeled version of JS Bin (see [emberjs.jsbin.com](http://emberjs.jsbin.com) for example) - [get in touch](http://leftlogic.com/contact?subject=JS%20Bin%20white%20label) if you'd like to enquire about this 45 | - Monthly competitions giving away stickers and pro accounts 46 | - A vastly better mobile experience 47 | - SSL for login 48 | - Sass & SCSS support 49 | - Timeline recording and playback 50 | - [And a lot more](http://github.com/jsbin/jsbin/issues) 51 | 52 | I'd love to hear your feedback, if you're using JS Bin for teaching or sharing - what's your experience like? How can we make JS Bin better for all of you? 53 | 54 | – Remy 55 | -------------------------------------------------------------------------------- /content/help/2-second-setup.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Local JS Bin: 2 second guide' 3 | category: hack 4 | --- 5 | 6 | 7 | 1. Install [node](http://nodejs.org) 8 | 2. From your terminal (or [command prompt](http://pcsupport.about.com/od/windows-8/a/command-prompt-windows-8.htm) if you're windows) and run these two commands: 9 | 10 | ```bash 11 | npm install -g jsbin 12 | jsbin 13 | ``` 14 | 15 | **Note:** You *may* have to run npm as the super user, so in that case, the first command would be, and you will be prompted for your password: 16 | 17 | ```bash 18 | sudo npm install -g jsbin 19 | ``` 20 | 21 | *The end.* 22 | 23 | ...or read the [detailed guide on running JS Bin locally](/help/running-a-local-copy-of-jsbin) for more options and control over the setup. -------------------------------------------------------------------------------- /content/help/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Help 3 | --- 4 | -------------------------------------------------------------------------------- /content/help/about.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: About JS Bin 3 | category: learn 4 | --- 5 | 6 | 7 | *JS Bin is an open source collaborative web development debugging tool.* 8 | 9 | Made in Brighton, England with blood sweat and code. 10 | 11 | ## What can JS Bin do? 12 | 13 | * Write code and have it both save in real-time, but also render a full preview in real-time 14 | * Help debug other people's JavaScript, HTML or CSS by sharing and editing urls 15 | * CodeCast - where you share what you're typing in JS Bin in real-time 16 | * Remote rendering - view the output of your JS Bin on any device on any platform, updating in real-time 17 | * Processors, including: coffee-script, LESS, Markdown and Jade. 18 | * Debug remote Ajax calls 19 | 20 | Find out more about JS Bin's features via the [YouTube JS Bin playlist](http://jsbin.com/videos). 21 | 22 | ## Who built this? 23 | 24 | JS Bin was built by [Remy Sharp](http://remysharp.com) and is completely open source and available [http://github.com/remy/jsbin](http://github.com/remy/jsbin). You can also follow [@rem](http://twitter.com/rem) on Twitter where he'll tweet about JavaScript, HTML 5 and other such gems. 25 | 26 | If you would like to work with Remy and his company, [Left Logic](http://leftlogic.com) on a front end development project, [please get in touch](http://leftlogic.com/contact?message=Found%20through%20jsbin.com). 27 | 28 | UX was kindly donated by [Danny Hope](http://yandleblog.com) who also tweets as [@yandle](http://twitter.com/yandle). 29 | 30 | The vast majority of the port from PHP to Node in June 2012 was done by [Aron Carroll](http://aroncarroll.com/) who also plays in github as [@aron](http://github.com/aron). 31 | 32 | ## A short history 33 | 34 | [JS Bin](http://jsbin.com) is a webapp specifically designed to help JavaScript and CSS folk test snippets of code, within some context, and debug the code collaboratively. 35 | 36 | JS Bin allows you to edit and test JavaScript and HTML (reloading the URL also maintains the state of your code - new tabs doesn't). Once you're happy you can save, and send the URL to a peer for review or help. They can then make further changes saving anew if required. 37 | 38 | The original idea spawned from a conversation with another developer in trying to help him debug an Ajax issue. The original aim was to build it using Google's app engine, but in the end, it was [John Resig](http://ejohn.org)'s [Learning app](http://ejohn.org/apps/learn) that inspired me to build the whole solution in JavaScript with liberal dashes of jQuery and a tiny bit of LAMP for the saving process. 39 | 40 | [Version 1](http://1.jsbin.com) of [JS Bin](http://www.flickr.com/photos/remysharp/4284906136) took me the best part of 4 hours to develop [back in 2008](http://remysharp.com/2008/10/06/js-bin-for-collaborative-javascript-debugging/), but [version 2](http://2.jsbin.com) was been rewritten from the ground up and is completely [open source](http://github.com/remy/jsbin). 41 | -------------------------------------------------------------------------------- /content/help/adding-custom-libraries.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: How to add more libraries to the library list 3 | category: hack 4 | --- 5 | 6 | 7 | JS Bin comes with out of the box support for a number of libraries, but if you're comfortable in the developer tools, you can add your own. 8 | 9 | The format for a new library entry is as follows: 10 | 11 | ```js 12 | { 13 | text: 'My Category', 14 | requires: 'http://someotherlibary.com/lib.js', // optional 15 | style: 'http://someotherlibary.com/style.css', // optional 16 | scripts: [ 17 | { text: 'My library', url: 'http://foo.com/somelib.js' } 18 | ] 19 | } 20 | ``` 21 | 22 | There's a variable called libraries on the global namespace, with two methods: add and clear. 23 | 24 | To add this library, open your browser based console, and run the following (changing the library for your own): 25 | 26 | ```js 27 | var mylib = {...}; // the "My Library" object above 28 | libraries.add(mylib); 29 | ``` 30 | 31 | These changes will save to your browser (on those browsers that support the Storage API - all the latest versions of browsers), and will remain until you call `libraries.clear()`. 32 | -------------------------------------------------------------------------------- /content/help/adding-libraries.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Adding Libraries 3 | category: hack 4 | related: 5 | - adding-custom-libraries 6 | - versions 7 | --- 8 | 9 | 10 | You can manually [add custom libraries](/help/adding-custom-libraries) to your own instance of JS Bin, however if there's an important library or framework that many others want to use, then it makes sense to have it included in JS Bin's library selector: 11 | 12 | ![Libraries dropdown open](/images/libraries.png) 13 | 14 | You will need to [fork the JS Bin](github.com/jsbin/jsbin/fork) Github repository, and edit `/public/js/editors/libraries.js`. 15 | 16 | ⚠️ The library and any related assets that are included in the library **must** be served over https otherwise the pull request cannot be accepted. 17 | 18 | In general, a library tends to be stand alone, i.e. the paper.js library, so it only requires a new object in the `libraries` array with a label and a URL: 19 | 20 | ```js 21 | { 22 | url: 'https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.9.12/paper.js', 23 | label: 'Paper.js' 24 | }, 25 | ``` 26 | 27 | If the library has other prerequisite, like a CSS file or another JavaScript library (like jQuery), the `url` property can also accept an array: 28 | 29 | ```js 30 | { 31 | url: [ 32 | 'https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.2/css/normalize.min.css', 33 | 'https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.2/css/foundation.min.css', 34 | 'https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.2/js/vendor/modernizr.js', 35 | 'https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.2/js/vendor/jquery.js', 36 | 'https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.2/js/foundation.min.js' 37 | ], 38 | label: 'Foundation 5.5.2' 39 | }, 40 | ``` 41 | 42 | If the library being added has multiple options, such as combinations of popular builds of Angular, then a `group` property with the same value can be included and JS Bin will automatically group these options together. 43 | 44 | Finally, in the rare case that additional code is required when the library is included that will make the user's workflow better, there is support for a `snippet` property, as seen in the Autoprefixer example below: 45 | 46 | ```js 47 | { 48 | url:'https://rawgithub.com/ai/autoprefixer-rails/master/vendor/autoprefixer.js', 49 | label: 'Autoprefixer', 50 | snippet: '\n\n' 51 | }, 52 | ``` 53 | 54 | Once you've made your changed, send a [pull request](https://github.com/jsbin/jsbin/pulls) and it will be reviewed and merged if successful. 55 | -------------------------------------------------------------------------------- /content/help/adding-processors.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Adding new pre-processors 3 | category: fix 4 | --- 5 | 6 | 7 | Adding processors to JS Bin requires changes to the server side of JS Bin *and* the client side. This article explains how to implement a processor. 8 | 9 | If you're contributing a new processor to JS Bin, you will need to include the processor for [local](#localinstalls), [production](#production) and the [client side](#clientsidechanges). The process is relative simple, and documented below. 10 | 11 | The processor will need a unique name which is the id for the processor, such as `coffeescript`. 12 | 13 | ## Local installs 14 | 15 | Processors are forked directly off the main Node process. There are a number of specific changes required. 16 | 17 | ### Support and mime types 18 | 19 | In [`lib/processors/index.js`](https://github.com/jsbin/jsbin/blob/feature/scss/lib/processors/index.js) add the name of processor in the `supports` property. 20 | 21 | Also add the mime type for the processor type and any applicable aliases, such as Markdown having `md`, `mdown` and `markdown`. 22 | 23 | Finally, the `lookup` property is which panel the processor is found in. i.e. Sass is in `css`, and Markdown is in `html`. 24 | 25 | ### The processor 26 | 27 | Next, create a new file in `lib/processors` with the name of the processor, such as `coffeescript.js`. The processor must export a function that accepts the `source` and returns a new promise. i.e.: 28 | 29 | ```js 30 | 'use strict'; 31 | var RSVP = require('rsvp'); 32 | var coffee = require('coffee-script'); 33 | 34 | module.exports = function (source) { 35 | return new RSVP.Promise(function (resolve, reject) { 36 | try { 37 | resolve(coffee.compile(source, { 38 | bare: true 39 | })); 40 | } catch (e) { 41 | reject(e); 42 | } 43 | }); 44 | }; 45 | ``` 46 | 47 | 48 | 49 | ## Production 50 | 51 | JS Bin runs it's processors on a separate machine using a service we call [Pennyworth](http://github.com/jsbin/pennyworth). 52 | 53 | 54 | ## Client side changes 55 | 56 | TODO... -------------------------------------------------------------------------------- /content/help/ajax-requests.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Ajax request to bins 3 | category: hack 4 | related: 5 | - how-can-i-embed-jsbin 6 | --- 7 | 8 | 9 | JS Bin supports [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS) and a number of different ways to access your bin's content using Ajax techniques. 10 | 11 | ## Response types 12 | 13 | 1. Full HTML output (including JS Bin edit link and live reload scripts) 14 | - Full HTML output (excluding JS Bin edit link etc) 15 | - Single panel output (using .js or .css) 16 | - JSON for the JavaScript panel 17 | - JSON bin object 18 | 19 | ## Example code 20 | 21 | Below is a bin that can be tweaked to change the request it's making so you can see, live, what the impact of that change is: 22 | 23 |
Ajax responses from JS Bin
24 | 25 | The example includes prepared ajax requests that are commented out. If you change the line from: 26 | 27 | ```js 28 | /* 3. get the JavaScript panel as JSON 29 | url: '//jsbin.com/xuyis/1.json', 30 | dataType: 'json', 31 | //*/ 32 | ``` 33 | 34 | And add a leading `/` to the comment, the code will run: 35 | 36 | ``` 37 | //* 3. get the JavaScript panel as JSON 38 | url: '//jsbin.com/xuyis/1.json', 39 | dataType: 'json', 40 | //*/ 41 | ``` 42 | 43 | Try it out and see how the result changes. 44 | 45 | *TODO: extend this article to show individual ajax requests.* -------------------------------------------------------------------------------- /content/help/api.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: JS Bin API 3 | category: hack 4 | --- 5 | 6 | 7 | JS Bin's API comes in a few flavours. 8 | 9 | 1. Get data 10 | 2. Post data for pro user accounts (to be detailed) 11 | 12 | ## Read API 13 | 14 | ## Write API 15 | 16 | A simple REST based API exists for anonymous users if it is enabled in your config.\*.json, or can be restricted to registered users with a key specified in `ownership.api_key` 17 | 18 | Authentication is required for all API requests unless one of the following api configuration options are set: 19 | 20 | - `api.allowAnonymousReadWrite` - if set to true allows GET and POST operations to the API anonymously (without an API key) 21 | - `api.allowAnonymousRead` - if set to true allows GET operations to the API anonymously (without an API key) 22 | 23 | By default, `config.default.json` has `api.allowAnonymousRead` set to true. 24 | 25 | Curl authentication examples: 26 | 27 | ```text 28 | $ curl http://{{host}}/api/:bin -H "Authorization: token {{token_key}}" 29 | $ curl http://{{host}}/api/:bin?api_key={{token_key}} 30 | ``` 31 | 32 | End points are: 33 | 34 | - `GET /api/:bin` - Retrieve the latest version of the bin with that specified ID 35 | - `GET /api/:bin/:rev` - Retrieve the specific version of the bin with the specified ID and revision 36 | - `POST /api/save` - Create a new bin, the body of the post should be URL encoded and contain `html`, `javascript` and `css` parameters 37 | - `POST /api/:bin/save` - Create a new revision for the specified bin, the body of the post should be URL encoded and contain `html`, `javascript` and `css` parameters 38 | -------------------------------------------------------------------------------- /content/help/asset-uploading.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Asset uploading 3 | category: pro 4 | video: "//www.youtube.com/embed/d8TkAeGFLx4?rel=0" 5 | --- 6 | 7 | 8 | Available to [pro only](/upload). Simply drag & drop your assets into JS Bin and it'll upload instantly and insert an image tag with your newly uploaded asset. 9 | 10 | Each pro user can host up to 1GB of assets - so that gives you a bit of freedom to sling up your images as quickly as you create bins. 11 | 12 | To manage your assets, head over to the [assets](/account/assets) account page and you can delete files and check your usage. 13 | 14 | ## Uploading non-image assets 15 | 16 | Navigate to the [assets](/account/assets) page and drag the file directly in to the browser window. This asset (such as a CSS file) can be now re-used inside of your bins. 17 | 18 | ## Demo 19 | 20 | You can see a demo of upload in action below: 21 | 22 |
-------------------------------------------------------------------------------- /content/help/change-your-password.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: How to change your password 3 | category: learn 4 | --- 5 | 6 | 7 | Click on your avatar in the top right corner to open the account settings dropdown, from here you can enter your new password and click "Update account". 8 | 9 | ![/images/change-your-password.png](/images/change-your-password.png) 10 | 11 | As an extra precaution, you could log out and back in again to fully clear your session. 12 | 13 | Note, if you log in using your Github account, you can still set a password, but that password is for JS Bin only, if you would like to change your Github password please head over to [Github](https://github.com). 14 | -------------------------------------------------------------------------------- /content/help/clearing-the-console.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: How to clear the console 3 | category: learn 4 | --- 5 | 6 | 7 | You can clear the JS Bin console either using a [keyboard shortcut](/help/keyboard-shortcuts) or programmatically using JavaScript. 8 | 9 | The keyboard shortcut (from any panel) is: ctrl+l 10 | 11 | The JavaScript code is: `console.clear()` 12 | -------------------------------------------------------------------------------- /content/help/customise-editor-settings.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: How to customise the editor settings 3 | category: learn 4 | video: "//www.youtube.com/embed/pzFqaRJwNQ8" 5 | --- 6 | 7 | 8 | *This article needs updating - as this is only required if you don't have a login.* 9 | 10 | Since JS Bin simply uses CodeMirror as the editor, naturally we expose that configuration to allow you to customise it yourself. Say if you don’t like line wrapping, or prefer 8 character width tabs - you can change all this yourself. 11 | 12 | Techniques used in this video: 13 | 14 | * Browser console to change `jsbin.settings.editor` 15 | * Enable debug mode using `jsbin.settings.debug = true` 16 | 17 |
18 | 19 |
20 | -------------------------------------------------------------------------------- /content/help/debugging-preferences.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Debbugging your preferences 3 | category: hack 4 | --- 5 | 6 | 7 | If you're having problems with preferences being saved (perhaps the right panels are not being shown that you've selected), it's sometimes useful to inspect the settings that are stored locally on the browser you're experiencing issues with. 8 | 9 | Firstly you'll need to open your browsers developer tools. This is different for each type of browser (so if you're not familiar as to how, please run a [google search](https://www.google.co.uk/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=how+do+I+open+developers+tool+in+(safari+OR+chrome+OR+ie+OR+opera))). 10 | 11 | Once the developer tools are open, in the *console* you should see a message similar to the one below: 12 | 13 | ![devtools open](/images/debugging-prefs-devtools.png) 14 | 15 | Note that you need to enter an unlocking code to access your settings. In this case, I would simply type `ok3n8h1o` into the console and hit return. 16 | 17 | Now you're able to copy the entire `jsbin` object and share it (jsbin support) for debugging. 18 | 19 | In the console (again) run the command `JSON.stringify(jsbin)` and copy the response. Note that in chrome's console, you can run `copy(jsbin)` and this will copy for you. -------------------------------------------------------------------------------- /content/help/defaults-in-bins.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: How do I set default code in all new bins? 3 | category: learn 4 | --- 5 | 6 | 7 | By default, opening JS Bin, you'll be presented with a boilplate HTML document with no CSS and no JavaScript. But what if you want to *always* include code, like a default meta viewport? 8 | 9 | Easy. **Save as template**, and note that you don't need to be logged in for this to work. Create a bin that represents how you want all your new bins to start out containing, then from the "Bins" menu, select "Save as template": 10 | 11 | ![/images/save-as-template.png](/images/save-as-template.png) 12 | 13 | Perhaps you actually prefer a [super minimal boilerplate](http://jsbin.com/zunod/1/edit) and you could go further an predefine exactly which panels you want to see using the [account preferences](http://jsbin.com/account/preferences) (perhaps only the CSS & output panel for instance): 14 | 15 | ![/images/default-prefs.png](/images/default-prefs.png) 16 | -------------------------------------------------------------------------------- /content/help/delete-a-bin.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Delete a bin 3 | category: learn 4 | --- 5 | 6 | 7 | Deleting a bin is easy. Once a bin is deleted, all changes on that particular bin URL are ignored, and when you leave the browser window (or refresh) the bin is permanently lost. 8 | 9 | Delete can be accessed via the "Bins" menu, and select "Delete". Or via the keyboard using ctrl+shift+del. 10 | 11 | If you are the owner of the bin, you'll see this message and the bin is deleted. 12 | 13 | ![/images/deleted-bin.png](/images/deleted-bin.png) 14 | 15 | If you don't have access, then you'll see this message: 16 | 17 | ![/images/do-not-own-bin.png](/images/do-not-own-bin.png) 18 | 19 | ## When can you delete a bin? 20 | 21 | If you're registered and created the bin whilst you were logged in, you'll be able to delete any bin you own. 22 | 23 | If you created the bin anonymously, then you can only delete the bin whilst you can still write to the bin (as this is the only time that we know that you're the creator of the bin). -------------------------------------------------------------------------------- /content/help/design-principles.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Design principles 3 | category: fix 4 | --- 5 | 6 | 7 | These are emerging from the ongoing process of designing and building JS Bin. They’re a work in progress. 8 | 9 | - **Visitors to jsbin.com get a cursor** 10 | Nothing obscures the tool – start typing to begin a bin. 11 | - **Support learning** 12 | - **Streaming by default** 13 | - **Anonymous first** 14 | Avoid requiring login. 15 | - **Open first** 16 | Design and development happens in public, unless there’s a good reason to go private. 17 | - **Respect ex-users** 18 | Don’t break links to their stuff. Never make public something which a user has set as private. 19 | - **Return is as it was left** 20 | When people return to an application or document, they expect it to be as they left it. 21 | *FIXME* this principle is currently ambiguous when it comes to the document affecting the application state. Where *possible*, implement this principle. 22 | - **Assert failure to communicate, not the lack of a network** 23 | An app can’t truly know that there’s no network, and people care more about the risk of data loss than the status of their network. This principle came from a discussion in [offlinefirst](https://github.com/offlinefirst/research/issues/10#issuecomment-34654691). 24 | - **Get users close to the code** 25 | While using an editor users shouldn’t be distracted by the design of the editor, so it should be as boring and similar in it’s look and feel to the OS as possible. 26 | -------------------------------------------------------------------------------- /content/help/disabling-all-keyboard-shortcuts.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: How to disable JS Bin keyboard shortcuts 3 | category: fix 4 | --- 5 | 6 | 7 | If you're finding there's issues with all or most of JS Bin's keyboard shortcuts, 8 | perhaps you're using a keyboard that we're not able to bind the shortcuts correctly. 9 | 10 | You need to open your browser's developer tools, and from the console run the 11 | following command: 12 | 13 | ```js 14 | jsbin.settings.keys = { disabled: true }; 15 | ``` 16 | 17 | Now hit refresh and JS Bin will not bind [keyboard shortcuts](/help/keyboard-shortcuts). 18 | 19 | Note that as we use [CodeMirror](http://codemirror.net) for the editor, and [Emmet](http://emmet.io/) these shortcuts may still be in place. -------------------------------------------------------------------------------- /content/help/dropbox.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Dropbox integration 3 | category: pro 4 | video: "//www.youtube.com/embed/BZIMB6suEx8?rel=0" 5 | --- 6 | 7 | 8 | Linking to your Dropbox account [from your profile](/account/profile) will put every bin as a full HTML file in your Dropbox `Apps/jsbin` directory. This means you have a complete offline backup of your bins or any bin you edit. 9 | 10 | Note that only the latest revision is saved to your Dropbox (though we're considering adding support for revisions). 11 | 12 | You can see the simplicity of the Dropbox link in action below: 13 | 14 |
15 | 16 |
17 | 18 | Finally, *two way* syncing is being investigated and will be released to Pro users if possible. -------------------------------------------------------------------------------- /content/help/embed-doesnt-load.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: What to do if your embed doesn't load 3 | category: fix 4 | --- 5 | 6 | 7 | There's a particular situations when your embedded bin is hidden then becomes 8 | visible. It's still showing Dave's logo because there was no known height to 9 | render to. 10 | 11 | The embed code does try to handle common cases, such as using embeds inside 12 | popular slide libraries like Reveal.js. 13 | 14 | However, if you are presented with the Dave logo, then you can send a signal to 15 | JS Bin like this: 16 | 17 | ```js 18 | [].forEach.call(document.querySelectorAll('iframe'), function (iframe) { 19 | try { 20 | iframe.contentWindow.postMessage('jsbin:refresh', '*'); 21 | } 22 | }); 23 | ``` 24 | 25 | This will tell JS Bin to refresh it's contents, which will cause the panels to 26 | redraw and appear if you're seeing this issue. -------------------------------------------------------------------------------- /content/help/experimental-features.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Experimental Features 3 | category: pro 4 | --- 5 | 6 | 7 | *Updated: 2016-08-02* 8 | 9 | Experiments are beta features available to [pro users](/upgrade). We first release our experiments to our alpha users (core team and a small collection of industry experts), then the features that are stable enough are moved to beta where you can access them if you choose. 10 | 11 | Importantly, some features may never make it to production and equally may be buggy. 12 | 13 | This document will change over time as feature change. 14 | 15 | ## Experiential beta features 16 | 17 | To enable experiments head to your [profile](/account/profile) page and check the "Enable experiments" box. 18 | 19 | ### Better mobile support 20 | 21 | Work has been put into support a mobile design from as early as 2014, but the implementation was never developed, until now. 22 | 23 | The mobile design can be seen in this demo video, you just need to enable experiments and view JS Bin on a mobile device. The UI is a little different and it's still a work in progress, but do check it out: 24 | 25 |
26 | 27 | ### API 28 | 29 | JS Bin's read/write API is currently under the experiments. 30 | 31 | - `DELETE /api/$bin/$snapshot` 32 | - `GET /api/$bin/$snapshot` 33 | - `POST /api/save` new bin, accepts JSON object with `javascript`, `html`, `css` and `settings` (object) 34 | - `POST /api/$bin/save` create a new snapshot 35 | - `GET /api` lists all bins 36 | 37 | *Further documentation to come.* 38 | 39 | To make a request, first you need the [API token for your account](/account/profile) or to generate a new token: 40 | 41 | ![API key](/images/api-key.png) 42 | 43 | To make the request, the token must be included in the `Authorization: Token $token` header: 44 | 45 | ```shell 46 | curl -X "GET" "https://jsbin.com/api/" \ 47 | -H "authorization: token 51af795cf1a606fe2e19d8c77bff3cb866f98d16" \ 48 | -H "content-type: application/json" 49 | ``` 50 | 51 | JS Bin will will respond with `200 OK` for successful requests, and `401 Forbidden` for unauthorized. 52 | 53 | ### Fine grain control over bin headers 54 | 55 | The infocard (that appears on the editor at the bottom right) has been upgraded to include the ability to manage the title, description, status code and headers for the bin. Useful for mocking response handlers with different statuses (like a 404 or 500) or setting a custom content type or setting a CSP header. 56 | 57 | ![Bin info extended](/images/bin-info-expanded.png) 58 | 59 | ### More layouts 60 | 61 | JS Bin's panels can be pre-arranged in a number of different orientations. Available from the [preferences](/account/preferences) under "Layout" in the Panels section. There is also an [open issue]( https://github.com/jsbin/jsbin/issues/2007) that proposes to make this control easier to access. So please do get involved if you have ideas. 62 | -------------------------------------------------------------------------------- /content/help/export-gist.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Gists: how to export to a gist' 3 | category: teach 4 | --- 5 | 6 | 7 | It's easy to [import gists](/help/import-gists) and it's easy to export to a gist from JS Bin: 8 | 9 | ![/images/export-as-gist.png](/images/export-as-gist.png) 10 | 11 | The functionality is available regardless of whether you've linked your Github account or not. However, if you link your account to Github, then the exported gist will be linked to your Github account. If not, it will be create as an anonymous user on Github. 12 | 13 | After selecting "Bins" menu, select "Export as gist" and you'll be notified once the export is complete: 14 | 15 | ![/images/export-complete.png](/images/export-complete.png) -------------------------------------------------------------------------------- /content/help/faq.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: FAQ 3 | category: learn 4 | --- 5 | 6 | 7 | ## How long are bins kept for? 8 | 9 | They're kept indefinitely. In JS Bin's early life, back in 2008, we removed them after not being seen for 3 months, but that's long been removed. Bins are permanent. 10 | 11 | ## How can I clear the console? 12 | 13 | Very simple: `ctrl+l` from any panel, or using code: `console.clear()`. 14 | 15 | ## Can I run a Gist in JS Bin? 16 | 17 | Funny you ask! Absolutely you can - just save the gist in Github, and either using the gist to [JS Bin bookmarklet][1], or change the url from [][2] to [][3] 18 | 19 | ## Why does the JavaScript work when I didn't insert it? 20 | 21 | When you tab to the output panel, JS Bin automatically inserts your JavaScript on the fly, so you don't need to worry about it. 22 | 23 | ## How does the error checking work? 24 | 25 | Error checking is provided by the [JSHint project][4]. Like JSLint, but maintained and with a lovely API so it can plug it into JS Bin. 26 | 27 | ## Can I show just a single specific panel when loading a bin? 28 | 29 | Appending a panel name to the query string will ensure that JS Bin only opens those specific panels. This is useful if you don't want the output to open for instance. 30 | 31 | The valid values are: html, js, css, console, output. 32 | 33 | Used as: [http://jsbin.com/iwovaj/74/edit?js,output](http://jsbin.com/iwovaj/74/edit?js,output) 34 | 35 | ## How do I insert my JavaScript in a specific position in the HTML? 36 | 37 | Either insert the JavaScript directly in to the HTML panel, or you can use the special %code% command. Add it to your HTML and the contents of the JavaScript panel will be inserted at that point. 38 | 39 | ## How do I re-run or re-render the code? 40 | 41 | Just click the "Run with JS" button, and your entire code will re-run, or ctrl (or cmd) + enter. 42 | 43 | ## Can JS Bin respond to Ajax requests? 44 | 45 | Yes. See the [Ajax debugging video][5] for a demo. Or, it's as simple as removing the HTML output, saving the code, then requesting the URL via a new snippet. JS Bin will respond to Ajax requests appropriately. 46 | 47 | ## IE6? 48 | 49 | I'm afraid not, but the application is open source, so if you think you can get it working - please go ahead: [ctrl+shift+\ 57 | * [Keyboard shortcuts](/help/keyboard-shortcuts) - cmd+shift+? 58 | * Download 59 | * Clone 60 | * Shortcut URLs 61 | * /:user/last 62 | * /:bin/latest 63 | * Bin info card - details about the owner, and whether they're streaming 64 | * Plain text mode / accessibility mode 65 | * oEmbed 66 | * [SSL](/help/ssl-opt-in) 67 | 68 | ## Pro features 69 | 70 | * SSL embeds 71 | * Custom embed CSS and editor settings 72 | * [Sandbox mode](/help/sandbox-mode) - does not save the bin 73 | * [Private bins](/help/private-bins) 74 | * [Vanity URLs](/help/pro#vanityurls) - [blog post](/blog/twdtw-4-tern-pro-features#upcomingprofeaturevanityurls) 75 | * [Asset hosting](/help/asset-uploading) 76 | 77 | Coming features (currently in closed alpha or under pro) 78 | 79 | * Collaborative mode 80 | -------------------------------------------------------------------------------- /content/help/free-preview-expired.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Why do full previews expired? 3 | category: fix 4 | related: 5 | - why-register 6 | --- 7 | 8 | 9 | When you visit a shared bin URL you might see this message across the top: 10 | 11 | ![This bin was created anonymously and its free preview time has expired](/images/free-preview-expired.png) 12 | 13 | In particular the message: 14 | 15 | > This bin was created anonymously and its free preview time has expired 16 | 17 | If a bin is created by an anonymous user, the full output (that is: with the JS Bin editor stripped away) is only available for 90 minutes after creation. After which the URL will redirect to the editor view. 18 | 19 | If you're (freely) [registered](/help/why-register) anyone can always view your full output. This change took effect on all anonymously created bins as of July 3, 2014. 20 | 21 | ## Some background 22 | 23 | JS Bin has long been a target for spam and phishing and this is first change that would outwardly impact our users. After speaking to many of you, and taking your feedback, this security change was the right balance between addressing the issue of spam, but also maintaining flexibility for those of you who use JS Bin in a teaching environment. 24 | -------------------------------------------------------------------------------- /content/help/getting-started.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "* Getting started" 3 | category: learn 4 | --- 5 | 6 | 7 | JS Bin is a tool for experimenting with web languages. In particular HTML, CSS and JavaScript, but JS Bin also supports other languages too (like Markdown, Jade and Sass). 8 | 9 | JS Bin is ultimately a code sharing site. Along with the code, the complete output of the code is also shared with other developers, colleagues and/or students. As you type into one of the editor "panels", you and anyone watching your bin will see the output being generated in real-time in the output panel. 10 | 11 | There's many features tucked away inside JS Bin, but our design principle is that **everyone gets a cursor**. So when you arrive for the first time, you'll be greeted with an initial start HTML page and very little else (though you [can customise your default code](/help/defaults-in-bins)). 12 | 13 | ![/images/jsbin-start.png](/images/jsbin-start.png) 14 | 15 | *As soon as you start typing* your code is saved, and you'll be given a URL. We even try our best to make them [pronounceable](/help/pronounceable-urls)! You've created your first *bin*. A bin is the name we refer to the thing you've saved on JS Bin. 16 | 17 | ## Sharing 18 | 19 | Now you can share this URL with anyone else, either for them to see your work, or help you improve on it. There's a few ways to view that bin too if you click "Share" and select the configuration and URL you want to share: 20 | 21 | ![/images/share-menu1.png](/images/share-menu1.png) 22 | 23 | If you share a URL to your bin, others can view the code and the output. Others can also clone your work to make their own changes and experiments (but of course your work remains entirely intact). 24 | 25 | ## Registering 26 | 27 | If you [register](http://jsbin.com/register) (which is free and simple), your profile will remember which bins you created, but also give you a shortcut URL that always takes you to the last bin you worked on. 28 | 29 | For instance, if your username was "Dave", your last bin URL is: http://jsbin.com/dave/last and to edit it's http://jsbin.com/dave/last/edit. 30 | 31 | ## Finding out more 32 | 33 | - [The JS Bin blog](/blog) - where we'll post what we've released that week and useful information about JS Bin 34 | - [Twitter](https://twitter.com/js_bin) - posting alerts or replying to your quick questions 35 | - [Videos](http://jsbin.com/videos) - a growing collection of video tutorials 36 | - [Issues, bugs and ideas](https://github.com/jsbin/jsbin/issues) - if you have a problem or suggestion, we always want to hear 37 | -------------------------------------------------------------------------------- /content/help/github-username.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: My Github username isn't available 3 | category: fix 4 | --- 5 | 6 | 7 | If you try to register with Github and your Github username is already taken in JS Bin, then you'll need to follow these steps to use Github sign in. 8 | 9 | ## 1. Check that you've not already registered 10 | 11 | It's entirely possible you registered with JS Bin some time ago (we started taking sign ups back in 2011). So try a [password reminder](http://jsbin.com/login) with your username entered. Simply enter your username and select "I've forgotten my password". 12 | 13 | If the password reset request is successful, you'll receive an email with a link that will sign in you to allow you to reset your password. 14 | 15 | Next skip to step 3. 16 | 17 | ## 2. Register with JS Bin using email 18 | 19 | Since your preferred username is taken, you'll need to [register](https://jsbin.com/register) with JS Bin and select a username. 20 | 21 | Now you have an account, you can link it to your Github account so you can use Github sign in forever-more. 22 | 23 | ## 3. Link your Github account 24 | 25 | From the account link in the menu bar, select [Update profile](https://jsbin.com/account/profile): 26 | 27 | ![/images/twdtw/8/settings.png](/images/twdtw/8/settings.png) 28 | 29 | Then from your account, follow the **[Use Github for logging in](https://jsbin.com/auth/github)** link. Once your account is linked, you will be able to use Github for sign in. -------------------------------------------------------------------------------- /content/help/how-can-i-embed-jsbin.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: How can I embed JS Bin? 3 | category: teach 4 | --- 5 | 6 | 7 | JS Bin can be embedded in your site with very little work. The easiest way is to simply change the ending url `/edit` to `/embed` and wrap the url in an iframe. 8 | 9 | If you want JS Bin to inject the iframe for you, and progressively enhance a link to the bin, you can use the share menu and copy and paste from there: 10 | 11 | ![The embed panel in JS Bin](/images/embed-small.gif) 12 | 13 | ## Specifying panels 14 | 15 | By default, JS Bin will embed the live output panel. Panels are specified in the query string as such: 16 | 17 | > http://jsbin.com/iwovaj/73/embed?js,html,output 18 | 19 | Remember you can also point an embed to your latest bin (in the above example, you would use `latest` instead of `73`). 20 | 21 | Each panel can be specified by changing the checkboxes in the *Panels* heading under share: 22 | 23 | ![Share panel options](/images/panel-options.png) 24 | 25 | ## Setting the height and width 26 | 27 | JS Bin is designed to fill the space it contains, so naturally the iframe's width will fill to the width of it's container. The default *minimum* height is 300px, but will automatically resize to fill the height of the output of your bin (i.e. if your bin shows off something that's 500px tall, the iframe will be loaded at that height). 28 | 29 | To change these dimensions, you can pass in any height or width value on the query string: 30 | 31 | 1. Height at 3 rems: http://jsbin.com/iwovaj/73/embed?html,output&height=3rem 32 | 2. Height at 150px: http://jsbin.com/iwovaj/73/embed?html,output&height=150px 33 | 3. Width & height at 500px: http://jsbin.com/iwovaj/73/embed?html,output&height=500px&width=500px 34 | 35 | 36 | ## Live example 37 | 38 | Here it is in action, the source: 39 | 40 | ```html 41 | 42 | Simple Animation Tests 43 | 44 | ``` 45 | 46 | ...and the result: 47 | 48 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /content/help/import-gists.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Gists: how to import a gist' 3 | category: teach 4 | --- 5 | 6 | 7 | Importing a [Gist](http://gist.github.com) is incredible easy. Simply change the `github` part of the URL to `jsbin` and JS Bin will import the gist into JS Bin for editing and rendering. 8 | 9 | For example, changing [https://gist.github.com/remy/271333](https://gist.github.com/remy/271333) to [https://gist.jsbin.com/remy/271333](https://gist.jsbin.com/remy/271333) will import the JavaScript gist file in to the JavaScript panel and save the bin automatically for you. 10 | 11 | If you're a bookmarklet user, here's one that you can use to simply click when you're on a gist to import to JS Bin: **Import Gist**. 12 | 13 | You can also [export gists](/help/export-gist). -------------------------------------------------------------------------------- /content/help/keyboard-shortcuts.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Keyboard shortcuts 3 | category: learn 4 | --- 5 | 6 | 7 | JS Bin supports keyboard shortcuts when the editor panels are focused (i.e. you have a cursor). Shortcuts can also be [disabled](/help/disabling-all-keyboard-shortcuts) if desired. 8 | 9 | ## Application level 10 | 11 | |Shortcut|Action| 12 | |---|---| 13 | |ctrl+?|Show keyboard shortcuts| 14 | |ctrl+shift+/|Search help| 15 | |ctrl+l|Clear the console| 16 | |ctrl+return|Run code and send live reload| 17 | |ctrl+shift+del|Delete the current bin| 18 | |ctrl+s|Save current state as a revision| 19 | |ctrl+shift+s|Create a clone of the current bin| 20 | |ctrl+shift+\|Hide JS Bin navigation bar| 21 | |ctrl+o|Open bin history (when logged in)| 22 | |ctrl+y|Toggle archive state on the current bin| 23 | 24 | Note that all changes in any code panel (excluding the console) both triggers a save to the current bin *and* triggers a live reload on any viewers watching your bin url. 25 | 26 | ## Code based 27 | 28 | |Shortcut|Action| 29 | |---|---| 30 | |ctrl+/|Toggle comments on the selected lines| 31 | |ctrl+[|Indent selected lines| 32 | |ctrl+]|Unindent selected lines| 33 | |ctrl+shift+L|Beautify code| 34 | 35 | ## HTML & CSS panel 36 | 37 | |Shortcut|Action| 38 | |---|---| 39 | |tab|Code expansion using Emmet| 40 | |ctrl+alt+right|Next edit point| 41 | |ctrl+shift+y|Evaluate mathematical expression| 42 | |alt+up|Increment number by 0.1| 43 | |alt+down|Decrement number by 0.1| 44 | |ctrl+up|Increment number by 1| 45 | |ctrl+down|Decrement number by 1| 46 | |alt+ctrl+up|Increment number by 10| 47 | |alt+ctrl+down|Decrement number by 10| 48 | 49 | ## HTML panel 50 | 51 | |Shortcut|Action| 52 | |---|---| 53 | |ctrl+.|Close previous HTML tag| 54 | 55 | ## JavaScript panel 56 | 57 | |Shortcut|Action| 58 | |---|---| 59 | |tab|Code complete (using Tern or otherwise)| 60 | 61 | ## Console panel 62 | 63 | |Shortcut|Action| 64 | |---|---| 65 | |up/down|Up/down through console history| 66 | |return|Execute command| 67 | 68 | 69 | ## Showing and hiding panels 70 | 71 | |Shortcut|Action| 72 | |---|---| 73 | |ctrl+0|Hide currently focused panel| 74 | |ctrl+1|Toggle HTML panel| 75 | |ctrl+2|Toggle CSS panel| 76 | |ctrl+3|Toggle JavaScript panel| 77 | |ctrl+4|Toggle console panel| 78 | |ctrl+5|Toggle output panel| 79 | 80 | The shortcuts for toggling specific panels overwrites the default browser's tab selection shortcut, but this can be changed to include alt as a modifier key by opening the keyboard shortcuts (ctrl+?) and checking the box: 81 | 82 | ![disable cmd+n](/images/disable-cmd-n.png) 83 | 84 | ## With Sublime keybindings 85 | 86 | |Shortcut|Action| 87 | |---|---| 88 | |ctrl+shift+up|Move current line, up one line| 89 | |ctrl+shift+down|Move current line, down one line| 90 | |ctrl+d|Highlight and place multiple cursor on matching words| 91 | |esc|Return to single cursor| 92 | |cmd+ click|Place multiple cursor at click point| 93 | -------------------------------------------------------------------------------- /content/help/linking-bins.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: How to link multiple bins 3 | category: learn 4 | --- 5 | 6 | 7 | Sometimes you need to create a bin that pulls in some JSON data, makes ajax requests or perhaps includes multiple CSS resources. 8 | 9 | You can do all this using JS Bin and maintaining multiple bins. Having a good knowledge of how [JS Bin URLs](/help/urls) work will benefit you too. 10 | 11 | Simply create a bin that contains the data, and from your "main" bin, reference your data-based bin URL, either as a `script` include, or `link` resource or via an ajax request. 12 | 13 | ## External data & ajax 14 | 15 | Say you want to include a large JSON file in an ajax request, simple create a separate bin with the JSON response content, and then make the ajax request to that bin URL. 16 | 17 | Since making requests for bins without the revision always calls the latest, you can be sure the content is always up to date as you work on the two separate bins. 18 | 19 | For example, the following bin is making a jQuery ajax request to the `//jsbin.com/megax.json` URL, which contains simple JSON in the JavaScript panel: 20 | 21 | 22 | 23 | Note that the JS Bin URL **must** include the jsbin.com domain (but can be relative off the protocol), and in this example, I'm using a specific extension on the URL which tells JS Bin to serve this particular bin as `application/json` (other formats include `.js`, `.css`, etc) 24 | 25 | ***Pro tip:*** if you're logged in when you create the bin, then the latest revision will only ever belong to you. If you're logged out, you may need to reference a specific revision -------------------------------------------------------------------------------- /content/help/object-doesnt-work.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Why doesn't work? 3 | category: fix 4 | --- 5 | 6 | 7 | You might have tried to use an `` tag in JS Bin, i.e. for SVG, and noticed that *nothing* appears. 8 | 9 | This appears to be a quirk in modern browsers (or certainly Chrome) where the `` can't be rendered inside and iframe (which we use for our real-time output). 10 | 11 | The solution is to pop-out the output window (or open a new windown pointing to the same URL without `/edit` on the end), and now the `` will render, and the window will live-reload as you code in the main edit view. -------------------------------------------------------------------------------- /content/help/populating-bins.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: How to pre-populate bins and inject content 3 | category: teach 4 | --- 5 | 6 | 7 | Pre-populating bins has been around for a [very long time](https://github.com/remy/jsbin/blob/v1.0.0/index.php#L77) (in fact since JS Bin v1 back in 2008), but never documented. 8 | 9 | It's very simple: you post panel content to JS Bin and it pre-populates the content for you. 10 | 11 | This article will walk through how 12 | 13 | ***Unfinished and needs work!*** 14 | -------------------------------------------------------------------------------- /content/help/private-bins.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Private bins 3 | category: pro 4 | --- 5 | 6 | 7 | ![Making a bin private](/images/private-menu.png) 8 | 9 | Self explanatory, but it means if any other user than you tries to access your private bin, they will get a 404. 10 | 11 | Once your bin is private, you'll also see the card in the bottom right indicating it's privacy mode. 12 | 13 | ![Example of a private bin](/images/private-bins.gif) -------------------------------------------------------------------------------- /content/help/pro.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "* What to expect from a Pro subscription" 3 | category: pro 4 | --- 5 | 6 | 7 | If you've upgraded to pro, or if you're curious, then thank you and here's the skinny. 8 | 9 | ## What does a Pro account get you? 10 | 11 | The Pro user status does two important things: 12 | 13 | 1. Access to pro features (duh, obviously) 14 | 2. Helps sustain JS Bin as a project so it can continue to be free and open source for education 15 | 16 | This second point is *really* important to us. JS Bin has existed for over 5 years with no income, running on hefty servers and thousands of development hours poured into it simply because knowing it was being used to teach others was motivation enough. 17 | 18 | Eventually we decided that to spend full time on JS Bin, and to invest fully in it's infrastructure, JS Bin needed to sustain itself, hence Pro status. 19 | 20 | If you want to support the project, you can [donate via OpenCollective](https://opencollective.com/jsbin/contribute) 21 | 22 |
Upgrade to Pro
23 | 24 | ## Pro features 25 | 26 | At time of writing, our pro feature set is: 27 | 28 | - [What does a Pro account get you?](#what-does-a-pro-account-get-you) 29 | - [Pro features](#pro-features) 30 | - [Private bins](#private-bins) 31 | - [Asset uploads](#asset-uploads) 32 | - [Vanity URLs](#vanity-urls) 33 | - [SSL embeds](#ssl-embeds) 34 | - [Dropbox](#dropbox) 35 | - [Priority support](#priority-support) 36 | - ["Sandbox" mode](#sandbox-mode) 37 | - [Coming next](#coming-next) 38 | 39 | And you can [upgrade today](/account/upgrade/pay)! 40 | 41 | ## Private bins 42 | 43 | ![Making a bin private](/images/private-menu.png) 44 | 45 | Self explanatory, but it means if any other user than you tries to access your private bin, they will get a 404. 46 | 47 | Once your bin is private, you'll also see the card in the bottom right indicating it's privacy mode. 48 | 49 | ![Example of a private bin](/images/private-bins.gif) 50 | 51 | ## Asset uploads 52 | 53 | Just simply drag and drop images you need to use *into* the HTML, and JS Bin will upload and generate the `img` tag for you with the URL prefilled in. 54 | 55 | Previously uploaded assets can be managed through the [assets](/account/assets) account page. 56 | 57 | ## Vanity URLs 58 | 59 | Vanity URLs has two purposes. The first is that puts *your* username when you share your bin's output, and secondly allows you to publish to your vanity homepage. 60 | 61 | This means you can publish any bin to your vanity url on `.jsbin.com` for example: [http://dave.jsbin.com](http://dave.jsbin.com) 62 | 63 | In addition, when you share the full output of your bins, your username is included in the URL, such as [http://dave.jsbin.com/fajac/3/](http://dave.jsbin.com/fajac/3/) 64 | 65 | ## SSL embeds 66 | 67 | ![SSL URLs in JS Bin](/images/twdtw/11/ssl.png) 68 | 69 | [SSL](/help/ssl) can be turned on for all of JS Bin through the [preferences](/account/preferences) and once enabled, all your bins will be served under SSL, in addition, your [embeds](/help/how-can-i-embed-jsbin) can also be served over SSL. 70 | 71 | ## Dropbox 72 | 73 | Linking to your Dropbox account [from your profile](/account/profile) will put every bin as a full HTML file in your Dropbox `Apps/jsbin` directory. This means you have a complete offline backup of your bins or any bin you edit. 74 | 75 | Note that only the latest revision is saved to your Dropbox (though we're considering adding support for revisions). 76 | 77 | Finally, *two way* syncing is being investigated and will be released to Pro users if possible. 78 | 79 | ## Priority support 80 | 81 | We manage all our support [through github](https://github.com/jsbin/jsbin/issues) but as a Pro user, you will be able to email directly (or chat via [Gitter](https://gitter.im/jsbin/jsbin)). Be sure to notify us of your username and we'll be sure to help. 82 | 83 | ## "Sandbox" mode 84 | 85 | JS Bin is different from other pastebins in that it saves by default *automatically*. This means you'll never lose your work. However, sometimes you want to throw open JS Bin and test some code without JS Bin ever knowing you were there. This is "sandbox" mode. 86 | 87 | The URL is simply "slash-dash": [http://jsbin.com/-](http://jsbin.com/-) 88 | 89 | JS Bin runs as it normally does, but doesn't save. If you want to save, just use the [keyboard shortcut](/help/keyboard-shortcuts) ctrl+s 90 | 91 | ## Coming next 92 | 93 | As development continues, the following Pro features are next in our roadmap: 94 | 95 | * Read and write API access 96 | * Sass/SCSS external @imports 97 | 98 |

Upgrade to Pro today

99 | -------------------------------------------------------------------------------- /content/help/pronounceable-urls.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Pronounceable URLs 3 | category: learn 4 | --- 5 | 6 | 7 | Did you ever notice that that JS Bin's URLs have been designed to be pronounceable? 8 | 9 | ![/images/url-example.png](/images/url-example.png) 10 | 11 | When JS Bin launched in 2009, URLs for bins were only 4 characters (but that 12 | quickly got all used up). Originally URLs consisted of vowel, consonant, vowel, 13 | consonant (*VC*). This would make URLs pronounceable, like 'atay' or 'usap'. 14 | 15 | In early 2014 we changed the format so it reads consonant, vowel (*CV*), etc to allow 16 | us to regain 4 character URLs and increase the URL space. *VC* would allow for 17 | 66,000 5 character URLs, *CV* allows for **250,000 5 character URLs**. 18 | 19 | Here's a 5 letter example: 20 | 21 | 38 | 39 | Feel free to say it out loud, and refresh the page to try a new one! -------------------------------------------------------------------------------- /content/help/running-a-local-copy-of-jsbin.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Local JS Bin: the detailed how-to' 3 | category: hack 4 | --- 5 | 6 | 7 | JS Bin is a [Node](http://nodejs.org) project. 8 | 9 | Installation requires just two steps: 10 | 11 | 1. Installing code 12 | 2. Configuration 13 | 14 | For the simplest install process we recommend using Node with SQLite. 15 | 16 | Historically, JS Bin v1, v2 and the first release of v3 had support for PHP. **PHP is no longer supported**. If you want to install JS Bin using PHP, I'm afraid you're on your own. There are some old docs that can help, but the project has long surpassed PHP's functionality. If you want to risk the PHP version, grab [v3.0.0 here](https://github.com/jsbin/jsbin/releases), warts an all. 17 | 18 | ## Installing 19 | 20 | ### Node 21 | 22 | Install [Node](http://nodejs.org/) version `0.10.x`, which will give you the `node` and `npm` programs. (_Installing JS Bin on newer versions of Node is not supported and may fail_; consider using [nvm](https://github.com/creationix/nvm) to install multiple versions of Node on your machine.) 23 | 24 | You can (and should) install JS Bin directly from `npm` using the following command: 25 | 26 | ```bash 27 | npm install -g jsbin 28 | ``` 29 | 30 | This will automatically install all the dependancies. 31 | 32 | If you're installing JS Bin for development (and hopefully contribution), clone the project from github: 33 | 34 | ```bash 35 | git clone https://github.com/jsbin/jsbin.git 36 | cd jsbin 37 | npm install 38 | ``` 39 | 40 | If you plan to build and test for production, see the section at the end. 41 | 42 | ## Configuration 43 | 44 | JS Bin comes with a default config file. Should you want to customise how JS Bin runs, you should create a `config.local.json` (which could be based on [`config.default.json`](https://github.com/jsbin/jsbin/blob/master/config.default.json)) and then when you run the `jsbin` command you must tell the application *where* your local config is using the following command: 45 | 46 | 47 | ```bash 48 | $ JSBIN_CONFIG=/PATH/TO/config.local.json jsbin 49 | ``` 50 | 51 | There are a number of options that you can change to configure JS Bin to your needs. The property names, meaning and possible values have been listed below: 52 | 53 | * env: `development` or `production` 54 | 55 | This is whether you want to run in development mode (recommended) or production. Production mode requires that you build a single JavaScript file for JS Bin to run from. This is only required if you plan to run JS Bin as a service to a larger public audience. Building for production is detailed in a section later on. 56 | 57 | * url: Object - detailed next 58 | 59 | This is an object controlling how URLs are generated in JS Bin. If you plan to run JS Bin from a subdirectory, you must change these settings. 60 | 61 | * url.host: The host you will access JS Bin on, eg. `jsbin.dev` is what we use offline. If you want to include a port number here you should do, eg. `jsbin.dev:8000` will request JS Bin over port 8000. 62 | * url.prefix: `/` or your subdirectory that JS Bin should be accessed from. For instance, if you run JS Bin under `http://remysharp.com/jsbin` the `url.prefix` value must be `/jsbin/`. 63 | * url.ssl: `false` or `true` whether you want to run JS Bin over SSL. 64 | * url.static: `false` or a url, such as `http://static.jsbin.dev:8000/jsbin/`. This will control where static assets are served from. If the value is `false`, they will be served from the same path as dynamic content. 65 | 66 | ### Running behind a proxy 67 | 68 | JS Bin will run behind a proxy, indeed our production version of JS Bin is behind a proxy. 69 | 70 | The `PORT` on the command line takes precedence over the config variable. This means in your config, you set the url to be the user facing port (typically port 80, so no port required), and then JS Bin will listen on the port you gave at the envinoment level. 71 | 72 | So to proxy jsbin.com to a localhost:8000 (using something like nginx to do the proxying), the config would look like (this snippet of `config.local.json`): 73 | 74 | ```json 75 | "url": { 76 | "host": "jsbin.com", 77 | "prefix": "/", 78 | "ssl": false 79 | }, 80 | ``` 81 | 82 | Note that in the above config, `jsbin.com` is what is used in the HTML and JavaScript, so this is the *client facing url*. Next, running JS Bin behind a proxy is as simple as: 83 | 84 | $ PORT=8000 JSBIN_CONFIG=~/config.local.json jsbin 85 | 86 | Now the `jsbin` node process is listening on port 8000, but the client facing urls are all port 80. 87 | 88 | ### Building for production 89 | 90 | JS Bin's build process uses Grunt, so assuming you've cloned a copy, you will need the dev dependancies and the grunt cli: 91 | 92 | ```bash 93 | npm install -g grunt-cli 94 | npm install --dev 95 | grunt build 96 | ``` 97 | 98 | This will generate the `public/js/prod/` directory and read the version in the `package.json` file to generate to build a number of files: 99 | 100 | 1. jsbin-$version.js - the uncompressed, concatted version of all the scripts from `/scripts.json` 101 | 2. jsbin-$version.min.js - the production compressed version of jsbin, used in the editor 102 | 3. jsbin.map.json - the sourcemaps file (useful for debugging in live) 103 | 4. runner-$version.js - the runner script, used to generate the output of the user's code in an iframe 104 | 5. runner-$version.min.js - the production version of the runner 105 | 106 | Finally, ensure either the config.local.json's `env` property is set to "production" or you can run JS Bin in production via the envinoment: 107 | 108 | $ NODE_ENV=production node . 109 | 110 | And that's it. 111 | -------------------------------------------------------------------------------- /content/help/sandbox-mode.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Sandbox mode 3 | category: pro 4 | --- 5 | 6 | 7 | JS Bin is different from other pastebins in that it saves by default *automatically*. This means you'll never lose your work. However, sometimes you want to throw open JS Bin and test some code without JS Bin ever knowing you were there. This is "sandbox" mode. 8 | 9 | The URL is simply "slash-dash": [http://jsbin.com/-](http://jsbin.com/-) 10 | 11 | JS Bin runs as it normally does, but doesn't save. If you want to save, just use the [keyboard shortcut](/help/keyboard-shortcuts) ctrl+s 12 | -------------------------------------------------------------------------------- /content/help/sass-import.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "@import with Sass" 3 | category: learn 4 | --- 5 | 6 | 7 | In JS Bin you can import other bins with Sass really easily. 8 | 9 | First write the bin you want to import, like in [this example](http://jsbin.com/piboc/2/edit). 10 | ```css 11 | $a: red; 12 | $b: orange; 13 | $c: yellow; 14 | $d: green; 15 | 16 | body { 17 | color: $a; 18 | } 19 | ``` 20 | Then create another bin where you call the `@import` function. 21 | 22 | To use a specific version of the bin: 23 | ```css 24 | @import 'piboc/2.scss'; 25 | 26 | body { 27 | color: $b; 28 | } 29 | ``` 30 | To use the latest version of the bin: 31 | ```css 32 | @import 'piboc.scss'; 33 | 34 | body { 35 | color: $b; 36 | } 37 | ``` 38 | 39 | You can see the result in the final [live example](http://jsbin.com/jojiji/2/edit). 40 | 41 | If you use SCSS syntax the extension of the file will be `.scss`, while with the Sass syntax the extension will be `.sass`. 42 | 43 | ## Bourbon 44 | 45 | To use [Bourbon](http://bourbon.io/), simply use `@import 'bourbon/bourbon'` 46 | 47 | ```css 48 | @import 'bourbon/bourbon'; 49 | 50 | html, body { 51 | height: 100%; 52 | } 53 | body { 54 | @include linear-gradient(red, orange, yellow, lime, green, cyan, blue, magenta); 55 | font-family: $helvetica; 56 | } 57 | ``` 58 | [Live example](http://jsbin.com/weluha/1/edit) -------------------------------------------------------------------------------- /content/help/session-secret.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Session Secrets 3 | category: fix 4 | --- 5 | 6 | 7 | If you see this warning message when running a local `jsbin` command, you'll want to set up a session secret. 8 | 9 | ```text 10 | Warning: Generating a session key 11 | ``` 12 | 13 | It means that you have not configured a session secret in your config.local.json or ENV. If you want your sessions to persist between reboots you'll need to use the same one. JS Bin will generate a random 34 char key for you, you can choose to use this or one of your own. 14 | 15 | You can either set an enviroment variable when you start `jsbin` (and this could be [added to your local profile](https://www.google.co.uk/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=adding+environment+variables+on+mac+OR+windows+OR+linux): 16 | 17 | ```shell 18 | JSBIN_SESSION_SECRET=my_secret jsbin 19 | ``` 20 | 21 | Or you can add this directly to a your config.local.json like so: 22 | 23 | ```json 24 | { 25 | "session": { 26 | "secret": "bfksfysa7e32kdhayu292sz" 27 | } 28 | } 29 | ``` 30 | -------------------------------------------------------------------------------- /content/help/share-latest-bin.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: How do I share the latest bin? 3 | category: learn 4 | related: 5 | - vanity-urls 6 | --- 7 | 8 | 9 | Simple. There's a few ways depending on what you want to achieve. 10 | 11 | ## Method 1: remove the revision from the URL 12 | 13 | So instead of sharing http://jsbin.com/fajac/3, you share http://jsbin.com/fajac. You can also add on `/edit` if you want to always share the latest edit view. 14 | 15 | ## Method 2: use "latest" instead of the revision 16 | 17 | Just swapping the revision for the word `latest` in the URL will redirect to the latest revision (so your visitor will be able to see the revision number after the redirect): http://jsbin.com/fajac/latest 18 | 19 | Again, you can add the `/edit` modifier to the URL if you want the edit view. 20 | 21 | ## Bonus: point to *your* last bin 22 | 23 | A bonus of having a free account, [amongst others](/help/why-register), is that you can also share *your* latest bin by putting your username in the URL: http://jsbin.com/dave/last 24 | -------------------------------------------------------------------------------- /content/help/ssl-opt-in.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SSL opt-in support 3 | category: learn 4 | --- 5 | 6 | 7 | SSL, that is, using `https` for *all* of JS Bin, can be enabled via [their preferences](http://jsbin.com/account/preferences). Note that extra care in including resources is needed, and to ensure they work, it's recommended you use [protocol relative](http://www.paulirish.com/2010/the-protocol-relative-url/) URLs. 8 | 9 | Once this is enabled, visiting jsbin.com will redirect to `https`. However, not all JS Bin URLs will automatically redirect. The following rules apply: 10 | 11 | 1. Sharing your own bins will be on `https` by default and visitors will also view those bins on `https` 12 | - Visiting the JS Bin editor will *always* redirect to `https` 13 | - You *can* share non-`https` URLs, but you need to change these manually 14 | - Viewing another user's bins can be on `http` and will not redirect to `https` 15 | - You *can* view another user's bin under `https` 16 | - Embedded bins will maintain their protocol of their author (a [Pro](https://jsbin.com/upgrade) account is required to embed over SSL) -------------------------------------------------------------------------------- /content/help/ssl.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: The state of SSL on JS Bin 3 | category: fix 4 | --- 5 | 6 | 7 | Currently only the login, register and (upcoming) account settings are served over SSL. The rest of JS Bin is not. 8 | 9 | This is ultimately because JS Bin uses `iframe`s to render your code's preview, and any `iframe` served over HTTPS cannot serve resources from HTTP. 10 | 11 | This means if you include a library or an image that's being served over HTTP, the live preview will *block* that resource. It might be JavaScript that the rest of your code relies on, in which case your code will break. 12 | 13 | ## Background 14 | 15 | We did actually do a ton of work to get JS Bin [working entirely over SSL](https://github.com/jsbin/jsbin/pull/673) back in mid 2013, and it even got released...for a few minutes. 16 | 17 | It was quickly reversed out because we spotted (and remembered) that the `iframe` was blocking the content. Some CDNs would support HTTPS for their scripts, but there's many, many bins out in the wild, and they would instantly break due to the non-HTTPS resources being blocked - which is unacceptable and against our [design principles](/help/design-principles). 18 | 19 | So SSL for *all of JS Bin* was removed and later replaced with SSL for specific pages. 20 | 21 | ## Enabling SSL for all of JS Bin 22 | 23 | Those users with pro accounts can enable SSL across all of JS Bin via [their preferences](http://jsbin.com/account/preferences). Note that extra care in including resources is needed, and to ensure they work, it's recommended you use [protocol relative](http://www.paulirish.com/2010/the-protocol-relative-url/) URLs. 24 | 25 | Once this is enabled, visiting jsbin.com will redirect to https. However, not all JS Bin URLs will redirect. The following rules apply: 26 | 27 | 1. Sharing your own bins will be on https by default and visitors will also view those bins on https 28 | - Visiting the JS Bin editor will *always* redirect to https 29 | - You *can* share non-https URLs, but you need to change these manually 30 | - Viewing another user's bins can be on http and will not redirect to https 31 | - You *can* view another user's bin under https 32 | - Other user's can't view their bins under https (if they haven't enabled the pro option) 33 | - Embedded bins will maintain their protocol of their author 34 | 35 | ## SSL support in the open source project 36 | 37 | Even though the [open source repository](https://github.com/jsbin/jsbin) has some hints of SSL support inside it, we don't actively support using SSL in local installations. This is mainly due to the bespoke set up with domains and SSL certificates we use in production, so we prefer a simpler local install. 38 | 39 | SSL is provided through our proxy server using [nginx](http://wiki.nginx.org/Main) and there is some interest to explore [further SSL support](https://github.com/jsbin/jsbin/issues/1168) so please do get in touch if you have any success in this area. 40 | -------------------------------------------------------------------------------- /content/help/stickers.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Stickers 3 | category: hack 4 | --- 5 | 6 | 7 | **Want stickers? We've got them!** 8 | 9 | We're doing regular postal runs of stickers to you now. You'll need to fill out this Google form with your name and address, and we'll send you a few sticker on our next mail out. If you're a meetup or a company or club, feel free to ask for a batch of stickers. 10 | 11 | There's no cost to you, but we will be restricting the send outs to bi-monthly or quaterly depending on demand. If you want to show your support, and you don't have a pro account, perhaps it's time to [upgrade](/upgrade) or you can **donate [regularly](https://opencollective.com/jsbin/contribute) or as a [one off](https://www.paypal.me/rem) ❤** 12 | 13 | ➡ **[Sticker request form](https://docs.google.com/forms/d/1tttJAkH0OEABv7lRr1yhmCZoj5GQ7nemWFjOgOqwxlQ/viewform)** 14 | 15 | There are two sizes, we'll send a few of both: 16 | 17 | ![JS Bin stickers](/images/stickers.jpg) 18 | 19 | And yes, Remy does have a sticker on the back of his laptop with Dave's glowing eyes (two jsbin stickers with eyes cut out backed with blackout tape over the Apple logo). 20 | -------------------------------------------------------------------------------- /content/help/test-code-on-other-devices.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Test out code on other devices 3 | video: "//www.youtube.com/embed/eDFGrqjjyLk" 4 | category: learn 5 | --- 6 | 7 | 8 | JS Bin not only includes live rendering in the main window, but also allows you to try out your code on any other device or in any browser, with live updates as you type. 9 | 10 | 1. **Create a new bin.** Head to [JS Bin](//jsbin.com) and start typing, or click *Bins → New*. 11 | ![http://i.phuu.net/Q5Ke/Screen%20Shot%202013-07-05%20at%2010.30.59.png](http://i.phuu.net/Q5Ke/Screen%20Shot%202013-07-05%20at%2010.30.59.png) 12 | 13 | 2. **Add some code.** Once you've started work on your bin, the URL of the page will change. This means the bin is saved and you can share the bin with others, or load it into other devices. 14 | ![http://i.phuu.net/Q49K/Screen%20Shot%202013-07-05%20at%2010.31.55.png](http://i.phuu.net/Q49K/Screen%20Shot%202013-07-05%20at%2010.31.55.png) 15 | 16 | 3. **Open the bin on other devices.** In the *Share* menu you'll find a URL for the **Live & Full Preview** – opening this on another device lets you see how your work looks. Even better, the device will keep itself up-to-date with your changes! 17 | ![http://i.phuu.net/Q5TG/Screen%20Shot%202013-07-05%20at%2010.32.36.png](http://i.phuu.net/Q5TG/Screen%20Shot%202013-07-05%20at%2010.32.36.png) 18 | 19 | ### Video 20 | 21 | Testing code in the live preview is covered in this video… 22 | 23 |
24 | 25 |
-------------------------------------------------------------------------------- /content/help/toggle-line-numbers.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: How to show & hide line numbers 3 | category: learn 4 | --- 5 | 6 | 7 | There's three ways to toggle line numbers: 8 | 9 | 1. [Via your editor preferences](#editorpreferences) 10 | 2. [The "alternative" method](#alternativemethod) 11 | 12 | ## Editor preferences 13 | 14 | If you're [registered](/help/why-register) (which is free), then you have full control over the [editor preferences](https://jsbin.com/account/editor), including line numbers. The advantage of this approach is that it'll save against your account so it carries across browsers and machines. 15 | 16 | ![Customise your editor settings](/images/line-numbers-pref.png) 17 | 18 | ## "Alternative" method 19 | 20 | Simply double click on the panel language selector. 21 | 22 | ![double clicking language toggles line numbers](/images/line-numbers.gif) 23 | 24 | Note that this preference will only save in the browser you're using at the time, and doesn't carry across to other browsers or machines. 25 | -------------------------------------------------------------------------------- /content/help/transfer-a-bin.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Transferring ownership of a bin 3 | category: learn 4 | --- 5 | 6 | 7 | If you own a bin and you want to transfer ownership, from the "bin info" card in the bottom right of JS Bin, expand it and click the "transfer" link: 8 | 9 | ![Transfer bin](/images/transfer.png) 10 | 11 | You'll be prompted for the username that you want to transfer to, and if successful, the bin will reload with a notification confirming that the bin now has a new owner. 12 | 13 | ## Limitations 14 | 15 | This process is currently limited to a single snapshot of a bin at a time, and bulk transfers are not currently supported. -------------------------------------------------------------------------------- /content/help/vanity-urls.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Vanity URLs 3 | category: pro 4 | --- 5 | 6 | 7 | Vanity URLs has two purposes. The first is that puts *your* username when you share your bin's output, and secondly allows you to publish to your vanity homepage. 8 | 9 | This means you can publish any bin to your vanity url on `.jsbin.com` for example: [http://dave.jsbin.com](http://dave.jsbin.com) 10 | 11 | In addition, when you share the full output of your bins, your username is included in the URL, such as [http://dave.jsbin.com/fajac/3/](http://dave.jsbin.com/fajac/3/) -------------------------------------------------------------------------------- /content/help/versions.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Versions: Processors & core libraries' 3 | category: fix 4 | --- 5 | 6 | 7 | This page lists the versions of processors used and a few important libraries used by JS Bin. Note that _client_ libraries are managed by the web community [through pull requests](/help/adding-libraries). 8 | 9 | ## Processors 10 | 11 | ### HTML 12 | 13 | |Processor|Version|Updated| 14 | |---|---|---| 15 | |[Marked](https://github.com/chjj/marked/tree/v0.3.3)|0.3.3|25 Jan 2015| 16 | |[Jade](https://github.com/jadejs/jade/tree/1.11.0)|1.11.0|10 Jun 2015| 17 | 18 | ### JavaScript 19 | 20 | |Processor|Version|Updated| 21 | |---|---|---| 22 | |[Babel](https://github.com/babel/babel/tree/v5.4.2)|5.4.2|15 May 2015| 23 | |[CoffeeScript](https://github.com/jashkenas/coffeescript/tree/1.7.1)|1.7.1|30 Jan 2014| 24 | |[LiveScript](https://github.com/gkz/LiveScript/tree/1.2.0)|1.2.0|2 Aug 2013| 25 | |[React (JSX)](https://github.com/facebook/react/tree/v0.9.0)|0.9.0|20 Feb 2014| 26 | |[Processing](https://github.com/processing-js/processing-js/tree/v1.4.1)|1.4.1|9 Aug 2012| 27 | |[Traceur](https://github.com/phuu/jsbin/blob/e13b1a3b5e0fb626d2aba8941ccdbde196b314d2/public/js/vendor/traceur.js)|unknown|11 Oct 2012| 28 | |[TypeScript](https://github.com/jsbin/jsbin/commit/353323759839a547fe4fa0453739ba8cf37fe071)|unknown|7 Oct 2012| 29 | 30 | ### CSS 31 | 32 | |Processor|Version|Updated| 33 | |---|---|---| 34 | |[Less](https://github.com/less/less.js/tree/v2.5.1)|2.5.1|21 May 2015| 35 | |[Stylus](https://github.com/stylus/stylus/tree/0.51.1)|0.51.1|28 Apr 2015| 36 | |[Myth](https://github.com/segmentio/myth/tree/1.4.0)|1.4.0|6 Mar 2015| 37 | |[Sass & SCSS](https://github.com/sass/sass/tree/3.3.8)|3.3.8|13 May 2014| 38 | |[Compass](https://github.com/Compass/compass/tree/core-1.0.0.alpha.19)|1.0.0.alpha.19|12 Mar 2014| 39 | |[Bourbon](https://github.com/thoughtbot/bourbon/tree/v4.0.1)|4.0.2|23 Apr 2014| 40 | 41 | ## JS Bin Core Libraries 42 | 43 | Note that these libraries are not exposed to you as the user, but might be useful for understanding what functionality is available during usage. 44 | 45 | |Library|Version|Updated| 46 | |---|---|---| 47 | |[CodeMirror](https://github.com/marijnh/CodeMirror/tree/5.17.0)|5.17.0 (with 5.17.1 fixes)|19 Jul 2016| 48 | |[JSHint](https://github.com/jshint/jshint/tree/2.5.1)|2.5.1|16 May 2014| 49 | |[CSSLint](https://github.com/CSSLint/csslint/tree/v0.10.0)|0.10.0|15 Aug 2013| 50 | |[HTMLHint](https://github.com/yaniswang/HTMLHint/tree/eddcca1c1ccf0aa08d89ff0ec0751b3aaabef716)|0.9.6|15 Jun 2014| 51 | |[CoffeeLint](https://github.com/clutchski/coffeelint/tree/v1.5.0)|1.5.0|28 May 2014| 52 | |[Tern](https://github.com/marijnh/tern/tree/5ae2b7e6542e14de120ee3b31d4d7eb54b32093b)|0.5.1|10 Oct 2013| 53 | -------------------------------------------------------------------------------- /content/help/vision.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Vision 3 | category: fix 4 | --- 5 | 6 | 7 | - hacking (the person who would use jsbin to hack a prototype, and sharing their work) 8 | - learning to code (like a student, or in a classroom environment) 9 | - fix jsbin (to make it better, add libraries, advanced users and comfortable with code) 10 | - teaching (how jsbin can help in a classroom, in a group environment, in a published tutorial sense) -------------------------------------------------------------------------------- /content/help/what-is-jsbin.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: What is JS Bin? 3 | category: learn 4 | --- 5 | 6 | 7 | JS Bin is a tool that *enables* you to learn, experiment and teach using web technologies. 8 | 9 | There's a mass of features packed inside of JS Bin, but our aim is to be part of your tool chain to help you solve problems, explore technology and teach others. 10 | 11 | Here's an analogy to help: 12 | 13 | > If you wanted to build the coolest, fastest, power hungry car in the world, or perhaps teach a group of students how an engine works or show how aerodynamics are applied to car design, then *JS Bin is the garage full of all the tools you need to do your job*. 14 | 15 | JS Bin's motto is *"Hack. Learn. Fix. Teach"*, and JS Bin is a vehicle to achieve all of these things, and it's likely your use will fall in to one or more of these categories: 16 | 17 | * **Hack** — JS Bin lets you experiment with the full source code in a throw-away environment. 18 | * **Learn** — JS Bin lets you view *and* watch other people's code, to see exactly how code affects the output instantly in real-time. 19 | * **Fix** — JS Bin is perfect as a [pastebin](http://en.wikipedia.org/wiki/Pastebin) to create isolated problems to help diagnose and debug problems, either yourself, or by sharing the bin with others. 20 | * **Teach** — Using tools like [CodeCasting](/help/what-is-codecasting), [embedding](/help/how-can-i-embed-jsbin) you can share your knowledge and help others with your experience, and by sharing that code, they can go on an experiment directly with your code and see real-time feedback in the output window. 21 | 22 | ## In plain English 23 | 24 | JS Bin is a code sharing site. Along with the code, the complete *output* of the code is also be shared. As a user types in the editor "panels", they will see the output being generated in real-time in the output panel. 25 | 26 | There's a few common use cases for JS Bin. The first is teaching. Teachers will use JS Bin as a platform for showing how web languages work (HTML, CSS, JavaScript, but also languages that generate these, such as CoffeeScript, LESS and Markdown). 27 | 28 | Students need only to use a browser to start creating web pages and seeing the direct effect of their code on the output. 29 | 30 | Teachers can also use JS Bin's CodeCasting functionality. This is where the teacher will code in JS Bin, and share a unique URL with their students, and upon visiting the URL, the student's instance of JS Bin will update in real-time with the teacher's code and output - also allowing for remote teaching or remote tutorials. 31 | 32 | The second use case is in replicating bugs. Developers will use JS Bin to isolate and replicate bugs that demonstrates a particular problem. Then share the URL to the JS Bin either as the full output or the editor view of JS Bin. 33 | 34 | Once this is shared, a good member of the web community can fix the code (which is saved to a new URL) and share that back with the original author. -------------------------------------------------------------------------------- /content/help/when-do-revisions-change.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: When do revisions change? 3 | category: learn 4 | --- 5 | 6 | 7 | Let's say you've started afresh on jsbin.com. You're welcomed with either your own saved template or the default empty HTML page. 8 | 9 | **As soon as you start typing** you recieve your own URL and revision (revision 1) for that code. Let's say that url is `jsbin.com/abcde/1/` 10 | 11 | If you continue to type, all your changes are saved under revision 1 of `abcde`. 12 | 13 | ## When does the revision increment? 14 | 15 | There's a few situations that can cause a revision to change, some obvious and simple, some much more subtle and designed to be. 16 | 17 | ### When you create a new milestone 18 | 19 | This will immediately increment the revision, and you will no long be able to save to the previous revision you were on. 20 | 21 | ### When you "lock revision #X" 22 | 23 | The "lock revision #X" is inside the Share menu - which is only available on saved bins. 24 | 25 | This doesn't increment the revision right away, but clears your ability to write to the current revision. What does that actually mean? 26 | 27 | It means locking prevents *you* from making subsequent changes to the bin. This is useful when you want to share an exact representation of code. When you want to make absolutely sure that revision #X has the code you intended. 28 | 29 | Any subsequent key strokes will now *automatically* increament the revision number, and continue to save all your updated code in `jsbin.com/abcde/2/`. 30 | 31 | Note that use the keyboard shortcut ctrl+s (or cmd+s on a Mac) has the same effect as locking the revision. 32 | 33 | ### When you start a fresh session 34 | 35 | A "session" is limited to a single window (or more precisely: browser tab), and last only whilst you're on the same URL, such as `jsbin.com/abcde/1/`. If you open a *new* tab to `jsbin.com/abcde/1/`, it's considered a new session, and therefore you don't have write access to the revision #1 bin. So if you begin typing in this new tab, it will *automatically* increment the revision. 36 | 37 | So if you close your browser and later return to the same URL (that you might have been editing before), this is considered a new fresh session, and therefore a new revision is created as you begin to type. 38 | 39 | ### Using keyboard shortcut ctrl+s (or cmd+s on Mac) on an unmodified bin 40 | 41 | If you execute this keyboard shortcut and the bin has not been modified at all - and therefore don't have "write access" to the bin, it will automatically increment the revision and you will now own this new revision. 42 | 43 | If there is no URL, and are on simply `jsbin.com`, then you will be given a full new URL, such as `jsbin.com/vwxyz/1`. 44 | 45 | ## What is a revision 46 | 47 | Technically the revisions have no real meaning. Since you could in theory only own revision 1, 15 and 36 and none in between (due to perhaps sharing the URL). Equally the *content* in "revision" 1, 15 and 36 could be entirely different and not really represent a revision of one another. 48 | 49 | A revision simply indicates that there was a specific starting point, but all subsequent bins on that URL don't have to have a relationship. 50 | 51 | That said, it's also quite likely that you create `abcde/1` and share it with me, I make a change that fixes some problem you had, and return `abcde/2` - in this case it might be quite useful to produce a [diff between the two bins](http://www.youtube.com/watch?v=KZd_J8XFxTM) (note that this feature has since been removed but it's something I'd like to bring back to JS Bin 3 with a graphic UI to read the diff). -------------------------------------------------------------------------------- /content/help/why-register.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Why register? 3 | category: learn 4 | --- 5 | 6 | 7 | Registration is free and very simple with JS Bin, but what are the benefits? 8 | 9 | ## 1. Bin history 10 | 11 | All the bins you create whilst logged in can be retrieved from the "File", "Open" menu item. 12 | 13 | ## 2. Save customisations 14 | 15 | From the "Account" menu, you can [customise your editor settings](/blog/twdtw-8-svg-settings#usersettingslive) and this will be saved against your account, and not just to that particular machine. 16 | 17 | There's a number of specifics you can customise: plugins enabled in the main editor, key bindings (such as vim or sublime), default panels shown when arriving at JS Bin, JSHint defaults and more. 18 | 19 | ## 3. Shortcut URLs 20 | 21 | The last bin you worked on is always easily available under **/<user>/last**, and can be used with all modifiers. For example, if your username is *dave*, then all these work: 22 | 23 | - Last bin: http://jsbin.com/dave/last 24 | - Edit last bin: http://jsbin.com/dave/last/edit 25 | - Share codecasting for last bin: http://jsbin.com/dave/last/watch 26 | 27 | You can also refer to the nth from last too using `/last-n`: 28 | 29 | - Penulatimate bin: http://jsbin.com/dave/last-1/edit 30 | 31 | This is also particularly handy if you want to quickly fire up your current bin on a mobile device - just bookmark your shortcut URL! -------------------------------------------------------------------------------- /content/legals/_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "index-test": { 3 | "layout": "_layout" 4 | } 5 | } -------------------------------------------------------------------------------- /content/legals/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | date: '2014-06-12' 3 | --- 4 | -------------------------------------------------------------------------------- /content/legals/privacy.md: -------------------------------------------------------------------------------- 1 | --- 2 | date: '2014-06-12' 3 | --- 4 | -------------------------------------------------------------------------------- /content/writing-a-post.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: writing-a-post 3 | draft: true 4 | --- 5 | 6 | 7 | This post outlines useful tips and the process for releasing a jsbin blog post. 8 | 9 | ## Creating the draft post 10 | 11 | 1. Whilst drafting your post, ensure it lives inside the `public/blog/` directory. 12 | * You *can* work on a separate branch for the blog post, and this will ensure the content doesn't go live, *or* you can commit with `[skip ci]` which will skip the automated deployment process - though this isn't really required for weekly (TWDTW) posts. 13 | * Insert a new record in the `public/blog/_data.json` file structured as: 14 | 15 | ```json 16 | "": { 17 | "title": "", 18 | "author": "<author-username>", 19 | "date": "<publised-date>", 20 | "published": false 21 | }, 22 | ``` 23 | 24 | Note that setting `published: false` will show the post offline for development, but not show the post online in production. This is useful for sharing and copy editing with colleagues. 25 | 26 | ## Structure 27 | 28 | 1. What problem do your readers have? *don't know about how to do stuff (hack, fix, learn, teach, contribute, etc) in JS Bin* 29 | * Why hasn't this problem been solved yet? *resources are either non-existent scattered around* 30 | * What is now possible? *find everything in one place ask for help* 31 | * How does this make their life better? *by knowing your tools you can better at what you do* 32 | * What should they do now? *go to the help site, subscribe, etc* 33 | 34 | ## Preparing for publishing 35 | 36 | 1. Image sizes (if full width): 658px (to allow for a 660px centre column and 2px border around the image) 37 | * Ensure the metadata is present and correct in `public/blog/_data.json`containing `title`, `author` and `date` and move the post in to the `pubic/blog/` directory 38 | * Does the article have an `h1` (note that this does not particularly have to match the metadata? 39 | * Did you spell check the article? 40 | * Are you using consistent punctuation on titles and lists (i.e. ensuring lists all end with a period or not)? 41 | * Ensure any images are included in the `public/images/` directory and have been run through ImageOptim (or similar) 42 | * To ensure the post is deployed commit and push to the github repo (*without the `[skip ci]` command*). Deployment takes about 5 minutes or less 43 | -------------------------------------------------------------------------------- /data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/data/.gitkeep -------------------------------------------------------------------------------- /data/authors.json: -------------------------------------------------------------------------------- 1 | { 2 | "remy": { 3 | "name": "Remy Sharp", 4 | "avatar": "/images/avatars/remy.jpg" 5 | }, 6 | "danny": { 7 | "name": "Danny Hope", 8 | "avatar": "/images/avatars/danny.jpg" 9 | }, 10 | "fabien": { 11 | "name": "Fabien O'Carroll", 12 | "avatar": "/images/avatars/fabien.jpg" 13 | }, 14 | "giulia": { 15 | "name": "Giulia Alfonsi", 16 | "avatar": "/images/avatars/giulia.jpg" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /data/categories.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "learn", 4 | "title": "Learn", 5 | "description": "Making more use of JS Bin as part of your tools" 6 | }, 7 | { 8 | "name": "hack", 9 | "title": "Hacking & play", 10 | "description": "Prototypes, demos, and sharing your work" 11 | }, 12 | { 13 | "name": "fix", 14 | "title": "Fix & contribute", 15 | "description": "Making JS Bin better for everyone, and advanced usage" 16 | }, 17 | { 18 | "name": "teach", 19 | "title": "Teach & share your knowledge", 20 | "description": 21 | "Using JS Bin to teach others via blogs and published work or classroom and multi-user environments" 22 | }, 23 | { "name": "pro", "title": "Pro features", "description": "" } 24 | ] 25 | -------------------------------------------------------------------------------- /docsearch-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "index_name": "learn-jsbin", 3 | "start_urls": ["https://jsbin-learn.netlify.com/"], 4 | "stop_urls": ["https://jsbin.com"], 5 | "selectors": { 6 | "lvl0": "h1", 7 | "lvl1": "h2", 8 | "lvl2": "h3", 9 | "text": "article p" 10 | }, 11 | "selectors_exclude": [".show-your-love", ".ignore"] 12 | } 13 | -------------------------------------------------------------------------------- /layouts/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/layouts/.gitkeep -------------------------------------------------------------------------------- /layouts/404.html: -------------------------------------------------------------------------------- 1 | {{ define "main" -}} 2 | 3 | <h1>The page you were looking for doesn't exist...yet?</h1> 4 | 5 | <p>The JS Bin learn site is all available on <a href="https://github.com/jsbin/learn">github</a>, so it's possible you were after a page that doesn't exist <em>yet</em>, so if you're feeling brave, we'd love for you to go ahead and send us a pull request for the page you were looking for.</p> 6 | <p>If you had a specific question that wasn't answered, or indeed this is a bug (and you expected to find a specific page), please do take a minute to <a href="https://github.com/jsbin/learn/issues/new">file an issue</a> to help us help you.</p> 7 | <p>Otherwise, Dave says "Hi"!</p> 8 | 9 | <p><a class="jsbin-embed" href="http://jsbin.com/AZEy/8/embed?css,output&height=500px">I am Dave</a> 10 | <script src="http://static.jsbin.com/js/embed.js"></script></p> 11 | {{- end }} 12 | -------------------------------------------------------------------------------- /layouts/_default/baseof.html: -------------------------------------------------------------------------------- 1 | <!DOCTYPE html> 2 | <html id="page"> 3 | 4 | <head> 5 | <meta charset="utf-8"> 6 | <title>{{ .Title }} 7 | 8 | 9 | 10 | 11 | 12 | 13 | {{ "" | safeHTML }} 16 | 17 | 18 | 19 |
20 |
21 |
Back to JS Bin 22 | 28 |
29 |
30 |
31 | 32 | {{ if eq $.Section "legals" | or $.IsNode }}{{ block "main" . -}}{{- end }} 33 | {{else}} 34 |
{{ block "main" . -}}{{- end }}
{{end}} 35 |
36 |
37 |
38 | 52 | 66 | 67 | 83 | 84 | 85 | 86 | 87 | 88 | {{ template "_internal/google_analytics_async.html" . }} 89 | {{ "" | safeHTML }} 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /layouts/_default/feed.json: -------------------------------------------------------------------------------- 1 | { "blog": [ 2 | {{ range $i, $e := (where .Site.Pages "Section" "blog") }} 3 | {{ if $i }}, {{ end }} 4 | { 5 | "title": "{{ .Title }}", 6 | "slug": "{{ .RelPermalink }}", 7 | "date": "{{ .PublishDate.Format "2006-01-02" }}", 8 | "timestamp": {{ mul (.PublishDate.Unix) 1000 }} 9 | } 10 | {{ end }} 11 | ], 12 | "help": [ 13 | {{ range $i, $e := (where .Site.Pages "Section" "help") }} 14 | {{ if $i }}, {{ end }} 15 | { 16 | "title": "{{ .Title }}", 17 | "slug": "{{ .RelPermalink }}", 18 | "category": "{{ .Params.Category }}" 19 | } 20 | {{ end }} 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /layouts/_default/list.html: -------------------------------------------------------------------------------- 1 | {{ define "main" -}} 2 |
    3 | {{ range .Data.Pages -}} 4 |
  • 5 | {{ .Title }} 6 |
  • 7 | {{- end }} 8 |
9 | {{- end }} -------------------------------------------------------------------------------- /layouts/_default/single.html: -------------------------------------------------------------------------------- 1 | {{ define "main" -}} 2 | {{ if eq $.Section "blog" }} 3 | 4 | {{ else }} 5 | Edit on github 6 | {{end}} 7 | 8 | {{ if .Params.Author }} {{ partial "author.html" . }} {{ end }} 9 | 10 |

{{ replace .Title "* " "" }}

11 | 12 | {{ .Content }} 13 | 14 |
15 |

❤️ Love JS Bin?

16 |

Support this open source project today, and help it 17 | continue to run for another decade 🎂

18 |
19 | 20 | {{ if .Site.DisqusShortname -}} 21 |

Comments

22 | {{ template "_internal/disqus.html" . }} 23 | {{- end }} 24 | {{- end }} 25 | -------------------------------------------------------------------------------- /layouts/blog/feed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} 4 | {{ .Permalink }} 5 | Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} 6 | Hugo -- gohugo.io{{ with .Site.LanguageCode }} 7 | {{.}}{{end}}{{ with .Site.Author.email }} 8 | {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} 9 | {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} 10 | {{.}}{{end}}{{ if not .Date.IsZero }} 11 | {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} 12 | {{ with .OutputFormats.Get "RSS" }} 13 | {{ printf "" .Permalink .MediaType | safeHTML }} 14 | {{ end }} 15 | {{ range .Data.Pages }} 16 | 17 | {{ .Title }} 18 | {{ .Permalink }} 19 | {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} 20 | {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} 21 | {{ .Permalink }} 22 | {{ .Summary | html }} 23 | 24 | {{ end }} 25 | 26 | 27 | -------------------------------------------------------------------------------- /layouts/blog/list.html: -------------------------------------------------------------------------------- 1 | {{ define "main" -}} 2 | 3 |

The JS Bin Blog

4 | 5 |
    6 | {{ range where .Data.Pages "Layout" "!=" "feed" -}} 7 |
  • 8 | {{ .PublishDate.Format "2-Jan, 2006" }} 9 | {{ .Title }} 10 | 11 |

    {{ index (split .Summary "\n") 0 | safeHTML }}   Read post

    12 |
  • 13 | {{- end }} 14 |
15 | {{- end }} 16 | -------------------------------------------------------------------------------- /layouts/help/list.html: -------------------------------------------------------------------------------- 1 | {{ define "main" -}} 2 | 3 |

Help

4 |
5 | {{ range $cat := .Site.Data.categories }} 6 |
7 |

{{ $cat.title }}

8 |

{{ $cat.description }}

9 | 10 | 16 |
17 | {{ end }} 18 | 19 |
20 |

Legals

21 |

Our terms and privacy policy that we run JS Bin under

22 |
30 | 31 |
32 | {{end}} 33 | -------------------------------------------------------------------------------- /layouts/index.html: -------------------------------------------------------------------------------- 1 | {{ define "main" -}} 2 |
Ignore this landing page
3 | {{- end }} 4 | -------------------------------------------------------------------------------- /layouts/legals/single.html: -------------------------------------------------------------------------------- 1 | {{ define "main" -}} 2 |

3 | 4 | 5 | JS Bin's Privacy Policy

6 | Last updated {{ .PublishDate.Format "2-Jan, 2006" }} 7 | 229 | {{ end }} 230 | -------------------------------------------------------------------------------- /layouts/partials/author.html: -------------------------------------------------------------------------------- 1 | {{ $author := index .Site.Data.authors .Params.Author }} 2 | 3 |
4 | 5 | By {{ $author.name }} 6 | {{ .PublishDate.Format "2-Jan, 2006" }} 7 |
8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "learn", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "dev": "hugo -D serve -p 5000", 8 | "build": "npm run hugo && npm run codemod && npm run check", 9 | "hugo": "hugo", 10 | "codemod": "find ./public -iname '*.html' -exec perl -pi -e 's#src=\"\/([^/])#src=\"https://help.jsbin.com/\\1#g' {} \\; ", 11 | "check": "grep '/images/deleted-bin.png' public/help/delete-a-bin/index.html" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/jsbin/learn.git" 16 | }, 17 | "keywords": [], 18 | "author": "", 19 | "license": "ISC", 20 | "bugs": { 21 | "url": "https://github.com/jsbin/learn/issues" 22 | }, 23 | "homepage": "https://github.com/jsbin/learn#readme" 24 | } 25 | -------------------------------------------------------------------------------- /static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/.gitkeep -------------------------------------------------------------------------------- /static/_headers: -------------------------------------------------------------------------------- 1 | /* 2 | Access-Control-Allow-Origin: * 3 | Access-Control-Allow-Headers: X-Requested-With 4 | -------------------------------------------------------------------------------- /static/css/github.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | github.com style (c) Vasily Polovnyov 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; padding: 0.5em; 9 | color: #333; 10 | background: #f8f8f8;} 11 | 12 | .hljs-comment, 13 | .hljs-template_comment, 14 | .diff .hljs-header, 15 | .hljs-javadoc { 16 | color: #998; 17 | font-style: italic 18 | } 19 | 20 | .hljs-keyword, 21 | .css .rule .hljs-keyword, 22 | .hljs-winutils, 23 | .javascript .hljs-title, 24 | .nginx .hljs-title, 25 | .hljs-subst, 26 | .hljs-request, 27 | .hljs-status { 28 | color: #333; 29 | font-weight: bold 30 | } 31 | 32 | .hljs-number, 33 | .hljs-hexcolor, 34 | .ruby .hljs-constant { 35 | color: #099; 36 | } 37 | 38 | .hljs-string, 39 | .hljs-tag .hljs-value, 40 | .hljs-phpdoc, 41 | .tex .hljs-formula { 42 | color: #d14 43 | } 44 | 45 | .hljs-title, 46 | .hljs-id, 47 | .coffeescript .hljs-params, 48 | .scss .hljs-preprocessor { 49 | color: #900; 50 | font-weight: bold 51 | } 52 | 53 | .javascript .hljs-title, 54 | .lisp .hljs-title, 55 | .clojure .hljs-title, 56 | .hljs-subst { 57 | font-weight: normal 58 | } 59 | 60 | .hljs-class .hljs-title, 61 | .haskell .hljs-type, 62 | .vhdl .hljs-literal, 63 | .tex .hljs-command { 64 | color: #458; 65 | font-weight: bold 66 | } 67 | 68 | .hljs-tag, 69 | .hljs-tag .hljs-title, 70 | .hljs-rules .hljs-property, 71 | .django .hljs-tag .hljs-keyword { 72 | color: #000080; 73 | font-weight: normal 74 | } 75 | 76 | .hljs-attribute, 77 | .hljs-variable, 78 | .lisp .hljs-body { 79 | color: #008080 80 | } 81 | 82 | .hljs-regexp { 83 | color: #009926 84 | } 85 | 86 | .hljs-symbol, 87 | .ruby .hljs-symbol .hljs-string, 88 | .lisp .hljs-keyword, 89 | .tex .hljs-special, 90 | .hljs-prompt { 91 | color: #990073 92 | } 93 | 94 | .hljs-built_in, 95 | .lisp .hljs-title, 96 | .clojure .hljs-built_in { 97 | color: #0086b3 98 | } 99 | 100 | .hljs-preprocessor, 101 | .hljs-pragma, 102 | .hljs-pi, 103 | .hljs-doctype, 104 | .hljs-shebang, 105 | .hljs-cdata { 106 | color: #999; 107 | font-weight: bold 108 | } 109 | 110 | .hljs-deletion { 111 | background: #fdd 112 | } 113 | 114 | .hljs-addition { 115 | background: #dfd 116 | } 117 | 118 | .diff .hljs-change { 119 | background: #0086b3 120 | } 121 | 122 | .hljs-chunk { 123 | color: #aaa 124 | } 125 | -------------------------------------------------------------------------------- /static/css/highlight.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Original style from softwaremaniacs.org (c) Ivan Sagalaev 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; padding: 0.5em; 9 | background: #F0F0F0; 10 | } 11 | 12 | .hljs, 13 | .hljs-subst, 14 | .hljs-tag .hljs-title, 15 | .lisp .hljs-title, 16 | .clojure .hljs-built_in, 17 | .nginx .hljs-title { 18 | color: black; 19 | } 20 | 21 | .hljs-string, 22 | .hljs-title, 23 | .hljs-constant, 24 | .hljs-parent, 25 | .hljs-tag .hljs-value, 26 | .hljs-rules .hljs-value, 27 | .hljs-rules .hljs-value .hljs-number, 28 | .hljs-preprocessor, 29 | .hljs-pragma, 30 | .haml .hljs-symbol, 31 | .ruby .hljs-symbol, 32 | .ruby .hljs-symbol .hljs-string, 33 | .hljs-aggregate, 34 | .hljs-template_tag, 35 | .django .hljs-variable, 36 | .smalltalk .hljs-class, 37 | .hljs-addition, 38 | .hljs-flow, 39 | .hljs-stream, 40 | .bash .hljs-variable, 41 | .apache .hljs-tag, 42 | .apache .hljs-cbracket, 43 | .tex .hljs-command, 44 | .tex .hljs-special, 45 | .erlang_repl .hljs-function_or_atom, 46 | .asciidoc .hljs-header, 47 | .markdown .hljs-header, 48 | .coffeescript .hljs-attribute { 49 | color: #800; 50 | } 51 | 52 | .smartquote, 53 | .hljs-comment, 54 | .hljs-annotation, 55 | .hljs-template_comment, 56 | .diff .hljs-header, 57 | .hljs-chunk, 58 | .asciidoc .hljs-blockquote, 59 | .markdown .hljs-blockquote { 60 | color: #888; 61 | } 62 | 63 | .hljs-number, 64 | .hljs-date, 65 | .hljs-regexp, 66 | .hljs-literal, 67 | .hljs-hexcolor, 68 | .smalltalk .hljs-symbol, 69 | .smalltalk .hljs-char, 70 | .go .hljs-constant, 71 | .hljs-change, 72 | .lasso .hljs-variable, 73 | .makefile .hljs-variable, 74 | .asciidoc .hljs-bullet, 75 | .markdown .hljs-bullet, 76 | .asciidoc .hljs-link_url, 77 | .markdown .hljs-link_url { 78 | color: #080; 79 | } 80 | 81 | .hljs-label, 82 | .hljs-javadoc, 83 | .ruby .hljs-string, 84 | .hljs-decorator, 85 | .hljs-filter .hljs-argument, 86 | .hljs-localvars, 87 | .hljs-array, 88 | .hljs-attr_selector, 89 | .hljs-important, 90 | .hljs-pseudo, 91 | .hljs-pi, 92 | .haml .hljs-bullet, 93 | .hljs-doctype, 94 | .hljs-deletion, 95 | .hljs-envvar, 96 | .hljs-shebang, 97 | .apache .hljs-sqbracket, 98 | .nginx .hljs-built_in, 99 | .tex .hljs-formula, 100 | .erlang_repl .hljs-reserved, 101 | .hljs-prompt, 102 | .asciidoc .hljs-link_label, 103 | .markdown .hljs-link_label, 104 | .vhdl .hljs-attribute, 105 | .clojure .hljs-attribute, 106 | .asciidoc .hljs-attribute, 107 | .lasso .hljs-attribute, 108 | .coffeescript .hljs-property, 109 | .hljs-phony { 110 | color: #88F 111 | } 112 | 113 | .hljs-keyword, 114 | .hljs-id, 115 | .hljs-title, 116 | .hljs-built_in, 117 | .hljs-aggregate, 118 | .css .hljs-tag, 119 | .hljs-javadoctag, 120 | .hljs-phpdoc, 121 | .hljs-yardoctag, 122 | .smalltalk .hljs-class, 123 | .hljs-winutils, 124 | .bash .hljs-variable, 125 | .apache .hljs-tag, 126 | .go .hljs-typename, 127 | .tex .hljs-command, 128 | .asciidoc .hljs-strong, 129 | .markdown .hljs-strong, 130 | .hljs-request, 131 | .hljs-status { 132 | font-weight: bold; 133 | } 134 | 135 | .asciidoc .hljs-emphasis, 136 | .markdown .hljs-emphasis { 137 | font-style: italic; 138 | } 139 | 140 | .nginx .hljs-built_in { 141 | font-weight: normal; 142 | } 143 | 144 | .coffeescript .javascript, 145 | .javascript .xml, 146 | .lasso .markup, 147 | .tex .hljs-formula, 148 | .xml .javascript, 149 | .xml .vbscript, 150 | .xml .css, 151 | .xml .hljs-cdata { 152 | opacity: 0.5; 153 | } 154 | -------------------------------------------------------------------------------- /static/css/syntax.css: -------------------------------------------------------------------------------- 1 | /* Background */ .chroma { background-color: #ffffff } 2 | /* Error */ .chroma .err { } 3 | /* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; } 4 | /* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; width: 100%; overflow: auto; display: block; } 5 | /* LineHighlight */ .chroma .hl { display: block; width: 100%;background-color: #ffffcc } 6 | /* LineNumbersTable */ .chroma .lnt { margin-right: 0.4em; padding: 0 0.4em 0 0.4em; display: block; } 7 | /* LineNumbers */ .chroma .ln { margin-right: 0.4em; padding: 0 0.4em 0 0.4em; } 8 | /* Keyword */ .chroma .k { color: #0000ff } 9 | /* KeywordConstant */ .chroma .kc { color: #0000ff } 10 | /* KeywordDeclaration */ .chroma .kd { color: #0000ff } 11 | /* KeywordNamespace */ .chroma .kn { color: #0000ff } 12 | /* KeywordPseudo */ .chroma .kp { color: #0000ff } 13 | /* KeywordReserved */ .chroma .kr { color: #0000ff } 14 | /* KeywordType */ .chroma .kt { color: #2b91af } 15 | /* NameClass */ .chroma .nc { color: #2b91af } 16 | /* LiteralString */ .chroma .s { color: #a31515 } 17 | /* LiteralStringAffix */ .chroma .sa { color: #a31515 } 18 | /* LiteralStringBacktick */ .chroma .sb { color: #a31515 } 19 | /* LiteralStringChar */ .chroma .sc { color: #a31515 } 20 | /* LiteralStringDelimiter */ .chroma .dl { color: #a31515 } 21 | /* LiteralStringDoc */ .chroma .sd { color: #a31515 } 22 | /* LiteralStringDouble */ .chroma .s2 { color: #a31515 } 23 | /* LiteralStringEscape */ .chroma .se { color: #a31515 } 24 | /* LiteralStringHeredoc */ .chroma .sh { color: #a31515 } 25 | /* LiteralStringInterpol */ .chroma .si { color: #a31515 } 26 | /* LiteralStringOther */ .chroma .sx { color: #a31515 } 27 | /* LiteralStringRegex */ .chroma .sr { color: #a31515 } 28 | /* LiteralStringSingle */ .chroma .s1 { color: #a31515 } 29 | /* LiteralStringSymbol */ .chroma .ss { color: #a31515 } 30 | /* OperatorWord */ .chroma .ow { color: #0000ff } 31 | /* Comment */ .chroma .c { color: #008000 } 32 | /* CommentHashbang */ .chroma .ch { color: #008000 } 33 | /* CommentMultiline */ .chroma .cm { color: #008000 } 34 | /* CommentSingle */ .chroma .c1 { color: #008000 } 35 | /* CommentSpecial */ .chroma .cs { color: #008000 } 36 | /* CommentPreproc */ .chroma .cp { color: #0000ff } 37 | /* CommentPreprocFile */ .chroma .cpf { color: #0000ff } 38 | /* GenericEmph */ .chroma .ge { font-style: italic } 39 | /* GenericHeading */ .chroma .gh { font-weight: bold } 40 | /* GenericPrompt */ .chroma .gp { font-weight: bold } 41 | /* GenericStrong */ .chroma .gs { font-weight: bold } 42 | /* GenericSubheading */ .chroma .gu { font-weight: bold } 43 | -------------------------------------------------------------------------------- /static/images/api-key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/api-key.png -------------------------------------------------------------------------------- /static/images/avatars/danny.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/avatars/danny.jpg -------------------------------------------------------------------------------- /static/images/avatars/fabien.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/avatars/fabien.jpg -------------------------------------------------------------------------------- /static/images/avatars/giulia.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/avatars/giulia.jpg -------------------------------------------------------------------------------- /static/images/avatars/remy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/avatars/remy.jpg -------------------------------------------------------------------------------- /static/images/bin-info-expanded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/bin-info-expanded.png -------------------------------------------------------------------------------- /static/images/blog/auto-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/blog/auto-disabled.png -------------------------------------------------------------------------------- /static/images/blog/dave-loves-you.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/blog/dave-loves-you.jpg -------------------------------------------------------------------------------- /static/images/blog/early-v5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/blog/early-v5.png -------------------------------------------------------------------------------- /static/images/blog/loop-protect.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/blog/loop-protect.gif -------------------------------------------------------------------------------- /static/images/blog/new-share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/blog/new-share.png -------------------------------------------------------------------------------- /static/images/blog/oembed-pr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/blog/oembed-pr.png -------------------------------------------------------------------------------- /static/images/blog/processors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/blog/processors.png -------------------------------------------------------------------------------- /static/images/blog/ssl-for-all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/blog/ssl-for-all.png -------------------------------------------------------------------------------- /static/images/blog/v1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/blog/v1.jpg -------------------------------------------------------------------------------- /static/images/change-your-password.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/change-your-password.png -------------------------------------------------------------------------------- /static/images/chrome-revoke.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/chrome-revoke.png -------------------------------------------------------------------------------- /static/images/comment.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /static/images/debugging-prefs-devtools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/debugging-prefs-devtools.png -------------------------------------------------------------------------------- /static/images/default-prefs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/default-prefs.png -------------------------------------------------------------------------------- /static/images/deleted-bin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/deleted-bin.png -------------------------------------------------------------------------------- /static/images/disable-cmd-n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/disable-cmd-n.png -------------------------------------------------------------------------------- /static/images/do-not-own-bin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/do-not-own-bin.png -------------------------------------------------------------------------------- /static/images/embed-small.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/embed-small.gif -------------------------------------------------------------------------------- /static/images/enable-experiments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/enable-experiments.png -------------------------------------------------------------------------------- /static/images/export-as-gist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/export-as-gist.png -------------------------------------------------------------------------------- /static/images/export-complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/export-complete.png -------------------------------------------------------------------------------- /static/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/favicon.png -------------------------------------------------------------------------------- /static/images/favicon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/images/flat-design.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/flat-design.png -------------------------------------------------------------------------------- /static/images/free-preview-expired.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/free-preview-expired.png -------------------------------------------------------------------------------- /static/images/jsbin-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/jsbin-32.png -------------------------------------------------------------------------------- /static/images/jsbin-start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/jsbin-start.png -------------------------------------------------------------------------------- /static/images/jsbin-zen-mode-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/jsbin-zen-mode-1.png -------------------------------------------------------------------------------- /static/images/layout-selection1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/layout-selection1.png -------------------------------------------------------------------------------- /static/images/libraries.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/libraries.png -------------------------------------------------------------------------------- /static/images/line-numbers-pref.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/line-numbers-pref.png -------------------------------------------------------------------------------- /static/images/line-numbers.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/line-numbers.gif -------------------------------------------------------------------------------- /static/images/panel-configure.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/panel-configure.gif -------------------------------------------------------------------------------- /static/images/panel-options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/panel-options.png -------------------------------------------------------------------------------- /static/images/private-bins.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/private-bins.gif -------------------------------------------------------------------------------- /static/images/private-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/private-menu.png -------------------------------------------------------------------------------- /static/images/rss_alt.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /static/images/save-as-template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/save-as-template.png -------------------------------------------------------------------------------- /static/images/share-menu1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/share-menu1.png -------------------------------------------------------------------------------- /static/images/ssl-cert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/ssl-cert.png -------------------------------------------------------------------------------- /static/images/ssl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/ssl.png -------------------------------------------------------------------------------- /static/images/stickers.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/stickers.jpg -------------------------------------------------------------------------------- /static/images/transfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/transfer.png -------------------------------------------------------------------------------- /static/images/twdtw/1/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/1/login.png -------------------------------------------------------------------------------- /static/images/twdtw/1/sass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/1/sass.png -------------------------------------------------------------------------------- /static/images/twdtw/1/tern.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/1/tern.gif -------------------------------------------------------------------------------- /static/images/twdtw/10/jshint-prefs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/10/jshint-prefs.png -------------------------------------------------------------------------------- /static/images/twdtw/10/line-highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/10/line-highlight.png -------------------------------------------------------------------------------- /static/images/twdtw/11/linting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/11/linting.png -------------------------------------------------------------------------------- /static/images/twdtw/11/ssl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/11/ssl.png -------------------------------------------------------------------------------- /static/images/twdtw/2/fold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/2/fold.png -------------------------------------------------------------------------------- /static/images/twdtw/2/hack.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/2/hack.jpg -------------------------------------------------------------------------------- /static/images/twdtw/3/cm4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/3/cm4.gif -------------------------------------------------------------------------------- /static/images/twdtw/3/dance.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/3/dance.gif -------------------------------------------------------------------------------- /static/images/twdtw/3/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/3/settings.png -------------------------------------------------------------------------------- /static/images/twdtw/5/preferences.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/5/preferences.png -------------------------------------------------------------------------------- /static/images/twdtw/6/baby.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/6/baby.png -------------------------------------------------------------------------------- /static/images/twdtw/7/scss.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/7/scss.gif -------------------------------------------------------------------------------- /static/images/twdtw/7/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/7/search.png -------------------------------------------------------------------------------- /static/images/twdtw/7/tv-brain-melt.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/7/tv-brain-melt.jpg -------------------------------------------------------------------------------- /static/images/twdtw/8/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/twdtw/8/settings.png -------------------------------------------------------------------------------- /static/images/url-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsbin/learn/81fddfd814ba1cb257811f88c4ff51094174c7bc/static/images/url-example.png -------------------------------------------------------------------------------- /static/js/back-button.js: -------------------------------------------------------------------------------- 1 | function readCookie(name) { 2 | var nameEQ = name + '='; 3 | var ca = document.cookie.split(';'); 4 | for(var i=0;i < ca.length;i++) { 5 | var c = ca[i]; 6 | while (c.charAt(0)==' ') c = c.substring(1,c.length); 7 | if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 8 | } 9 | return null; 10 | } 11 | 12 | (function () { 13 | 'use strict'; 14 | 15 | var back = readCookie('last'); 16 | 17 | if (back !== null && back !== '%2Fedit') { 18 | document.getElementById('back').href = decodeURIComponent(back); 19 | } 20 | })(); -------------------------------------------------------------------------------- /static/js/blog.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | if (!timestamp) return; 4 | try { 5 | var last = localStorage.lastpost; 6 | if (last) { 7 | if (last < timestamp) { 8 | localStorage.lastpost = timestamp; 9 | } 10 | } else { 11 | localStorage.lastpost = timestamp; 12 | } 13 | } catch (e) { 14 | console.warn(e); 15 | } 16 | })(); -------------------------------------------------------------------------------- /static/js/html5shiv.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve HTML5 Shiv prev3.7.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 3 | */ 4 | !function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=s.elements;return"string"==typeof a?a.split(" "):a}function e(a){var b=r[a[p]];return b||(b={},q++,a[p]=q,r[q]=b),b}function f(a,c,d){if(c||(c=b),k)return c.createElement(a);d||(d=e(c));var f;return f=d.cache[a]?d.cache[a].cloneNode():o.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!f.canHaveChildren||n.test(a)||f.tagUrn?f:d.frag.appendChild(f)}function g(a,c){if(a||(a=b),k)return a.createDocumentFragment();c=c||e(a);for(var f=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)f.createElement(h[g]);return f}function h(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return s.shivMethods?f(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(s,b.frag)}function i(a){a||(a=b);var d=e(a);return!s.shivCSS||j||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),k||h(a,d),a}var j,k,l="3.7.0",m=a.html5||{},n=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,o=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,p="_html5shiv",q=0,r={};!function(){try{var a=b.createElement("a");a.innerHTML="",j="hidden"in a,k=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){j=!0,k=!0}}();var s={elements:m.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:l,shivCSS:m.shivCSS!==!1,supportsUnknownElements:k,shivMethods:m.shivMethods!==!1,type:"default",shivDocument:i,createElement:f,createDocumentFragment:g};a.html5=s,i(b)}(this,document); -------------------------------------------------------------------------------- /static/js/keyboard.js: -------------------------------------------------------------------------------- 1 | function keyboard() { 2 | 'use strict'; 3 | 4 | var mac = navigator.userAgent.indexOf(' Mac ') !== -1; 5 | var mackeys = { 6 | 'ctrl': '⌘', 7 | 'shift': '⇧', 8 | 'del': '⌫' 9 | }; 10 | 11 | if (!mac) { 12 | return; 13 | } 14 | 15 | var $ = document.querySelectorAll.bind(document); 16 | 17 | [].forEach.call($('kbd'), function (el) { 18 | var m = el.innerHTML; 19 | var c = el.className; 20 | if (c !== 'same' && m.toLowerCase().indexOf('ctrl') !== -1) { 21 | el.innerHTML = m.replace(/(c)trl/ig, '$1md'); 22 | } 23 | // if (mackeys[m]) { 24 | // el.replaceChild(document.createTextNode(mackeys[m]), el.firstChild); 25 | // el.className = 'symbol'; 26 | // } 27 | }); 28 | } 29 | 30 | if (document.querySelector && Function.prototype.bind) { 31 | keyboard(); 32 | } -------------------------------------------------------------------------------- /static/js/min.js: -------------------------------------------------------------------------------- 1 | $=function(t,n,e){var i=Node.prototype,r=NodeList.prototype,o="forEach",u="trigger",c=[][o],s=t.createElement("i");return r[o]=c,n.on=i.on=function(t,n){return this.addEventListener(t,n,!1),this},r.on=function(t,n){return this[o](function(e){e.on(t,n)}),this},n[u]=i[u]=function(n,e){var i=t.createEvent("HTMLEvents");return i.initEvent(n,!0,!0),i.data=e||{},i.eventName=n,i.target=this,this.dispatchEvent(i),this},r[u]=function(t){return this[o](function(n){n[u](t)}),this},e=function(n){var e=t.querySelectorAll(n||"☺"),i=e.length;return 1==i?e[0]:e},e.on=i.on.bind(s),e[u]=i[u].bind(s),e}(document,this); -------------------------------------------------------------------------------- /static/js/notify.js: -------------------------------------------------------------------------------- 1 | function notify(form) { 2 | 'use strict'; 3 | /*global $, post*/ 4 | if (!form || (form instanceof NodeList && form.length === 0) || form.nodeName !== 'FORM') { 5 | return; 6 | } 7 | 8 | var label = form.querySelector('label'); 9 | var inputs = $('form.notify input'); 10 | inputs.forEach(function (el) { 11 | el.hidden = true; 12 | }); 13 | 14 | var once = false; 15 | label.on('click', function () { 16 | if (once) { 17 | return; 18 | } 19 | once = true; 20 | inputs.forEach(function (el) { 21 | el.hidden = false; 22 | }); 23 | this.hidden = true; 24 | inputs[0].focus(); 25 | }); 26 | 27 | form.on('submit', function (event) { 28 | event.preventDefault(); 29 | var data = [].map.call(inputs, function (el) { 30 | var result = {}; 31 | result[encodeURIComponent(el.name)] = encodeURIComponent(el.value); 32 | return result; 33 | }); 34 | 35 | post(form.action, data, function (error, result) { 36 | if (error) { 37 | alert('The request failed, can you try again now or perhaps try again later and let us know it didn\'t work out.'); 38 | return console.error(error); 39 | } 40 | 41 | inputs.forEach(function (el) { 42 | el.hidden = true; 43 | }); 44 | label.innerHTML = '✔ We\'ll tell you when this is ready'; 45 | label.className = ''; 46 | label.hidden = false; 47 | }); 48 | }); 49 | } 50 | 51 | if (document.querySelectorAll) { 52 | notify($('form.notify')); 53 | } -------------------------------------------------------------------------------- /static/js/permalink.js: -------------------------------------------------------------------------------- 1 | function permalink() { 2 | 'use strict'; 3 | var anchor = document.createElement('a'); 4 | anchor.className = 'anchor'; 5 | anchor.innerHTML = ''; 6 | 7 | document.querySelectorAll('h1,h2,h3,h4,h5,h6').forEach(function(el) { 8 | if (el.id) { 9 | var clone = anchor.cloneNode(true); 10 | clone.href = '#' + el.id; 11 | el.insertBefore(clone, el.firstChild); 12 | } 13 | }); 14 | } 15 | 16 | if (document.querySelector && Function.prototype.bind) { 17 | permalink(); 18 | } 19 | -------------------------------------------------------------------------------- /static/js/search.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | /*global $, get*/ 4 | var resultsEl = $('#results'); 5 | var searchTerms = []; 6 | var search = $('#search'); 7 | var position = -1; 8 | 9 | search.on('input', throttle(function () { 10 | if (searchTerms.length === 0) { 11 | get('/help/search.json', function (error, data) { 12 | searchTerms = data || []; 13 | searchFor(this.value, searchTerms); 14 | }.bind(this)); 15 | } else { 16 | searchFor(this.value, searchTerms); 17 | } 18 | position = -1; 19 | }, 200)); 20 | 21 | document.documentElement.on('click', function (event) { 22 | if (event.target.id === 'search' || event.target.id === 'results') { 23 | 24 | } else { 25 | resultsEl.hidden = true; 26 | } 27 | }); 28 | 29 | document.documentElement.on('keydown', function (event) { 30 | if (event.which === 191) { 31 | event.preventDefault(); 32 | search.focus(); 33 | } else if (event.which === 27) { 34 | search.blur(); 35 | } 36 | }, false); 37 | 38 | if (search.classList) { 39 | resultsEl.on('mousemove', function () { 40 | if (position !== -1) { 41 | for (var i = 0; i < resultsEl.children.length; i++) { 42 | resultsEl.children[i].classList.remove('highlight'); 43 | } 44 | position = -1; 45 | } 46 | }); 47 | 48 | search.on('keydown', function (event) { 49 | var key = event.which; 50 | if (key === 38 || key === 40) { // up / down 51 | event.preventDefault(); 52 | var inc = 1; 53 | if (key === 38) { 54 | inc = -1; 55 | } 56 | 57 | position += inc; 58 | 59 | var length = resultsEl.children.length; 60 | 61 | for (var i = 0; i < length; i++) { 62 | resultsEl.children[i].classList.remove('highlight'); 63 | } 64 | 65 | if (position < 0) { 66 | position = length - 1; 67 | } else if (position > length - 1) { 68 | position = 0; 69 | } 70 | 71 | resultsEl.children[position].classList.add('highlight'); 72 | } else if (key === 13) { // select 73 | var url = resultsEl.querySelector('.highlight a'); 74 | if (url) { 75 | window.location = url.href; 76 | } 77 | } 78 | }, false); 79 | } 80 | 81 | search.on('focus', function () { 82 | resultsEl.hidden = false; 83 | }); 84 | 85 | function wordmap(input) { 86 | var ignore = 'a an and on in it of if for the i is i\'m i\'d it\'s or to me be not was do so at are what bin bins'.split(' '); 87 | 88 | var endings = 'ing ly lies s'; 89 | var endingRe = new RegExp('(' + endings.split(' ').join('|') + ')$'); 90 | 91 | return (input||'') 92 | //- strip html 93 | .replace(/(<([^>]+)>)/ig,'') 94 | //- strip non-letters 95 | .replace(/\W/g, ' ').replace(/["'\.,]/g, '') 96 | //- turn in to array of lower case words 97 | .toLowerCase().split(' ') 98 | //- filter out ignored words 99 | .filter(function (word) { 100 | return ignore.indexOf(word.trim()) === -1; 101 | }).filter(function (e, i, words) { 102 | //- return unique 103 | return words.lastIndexOf(e) === i; 104 | }).filter(function (word) { 105 | //- return words 3 chars or longer 106 | return word.length > 2; 107 | }).map(function (word) { 108 | return word.trim().replace(endingRe, ''); 109 | }).sort(); 110 | } 111 | 112 | function searchFor(needles, haystack) { 113 | needles = wordmap(needles); 114 | var results = haystack.map(function (data) { 115 | var matches = needles.filter(function (needle) { 116 | return data.words.indexOf(needle) !== -1; 117 | }).length; 118 | 119 | return { 120 | type: data.type, 121 | title: data.title, 122 | slug: data.slug, 123 | category: data.category, 124 | matches: matches 125 | }; 126 | }).filter(function (data) { 127 | return data.matches > 0; 128 | }).sort(function (a, b) { 129 | return b.matches - a.matches; 130 | }); 131 | 132 | resultsEl.innerHTML = results.map(function (result) { 133 | return '
  • ' + result.title + (result.type === 'blog' ? ' (blog)' : '') + '
  • '; 134 | }).join(''); 135 | 136 | resultsEl.hidden = false; 137 | } 138 | 139 | function throttle(fn, delay) { 140 | var throttled = function () { 141 | var context = this, args = arguments; 142 | throttled.cancel(); 143 | throttled.timer = setTimeout(function () { 144 | fn.apply(context, args); 145 | }, delay); 146 | }; 147 | 148 | throttled.cancel = function () { 149 | clearTimeout(throttled.timer); 150 | }; 151 | 152 | return throttled; 153 | } 154 | 155 | })(); 156 | -------------------------------------------------------------------------------- /static/js/xhr.js: -------------------------------------------------------------------------------- 1 | function request(type, url, opts, callback) { 2 | 'use strict'; 3 | var xhr = new XMLHttpRequest(), 4 | fd; 5 | 6 | if (typeof opts === 'function') { 7 | callback = opts; 8 | opts = null; 9 | } 10 | 11 | xhr.open(type, url); 12 | 13 | if (opts) { 14 | fd = new FormData(); 15 | 16 | for (var key in opts) { 17 | fd.append(key, JSON.stringify(opts[key])); 18 | } 19 | } 20 | 21 | xhr.onload = function () { 22 | callback(null, JSON.parse(xhr.response)); 23 | }; 24 | 25 | xhr.onerror = function () { 26 | callback(new Error('XHR failed')); 27 | } 28 | 29 | xhr.send(opts ? fd : null); 30 | } 31 | 32 | var get = request.bind(this, 'GET'); 33 | var post = request.bind(this, 'POST'); 34 | --------------------------------------------------------------------------------