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
.disabled div | |
&, & * | |
:opacity .5 | |
/* turns into */ | |
.disabled div {} | |
.disabled div, disabled div * { | |
opacity: .5; | |
} |
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
function bind_input_listeners(options) { | |
with(options) { | |
classes_input | |
.keybind('.', new_class) | |
.keybind(',', new_class) | |
.keybind('space', new_class); | |
} | |
end |
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
{'element': { | |
'attrs': {'attribute':{/*another damned document*/}}, | |
'contents': [{ | |
'more_shit':{} | |
}] | |
}} |
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
$('.zipcode').whitelist(/\d/); | |
$('.state').whitelist(/[A-Z]/); | |
$('.plain').blacklist(/[!.,<>();:-_]/); |
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
class Object | |
def collapse | |
memcache.store :key => object_id, :value => ENV["HOST_NAME"] | |
end | |
def persist | |
database.insert object_id, Marshall.dump(self) | |
end | |
end |
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
,to_haml: function() { | |
var _this = _(this) | |
,attrs = _this.children(); | |
if(!attrs.length) return ''; | |
return '{' | |
+ attrs.map(function(){ | |
var __this = _(this) | |
return '"' |
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
class FriendMigration < ActiveRecord::Migration | |
def self.up | |
create_table :friends do |t| | |
t.string :name, :null => false | |
t.string :email, :null => false, :unique => true | |
t.boolean :admin, :default => false | |
t.string :crypted_password | |
t.timestamps | |
end | |
end |
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 the = 'part of speech'; |
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
function pass() { console.count('pass'); } | |
function fail(expr, msg) { | |
console.count('fail') | |
console.warn((msg||'')+'expected true got', expr); | |
} | |
function assert(expr, msg) { | |
try { | |
var result = expr(); | |
if(result) pass(); | |
else fail(result, msg); |
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
Function.prototype.take = function(n) { | |
var arry = []; | |
while(n--) {arry.push(this(n));} | |
return arry.reverse(); | |
} | |
function echo(item) { return item; } | |
// | |
echo.take(5); |