Skip to content

Instantly share code, notes, and snippets.

require 'rspec'
class Foo
def initialize(list); @list = list; end
def method_missing(*args)
@list << args.first
end
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 = ''
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
1.9.2p290 :001 > a = Hash.new([])
=> {}
1.9.2p290 :002 > a[:b] << 1
=> [1]
1.9.2p290 :003 > a
=> {}
1.9.2p290 :004 > a[:b] << 2
=> [1, 2]
1.9.2p290 :005 > a
=> {}
[["11d8e0996530160f72bf0609d645195d7e849fc6", 2], ["2a345cd4864116505fd5e6fa7e02aa634b234942", 3], ["dc779ff60e149c4884a6d0247722838ebc624d0b", 1], ["af6db95082d6ff6a5a2d6b859a7d2ea18b754bdf", 1], ["a5ecf05c4b554e1f6d1fc295ca1cbad46241675b", 1], ["906179b7f02823430fc169ef4092721a82cd8698", 1], ["92d2f83d9edf43f802b13c3857c4f748fc986d28", 4], ["0bca11e685bc44b7fbc761a7c429b70ebd42defd", 2], ["c031b5b54b98146dd782f0529dd746bd34ef054a", 2], ["c1e7c2c82a6db7792a4aee6d2d0d1922c876d4bc", 2], ["82f2b00e240f23c2a7365f17b861417b695b65e7", 2], ["dd600e2c53176f55be924baa407f604897f90313", 2], ["f19ed982ecf5c2013be634e68765cd579512c3d0", 2], ["2364e48e8b9a58aed10e21416dd2a823ec71460c", 4], ["98bed3e3fa5630d6149051b36c3fb7300f456418", 2], ["f11b77447745b87692cf1d5fd163e53209e44b80", 1], ["e17e8b18d58b57f0bfbe522f234c5ecec1b84b37", 1], ["d32972577af0a2d93bbeb26a235b666857b4d2bd", 1], ["339349dc5d0d2a0130f43bc39c4e23103dbb7c6a", 1], ["dcec6924e7a7a5bc8dd4b069164464df813a9806", 1], ["5fde7cf94fd4e95ccb792f42eea3f092f1c6c5fb"
Great deal 2 Bd/1 Bath, Hwdflrs, Maple Cabinets, Granite, SS Applian (Chicago) $1515 2bd => 25
Great deal Hardwood Floors/Heat-Water-Cooking Gas Incl/Rooftop Sunde (Chicago) $1415 1bd => 15
Large 3 Bed in Prime Lincoln park $1,650 DUPLEX (Chicago - Lincoln Park) $1650 3bd => 16
Small super nice 2BR1BA w/ deck,central heat/AC,dishwasher. (Lincoln Park) $1450 2bd => 14
Very nice 3BR1BA available for immediate move in. (Lakeview) $1900 3bd => 12
Motivated landlords**. --Deal of the Day-- 24HR Doorman to Welcome Y (Chicago) $1420 1bd => 16
Motivated landlords**. --Deal of the Day-- This two bedroom, one bat (Chicago) $1625 2bd => 16
PAST CATCH UP WITH YOU? (CRAZYSTEVECHICAGO.COM GETS U APPROVED) $1704 2bd => 6
JUNE 1ST Vintage 2BR2BA duplex with heat/water/gas included! (Lakeview) $1425 2bd => 13
2BR1BA w/ deck,central heat/AC,dishwasher,HWF.JULY 1! (Lincoln Park) $1450 2bd => 14
Two Bedroom in Lincoln Park (Lincoln Park) $1845 2bd => http://chicago.craigslist.org/chc/apa/3008755317.html => 11
Great 1 Bed Old Town location in the center of dining and nightlife. (Old Town Chicago) $1825 1bd => http://chicago.craigslist.org/chc/apa/3008690924.html => 14
Entire 2 Story Coach House w/ Deck/Newer Kitchen/Walk IN Closet! (Lakeview) $1350 1bd => http://chicago.craigslist.org/chc/apa/3008752800.html => 7
Large 3 Bed in Prime Lincoln park $1,650 DUPLEX (Chicago - Lincoln Park) $1650 3bd => http://chicago.craigslist.org/chc/apa/3008680802.html => 21
Great deal 2 Bd/1 Bath, Hwdflrs, Maple Cabinets, Granite, SS Applian (Chicago) $1515 2bd => http://chicago.craigslist.org/chc/apa/3008736526.html => 25
Great deal Hardwood Floors/Heat-Water-Cooking Gas Incl/Rooftop Sunde (Chicago) $1415 1bd => http://chicago.craigslist.org/chc/apa/3008735841.html => 15
Small super nice 2BR1BA w/ deck,central heat/AC,dishwasher. (Lincoln Park) $1450 2bd => http://chicago.craigslist.org/chc/apa/3008718400.html => 14
class Redis
module Connection
class Logging < Redis::Connection::Ruby
def initialize(*args)
@command_queue = []
super
end
def write(*args)
@command_queue << [args, Time.now]
@dpick
dpick / gist:3200431
Created July 29, 2012 17:31
Mountain Lion Gmail Notifications
#! /usr/bin/ruby
require 'net/https'
def previous_count_location
Dir.mkdir('/Users/davidpick/.gmail_notifier') unless File.directory?('/Users/davidpick/.gmail_notifier')
'/Users/davidpick/.gmail_notifier'
end
def baseurl_for(name)
account_domain = name.split("@")
RSpec.configure do |config|
config.around(:each) do |example|
if ENV['iphone']
#set some stuff
else
# set some other stuff
end
example.run
end
end