Skip to content

Instantly share code, notes, and snippets.

View btaitelb's full-sized avatar

Ben Taitelbaum btaitelb

View GitHub Profile
#!/usr/bin/env expect
set timeout 5
spawn meteor login
expect "Username:" { send "$env(METEOR_USERNAME)\r" }
expect "Password:" { send "$env(METEOR_PASSWORD)\r" }
module Cacheable
def self.extended(base)
@@unaliased_methods = {}
@@cacheable_methods = Module.new
end
def method_added(m)
if @@unaliased_methods[m]
cache_method(m)
@btaitelb
btaitelb / github_light.user.js
Created February 11, 2017 00:15
make github light again
/* 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]
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
require './animal'
class Panda < Animal
def initialize
super(2)
puts "Panda#initialize"
end
def speak
module DiceGame
def roll
die1 = rand(1..6)
die2 = rand(1..6)
@rolls ||= []
@rolls << die1+die2
end
def last_roll
require './dice_game'
class WaitFor7
include DiceGame
def winner?
last_roll == 7
end
end
require './dice_game'
class WaitForOdds
include DiceGame
def winner?
@rolls ||= []
if @rolls.size >= 3
@rolls[-3..-1].all?{|r| r % 2 == 1}
else
module Omnomnivore
def omnomname(name_extension)
define_method "name" do
@name + name_extension
end
end
end
##
# Usage: