Skip to content

Instantly share code, notes, and snippets.

.disabled div
&, & *
:opacity .5
/* turns into */
.disabled div {}
.disabled div, disabled div * {
opacity: .5;
}
function bind_input_listeners(options) {
with(options) {
classes_input
.keybind('.', new_class)
.keybind(',', new_class)
.keybind('space', new_class);
}
end
{'element': {
'attrs': {'attribute':{/*another damned document*/}},
'contents': [{
'more_shit':{}
}]
}}
$('.zipcode').whitelist(/\d/);
$('.state').whitelist(/[A-Z]/);
$('.plain').blacklist(/[!.,<>();:-_]/);
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
,to_haml: function() {
var _this = _(this)
,attrs = _this.children();
if(!attrs.length) return '';
return '{'
+ attrs.map(function(){
var __this = _(this)
return '"'
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
var the = 'part of speech';
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);
Function.prototype.take = function(n) {
var arry = [];
while(n--) {arry.push(this(n));}
return arry.reverse();
}
function echo(item) { return item; }
//
echo.take(5);