Skip to content

Instantly share code, notes, and snippets.

View a-bash's full-sized avatar

Andy Bashelor a-bash

View GitHub Profile
class Fixnum
def seconds
self
end
def minutes
self * 60
end
def hours
@natritmeyer
natritmeyer / bring_browser_to_front.rb
Created April 20, 2012 10:16
Example ruby/applescript combo that brings browsers to the front - useful in browser test automation...
#you probably only need one of these, but here's the lot of them...
#prepare the commands that will bring the various browsers to the front
bring_chrome_to_front = %Q{ osascript -e "tell application \\\"Google Chrome\\\" to activate" }
bring_firefox_to_front = %Q{ osascript -e "tell application \\\"Firefox\\\" to activate" }
#execute the applescript commands to bring the browsers to the front
`#{bring_chrome_to_front}`
`#{bring_firefox_to_front}`
@genos
genos / shamir_threshold.hs
Created October 25, 2011 17:46
Shamir Threshold: Haskell
{- shamir_threshold_scheme.hs
-
- My Haskell implementation of Shamir's (k, n) Threshold scheme.
- GRE, 6/23/11
-}
import Data.Bits (shiftR, testBit)
import Data.List (foldl', nub)
import Random (mkStdGen, randomRs)
@dhh
dhh / gist:1014971
Created June 8, 2011 18:09
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end