Skip to content

Instantly share code, notes, and snippets.

View trshafer's full-sized avatar

Thomas Shafer trshafer

View GitHub Profile
@trshafer
trshafer / jira_edit_links.js
Created May 8, 2012 22:18
Jira Edit Links
@trshafer
trshafer / How to use
Created May 8, 2012 01:31
Loops songs on beatport.com
In Chrome:
Visit Adam Cobb's Beatport.com remix.
Open the menu "View"
Hover over "Developer"
Click "JavaScript Console"
You'll be presented with a strange window and a blinking cursor. Paste that code in the previous file (replay.js) and press Enter. The song will now continue to loop. Every time you refresh the page follow those steps.
@trshafer
trshafer / gist:1896671
Created February 24, 2012 02:00
SSH to current host Bookmarklet
javascript:void(function()%7Bwindow.location.href=%22ssh://%22+window.location.href.match(/http:%5C/%5C/(%5B%5E:%5C/%5D+).+/)%5B1%5D%7D)();
@trshafer
trshafer / dangerous.rb
Created September 23, 2011 23:10
Module renaming methods dynamically
module Hey
def hi
puts "hi"
end
def sup &block
block.call
end
end
module One
def go
1
end
end
module Two
def go
2
end
@trshafer
trshafer / class_methods.rb
Created August 5, 2011 19:09
Dynamically overwrite methods
class Frog
def self.go
puts 45
end
end
Frog.go
module Whatever
@trshafer
trshafer / cryaboutit.rb
Created August 4, 2011 22:42
stubbing with rrr
require 'rubygems'
require 'rr'
extend RR::Adapters::RRMethods
module Something
def go
puts "going"
end
end
@trshafer
trshafer / gist:1081064
Created July 13, 2011 19:08
Module extension within module, post class inclusion
module FourToedFrontFeet
def number_of_toes
4
end
end
module Quadruped
include FourToedFrontFeet
def number_of_legs
4
@trshafer
trshafer / gist:1045464
Created June 24, 2011 19:17
Textmate defaults untitled files to ruby
defaults write com.macromates.textmate OakDefaultLanguage E00B62AC-6B1C-11D9-9B1F-000D93589AF6
@trshafer
trshafer / ternary_precedence.rb
Created June 3, 2011 18:57
Ternary Operation Precedence Gotcha
a = []
a << false ? "bad" : "awesome"
puts a.inspect # => [false]
a = []
a << (false ? "bad" : "awesome")
puts a.inspect # => ["awesome"]