This file contains 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
# the entire concept of building a dsl means defining domain terms on an | |
# object, it's so much simpler to start with the dsl itself being a blank | |
# slate that simply relays certain methods to a scope | |
# | |
class DSL | |
instance_methods.each do |m| | |
undef_method m unless m[%r/\A__|\Aobject_id\Z/] | |
end |
This file contains 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
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains 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
$stack, $draws = [], {} | |
def method_missing *args | |
return if args[0][/^to_/] | |
$stack << args.map { |a| a or $stack.pop } | |
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :< | |
end | |
class Array | |
def +@ |
This file contains 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(Fp, Ap) { | |
var applyMethod = Fp.apply, | |
bindMethod = Fp.bind, | |
callMethod = Fp.call; | |
var sliceMethod = Ap.slice, | |
concatMethod = Ap.concat; | |
var apply = callMethod.bind(applyMethod), | |
bind = callMethod.bind(bindMethod), |
This file contains 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
Object.beget = (function() { | |
var create = Object.create, | |
defineProperty = Object.defineProperty; | |
// see https://gist.github.com/3194222 | |
var hasOwn = Object.prototype.hasOwnProperty.unselfish(); | |
return function beget(proto, own) { | |
var result = create(proto); |
This file contains 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.unselfish = (function(Fp, Ap) { | |
var applyMethod = Fp.apply, | |
callMethod = Fp.call; | |
var apply = callMethod.bind(applyMethod), | |
call = callMethod.bind(callMethod); | |
var sliceMethod = Ap.slice; | |
return function unselfish() { |
This file contains 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() { | |
var hasOwnProperty = Object.prototype.hasOwnProperty; | |
var Function = hasOwnProperty.constructor; | |
function isIdentifier(s) { | |
return /[a-zA-Z_$][a-zA-Z_$0-9]*/.test(s); | |
} |
This file contains 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
#from http://tmblr.co/ZfQknxFg4-sp | |
git ls-files -d | xargs git rm |
This file contains 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
#hat tip: http://stuartsierra.com/2008/01/08/testing-named-routes-in-the-rails-console | |
include ActionController::UrlWriter | |
default_url_options[:host] = 'whatever' |
This file contains 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
.bling { color: golden; border: 1px solid sparkle; } |
NewerOlder