Skip to content

Instantly share code, notes, and snippets.

View reidab's full-sized avatar
🚠

Reid Beels reidab

🚠
View GitHub Profile
@reidab
reidab / tab.sh
Created January 3, 2009 01:27
A simple bash/applescript combo to open a new terminal tab in the current directory.
#!/bin/bash
osascript \
-e 'tell application "Terminal" to activate' \
-e 'tell application "System Events" to tell process "Terminal"' \
-e 'keystroke "t" using command down' \
-e "keystroke \"cd `pwd`\nclear\n\"" \
-e 'end tell'
# I'm typing out the cd command using system events because I use visor and it doesn't play nicely with window IDs
# if you're not using visor, you should be able to get away with using
class Eggplant
def initialize
@eaten = false
end
def eat
if @eaten
puts "You have already eaten this."
else
puts "OM NOM NOM."
@reidab
reidab / import_imap_registrations.rb
Created April 19, 2009 05:40
Parses new registration emails for Open Source Bridge and adds attendees to a Campaign Monitor list
require 'net/imap'
require 'rubygems'
require 'hpricot'
require 'yaml'
require 'campaign_monitor'
require 'facets/enumerable/mash'
require 'facets/file/write'
CAMPAIGN_MONITOR_API_KEY = ''
@reidab
reidab / gist:98009
Created April 19, 2009 10:12
Exports issues from a Google Code project.
require 'open-uri'
require 'csv'
require 'rubygems'
require 'hpricot'
module GoogleCode
class IssueReader
DEBUG = true
CSV_COLUMNS = %w(ID Type Component Status Priority Summary Modified Milestone Owner Stars Opened Closed BlockedOn Blocking Blocked MergedInto Reporter Cc)
@reidab
reidab / require_fight.rb
Created May 4, 2009 04:25
Popularity contest for things being required in ruby code (and gems being config'd in rails projects)
require 'rubygems'
require 'hpricot'
require 'open-uri'
required_things = Hash.new(0)
['require','config.gem'].each do |require_type|
counter = 1
while counter < 1000 do
require 'rubygems'
require 'hpricot'
require 'open-uri'
require 'facets/kernel/ergo'
require 'facets/dictionary'
require 'facets/file/write'
require 'peach'
required_things = Hash.new(0)
@reidab
reidab / gist:106323
Created May 4, 2009 05:31
Initial data on which ruby modules are being used most by the community.
111896 statements parsed.
Skipped 130930 results in vendor paths.
8305: rubygems
4707: test/unit*
3542: test_helper
3176: abstract_unit
2010: spec
1800: fileutils*
1715: pathname*
[core]
excludesfile = /Users/reidab/.gitignore
[apply]
whitespace = fix
[help]
autocorrect = -1
[instaweb]
httpd = webrick
[merge]
tool = opendiff
#!/bin/bash
# Use git bisect to find out when rspec started failing.
script/spec | grep "0 failure"
class SentenceSplitter
EOS = "\001" ## END OF SENTENCE
P = /[\.!?]/ ## PUNCTUATION
AP = /(?:'|"|»|\)|\]|\})?/ ## AFTER PUNCTUATION
PAP = /#{P}#{AP}/
PEOPLE = [ 'jr', 'mr', 'mrs', 'ms', 'dr', 'prof', 'sr', "sens?", "reps?", 'gov', "attys?", 'supt', 'det', 'rev' ]
ARMY = [ 'col','gen', 'lt', 'cmdr', 'adm', 'capt', 'sgt', 'cpl', 'maj' ]
INSTITUTES = [ 'dept', 'univ', 'assn', 'bros' ]
COMPANIES = [ 'inc', 'ltd', 'co', 'corp' ]