http://mashable.com/2010/10/23/youtube-job/
http://mashable.com/2010/10/24/innovative-api-uses/
| $.when( $.getJSON('/some/data/'), $.get('template.tpl') ).then(function( data, tmpl ){ | |
| $( tmpl ) // create a jQuery object out of the template | |
| .tmpl( data) // compile it | |
| .appendTo( "#target" ); // insert it into the DOM | |
| }); |
| var count = 0; | |
| var memoizer = function(memo, formula) { | |
| var recur = function(n) { | |
| var result = memo[n]; | |
| if (typeof result !== "number") { | |
| result = formula(n); | |
| memo[n] = result; | |
| } | |
| return result; |
| // Feross Aboukhadijeh - Apr 12 2010 | |
| // | |
| // Script I hacked together to cheat on TypeRacer.com. You use it by waiting for the typing game | |
| // to start. Once it starts, open up Firebug, paste in this code, and run it. Now, just press | |
| // space to auto-type each word. I made the user push space, as opposed to advancing the words | |
| // automatically because I believe the site looks for a keypress event before evaluating the contents | |
| // of the input box. I could not figure out how to fake a user keypress event. Perhaps this is | |
| // disallowed for browser security reasons? | |
| // | |
| // Next todo: Site detects the unbelievable WPM and asks you to do a captcha test. |
| // See comments below. | |
| // This code sample and justification brought to you by | |
| // Isaac Z. Schlueter, aka isaacs | |
| // standard style | |
| var a = "ape", | |
| b = "bat", | |
| c = "cat", | |
| d = "dog", |
| /* | |
| * Text shadow with conditional IE support. | |
| * | |
| * Examples: | |
| * text-shadow: none | |
| * text-shadow: <color>? <offset-x> <offset-y> <blur-radius>? | |
| * text-shadow: <offset-x> <offset-y> <blur-radius>? <color>? | |
| */ | |
| // TODO: Convert color to hex | |
| text-shadow() |
| <!-- Respect Rollcall --> | |
| <li><a href="http://www.alistapart.com/articles/">A List Apart — for website builders</a></li> | |
| <li><a href="http://abstrusegoose.com/">Abstruse Goose — my favorite comic</a></li> | |
| <li><a href="http://al3x.net/">Alex Payne — technology rambling</a></li> | |
| <li><a href="http://dashes.com/anil/">Anil Dash — on culture, apple & design</a></li> | |
| <li><a href="http://weblogs.mozillazine.org/asa/">Asa Dotzler — on mozilla & software</a></li> | |
| <li><a href="http://www.azarask.in/blog/">Aza Raskin – on design & firefox</a></li> | |
| <li><a href="http://christophzillgens.com/en/">Christoph Zillgens — interface design</a></li> | |
| <li><a href="http://cssremix.com/">CSS Remix — gorgeous designs</a></li> | |
| <li><a href="http://css-tricks.com/">CSS Tricks</a></li> |
| /** | |
| * Given a filename for a static resource, returns the resource's absolute | |
| * URL. Supports file paths with or without origin/protocol. | |
| */ | |
| function toAbsoluteURL (url) { | |
| // Handle absolute URLs (with protocol-relative prefix) | |
| // Example: //domain.com/file.png | |
| if (url.search(/^\/\//) != -1) { | |
| return window.location.protocol + url | |
| } |
| /** | |
| * Make a JSONP request. Server must support JSONP with callback name specified as a GET | |
| * parameter with the name `callback`. Callback function will be called when data arrives. | |
| * If request times out, callback is called with an Error object. | |
| * @param {string} uri | |
| * @param {Object} params Object of url params. Gets transformed into ?key1=value1&key2=value2 | |
| * @param {function} cb | |
| */ | |
| exports.jsonp = function (uri, params, cb) { | |
| cb = once(cb) |