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 Kernel | |
def the(a, b) | |
a.new(b) | |
end | |
def roof | |
Exception | |
end | |
def yo! |
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
// jQuery.fn.or | |
// | |
// $('.dont-exist').or('.does-exist') //=> [.does-exist]; | |
// $('.does-exist').or('.dont-exist') //=> [.does-exist]; | |
$.fn.extend({ | |
or: function(selector, context) { | |
if ($(this).length > 0) { | |
return $(this); | |
} else { |
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
# Just drop this little diddy in your app to get some (not perfect) information on query times and such | |
# This will eventually become an official plugin but for those who can't wait, enjoy. | |
if defined?(NewRelic) | |
module MMNewRelicTracing | |
def self.included(model) | |
model.metaclass.class_eval do | |
add_method_tracer :find, 'Database/#{self.name}/find' | |
add_method_tracer :find!, 'Database/#{self.name}/find!' | |
add_method_tracer :paginate, 'Database/#{self.name}/paginate' | |
add_method_tracer :first, 'Database/#{self.name}/first' |
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
// easy refresh-css keybinding to alt-w | |
// alt-r was taken in IE, so consider this a CSS Weefresh | |
// original code from http://paulirish.com/2008/how-to-iterate-quickly-when-debugging-css/ | |
$(document).keyup(function(e){ | |
if (e.which == 87 && e.altKey) { | |
$('link').each(function() { | |
if((/stylesheet/i).test(this.rel) && this.href) { | |
var href = this.href.replace(/(&|\?)forceReload=\d+/,''); | |
this.href = href + ((/\?/).test(href) ? '&' : '?' ) + 'forceReload=' + new Date; |
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
# Bash snippet to open new shells in most recently visited dir. | |
# Useful if you want to open a new terminal tab at the present | |
# tab's location. | |
# | |
# Put this in your .bashrc or whatever. | |
pathed_cd () { | |
if [ "$1" == "" ]; then | |
cd | |
else |