Skip to content

Instantly share code, notes, and snippets.

View feross's full-sized avatar
🐢
For urgent issues, send me an email

Feross Aboukhadijeh feross

🐢
For urgent issues, send me an email
View GitHub Profile
@feross
feross / gist:4396663
Created December 28, 2012 10:23
Text shadow with conditional IE support for Stylus Looks terrible in IE, and may have bugs.
/*
* 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()
// 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",
@feross
feross / gist:1936829
Created February 29, 2012 01:32
typeracer.com cheat js
// 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.
@feross
feross / gist:1936676
Created February 29, 2012 01:00
memoizer.js
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;
$.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
});