Skip to content

Instantly share code, notes, and snippets.

puts "Adding #{size = feed.entries.size} entries"
feed.entries.each { |entry| title_to_entries[entry.title] = entry }
start += size
end
ignored_phrases = ["View my other apartments", "American Realty Pros"]
title_to_entries.reject! do |title, entry|
ignored_phrases.any? { |phrase| entry.summary.include?(phrase) }
end
require 'rubygems'
require 'twitter'
require 'twilio-ruby'
last_tweet = Twitter.user_timeline("gglasstheatre").first.text
about_cascabel = last_tweet.include?("#Cascabel")
match = last_tweet.match(/(\d{3}-\d{3}-\d{4})/)
phone_number = match[0].gsub(/-/, '') if match
account_sid = ''
require 'rspec'
class Foo
def initialize(list); @list = list; end
def method_missing(*args)
@list << args.first
end
end
def bools(n)
generic(n) { rand > 0.5 }
end
def ints(n)
generic(n) { rand(0..10) }
end
def generic(n = rand * 10)
Enumerator.new do |yielder|
(fn compose [& funcs]
(fn [args]
(reduce (fn [x y] (x (y args))) funcs)))
board = [[nil, nil, nil], [nil, nil, nil], [nil, nil, nil]]
current_player = 'x'
def game_over?
false
end
def make_move(player, row, col)
board[row][col] = player
@dpick
dpick / gist:1699627
Created January 29, 2012 16:58 — forked from anonymous/gist:1699614
pooperz
require 'minitest/spec'
require 'minitest/autorun'
# Integer list generation
listOfInt = [1, 3, 5, 7, 9, 11]
left, right = 0, 1
top, bottom = 2, 3
require 'minitest/spec'
require 'minitest/autorun'
# Integer list generation
listOfInt = [1, 3, 5, 7, 9, 11]
left, right = 0, 1
top, bottom = 2, 3
def get_episode_information(filename)
show, season, episode_num = Parser.parse(filename)
puts "#{show} - S#{season} - E#{episode_num}"
@show = @tvdb.fetch_series_from_data(:title => show)
@show.episodes.each do |episode|
if episode.season_number.to_i == season && episode.episode_number.to_i == episode_num
@episode = episode
@episode[:episode_number] = "0" + @episode[:episode_number] if @episode[:episode_number].to_i < 10
break
#!/bin/sh
# Don't allow console.log() or 'and show me the page' statements to be committed.
console=`git diff --cached | grep -i 'console\.log' | wc -l`
showme=`git diff --cached | grep -i 'and show me the page' | wc -l`
echo "$console console.log() statments"
echo "$showme 'and show me the page' statements"
echo ""