Skip to content

Instantly share code, notes, and snippets.

(define minimize-interval-list
(lambda (ls)
(if (null? ls)
'()
(if (equal? (length ls) 1)
ls
(if (interval-intersects? (car ls) (cadr ls))
(minimize-interval-list (append (interval-union (car ls) (cadr ls)) (cddr ls)))
(cons (car ls) (minimize-interval-list (cdr ls))))))))
board = ["m", "w", "e", "t", "p", "e", "q", "i", "x", "a", "h", "v", "f", "f", "y", "j", "n", "l", "j", "h", "w", "c", "e", "s", "r"]
all_words = File.open('/usr/share/dict/words').readlines.map! { |line| line.strip.chomp }
valid_words = all_words.reject { |w| w =~ /[^#{board.join}]/ }
valid_words = valid_words.select do |w|
bool = true
bool = false if w.size <= 2
split_word = w.downcase.split('')
6 (defn everyo
7 "A pseudo-relation that takes a coll and ensures that the goal g
8 succeeds on every element of the collection."
9 [g coll]
10 (if (seq coll)
11 (all
12 (g (first coll))
13 (everyo g (next coll)))
14 s#))
15
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
@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("@")
class Redis
module Connection
class Logging < Redis::Connection::Ruby
def initialize(*args)
@command_queue = []
super
end
def write(*args)
@command_queue << [args, Time.now]
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
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
[["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"
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
=> {}