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 expect | |
set timeout 5 | |
spawn meteor login | |
expect "Username:" { send "$env(METEOR_USERNAME)\r" } | |
expect "Password:" { send "$env(METEOR_PASSWORD)\r" } |
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 Cacheable | |
def self.extended(base) | |
@@unaliased_methods = {} | |
@@cacheable_methods = Module.new | |
end | |
def method_added(m) | |
if @@unaliased_methods[m] | |
cache_method(m) |
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
/* Instructions | |
1. Open chrome://extensions | |
2. Drag this file into the chrome window | |
*/ | |
// ==UserScript== | |
// @match https://*.github.com/* | |
// ==/UserScript== | |
function fixHeader() { | |
el = document.getElementsByClassName("header-dark")[0] |
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 Animal | |
attr_reader :legs | |
attr_accessor :name | |
def initialize(legs = 4) | |
@legs = legs | |
puts "Animal#initialize in #{__FILE__}" | |
end | |
def self.classname_from_filename |
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
require './animal' | |
class Panda < Animal | |
def initialize | |
super(2) | |
puts "Panda#initialize" | |
end | |
def speak |
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 DiceGame | |
def roll | |
die1 = rand(1..6) | |
die2 = rand(1..6) | |
@rolls ||= [] | |
@rolls << die1+die2 | |
end | |
def last_roll |
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
require './dice_game' | |
class WaitFor7 | |
include DiceGame | |
def winner? | |
last_roll == 7 | |
end | |
end |
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
require './dice_game' | |
class WaitForOdds | |
include DiceGame | |
def winner? | |
@rolls ||= [] | |
if @rolls.size >= 3 | |
@rolls[-3..-1].all?{|r| r % 2 == 1} | |
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
module Omnomnivore | |
def omnomname(name_extension) | |
define_method "name" do | |
@name + name_extension | |
end | |
end | |
end | |
## | |
# Usage: |
OlderNewer