Skip to content

Instantly share code, notes, and snippets.

Living on a sailboat

Brandon Keepers bkeepers

Living on a sailboat
View GitHub Profile
View party.rb
module Kernel
def the(a, b)
def roof
def yo!
View jquery.or.js
// jQuery.fn.or
// $('.dont-exist').or('.does-exist') //=> [.does-exist];
// $('.does-exist').or('.dont-exist') //=> [.does-exist];
or: function(selector, context) {
if ($(this).length > 0) {
return $(this);
} else {
View mongo_mapper_new_relic.rb
# 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/#{}/find'
add_method_tracer :find!, 'Database/#{}/find!'
add_method_tracer :paginate, 'Database/#{}/paginate'
add_method_tracer :first, 'Database/#{}/first'
View gist:223062
// easy refresh-css keybinding to alt-w
// alt-r was taken in IE, so consider this a CSS Weefresh
// original code from
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;
bkeepers / gist:132611
Created Jun 19, 2009 — forked from defunkt/gist:132456
open new shells in the most recently visited directory
View gist:132611
# 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