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
{ | |
"name": "BamPowLabs", | |
"version": "0.0.1", | |
"private": true, | |
"dependencies": { | |
"express": "2.5.5", | |
"coffeekup": ">= 0.0.1", | |
"less": ">= 0.0.1", | |
"coffee-script": ">= 0.0.1", | |
"now": ">= 0.0.1", |
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
mixin = (Klass, Mixin) -> | |
# Class methods | |
Klass[key] = val for key, val of Mixin | |
# Instance methods | |
Klass::[key] = val for key, val of Mixin.prototype | |
class Mixin | |
@fn: -> alert "class fn" | |
fn: -> alert "instance fn" |
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
class Mixin | |
@mixin: (Klass)-> | |
# Class methods | |
Klass[key] = val for key, val of @ when key != 'mixin' | |
# Instance methods | |
Klass::[key] = val for key, val of @prototype | |
class Extra extends Mixin | |
@fn: -> alert 'class fn called' | |
fn: -> alert 'instance fn called' |
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
let x=1 | |
# Repeat this command as much as wanted | |
let x++ && git diff HEAD~$x HEAD~$[x + 1] |
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
#!/usr/bin/env ruby | |
site 'http://community.opscode.com/api/v1' | |
cookbook 'sprout-rbenv', | |
:github => 'pivotal-sprout/sprout-rbenv' | |
cookbook 'sprout-ruby', | |
:github => 'pivotal-sprout/sprout-ruby' |
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
module Profiling | |
class CallStackTracker | |
cattr_accessor :query_call_stacks do | |
[] | |
end | |
IGNORED_SQL = [/^PRAGMA (?!(table_info))/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/, /^SELECT @@ROWCOUNT/, /^SAVEPOINT/, /^ROLLBACK TO SAVEPOINT/, /^RELEASE SAVEPOINT/, /^SHOW max_identifier_length/] | |
def call(name, start, finish, message_id, values) | |
# FIXME: this seems bad. we should probably have a better way to indicate | |
# the query was cached | |
unless 'CACHE' == values[:name] |
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
module Profiling | |
class CallStackTracker | |
cattr_accessor :query_call_stacks do | |
[] | |
end | |
IGNORED_SQL = [/^PRAGMA (?!(table_info))/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/, /^SELECT @@ROWCOUNT/, /^SAVEPOINT/, /^ROLLBACK TO SAVEPOINT/, /^RELEASE SAVEPOINT/, /^SHOW max_identifier_length/] | |
def call(name, start, finish, message_id, values) | |
# FIXME: this seems bad. we should probably have a better way to indicate | |
# the query was cached | |
unless 'CACHE' == values[:name] |
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
module Profiler | |
self.singleton_class.instance_eval do | |
attr_accessor :defaults | |
end | |
self.defaults = { | |
open: true, | |
path: 'tmp', | |
name: 'profile' | |
} | |
def self.profile options = {}, &block |
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
module Profiler | |
self.singleton_class.instance_eval do | |
attr_accessor :defaults | |
end | |
self.defaults = { | |
open: true, | |
path: 'tmp', | |
name: 'profile' | |
} | |
def self.profile options = {}, &block |
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
class ActiveRecord::Base | |
descendants.each do |klass| | |
klass.singleton_class.instance_eval do | |
attr_accessor :touches, :touched_by | |
end | |
klass.touches = [] | |
klass.touched_by = [] | |
klass.reflections.values.each do |reflection| | |
if reflection.options && reflection.options[:touch] |
OlderNewer