The Ember router is getting number of enhancements that will greatly enhance its power, reliability, predictability, and ability to handle asynchronous loading logic (so many abilities), particularly when used in conjunction with promises, though the API is friendly enough that a deep understanding of promises is not required for the simpler use cases.
- see https://gist.github.com/machty/5723945 for the latest API (unlikely to change from now on)
- latest Ember build: https://machty.s3.amazonaws.com/ember/ember-async-routing-10.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*! | |
| * jquery.addrule.js 0.0.2 - https://gist.github.com/yckart/5563717/ | |
| * Add css-rules to an existing stylesheet. | |
| * | |
| * @see http://stackoverflow.com/a/16507264/1250044 | |
| * | |
| * Copyright (c) 2013 Yannick Albert (http://yckart.com) | |
| * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php). | |
| * 2013/11/23 | |
| **/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var bases = require('bases'); | |
| var crypto = require('crypto'); | |
| // Returns a base-62 (alphanumeric only) string of the given length: | |
| function randomStr(length) { | |
| // We generate a random number in a space at least as big as 62^length, | |
| // and if it's too big, we just retry. This is still statistically O(1) | |
| // since repeated probabilities less than one converge to zero. Hat-tip to | |
| // a Google interview for teaching me this technique! ;) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| license: gpl-3.0 |
This gist assumes:
- you have a local git repo
- with an online remote repository (github / bitbucket etc)
- and a cloud server (Rackspace cloud / Amazon EC2 etc)
- your (PHP) scripts are served from /var/www/html/
- your webpages are executed by apache
- apache's home directory is /var/www/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var http = require('http'), | |
| fileSystem = require('fs'), | |
| path = require('path') | |
| util = require('util'); | |
| http.createServer(function(request, response) { | |
| var filePath = 'path_to_file.mp3'; | |
| var stat = fileSystem.statSync(filePath); | |
| response.writeHead(200, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .hll { background-color: #ffffcc } | |
| .c { color: #586E75 } /* Comment */ | |
| .err { color: #93A1A1 } /* Error */ | |
| .g { color: #93A1A1 } /* Generic */ | |
| .k { color: #859900 } /* Keyword */ | |
| .l { color: #93A1A1 } /* Literal */ | |
| .n { color: #93A1A1 } /* Name */ | |
| .o { color: #859900 } /* Operator */ | |
| .x { color: #CB4B16 } /* Other */ | |
| .p { color: #93A1A1 } /* Punctuation */ |