Skip to content

Instantly share code, notes, and snippets.

View damon's full-sized avatar

Damon Clinkscales damon

View GitHub Profile
@damon
damon / irb utilities
Created February 20, 2012 20:06
add these lines to .irbrc for some extra fun
class Object
def ml(*m)
methods.grep(/(#{m.join("|")})/)
end
end
@damon
damon / nr_query_analyzer.rb
Created January 20, 2011 21:11
takes a paste of query statements from New Relic and explains all of them ; also converts UPDATEs and DELETEs now
#!/usr/bin/env ruby
puts "NR Bulk Query Explainer"
puts "make sure to adjust the mysql command line in the script to your local setup"
puts "Paste your SQL Statements Trace from New Relic and ~ and RETURN to submit."
cli = "mysql -uroot notes_from_scratch -e "
strings,queries = [],[]
while (s=gets)!="~\n"
strings << s
end
@damon
damon / Gemfile
Created August 17, 2010 15:28 — forked from pengwynn/Gemfile
source :rubygems
gem 'sinatra', '1.0'
gem 'gowalla', '~> 0.2.0'
group :development do
gem 'shotgun'
end
$ nslookup streak.ly
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
Name: streak.ly
Address: 97.107.132.203
$ nslookup 97.107.132.203
Server: 192.168.1.1
javascript:document.querySelector("meta[name='viewport']").setAttribute("content", "width=device-width; initial-scale=1.0; maximum-scale=5.0; user-scalable=1;");
@damon
damon / top_interactors.rb
Created July 11, 2010 04:27
who do I interact with most on Twitter?
#!/usr/bin/env ruby
require 'rubygems'
require 'grackle'
require 'pp'
STATUSES_MAX = 200
PAGE_MAX = 5
client = Grackle::Client.new
require "time"
class BusinessHours
DAYS = [:sun, :mon, :tue, :wed, :thu, :fri, :sat]
def initialize(opening, closing)
@schedule = { :default => [opening, closing] }
end
def update(day, opening, closing)
@damon
damon / .irbrc
Created June 23, 2010 01:45
a couple of Object hacks in my .irbrc
class Object
def dbpeek
ActiveRecord::Base.connection.tables
end
def tblpeek(tbl=nil)
ActiveRecord::Base.connection.columns(tbl).each do |c|
puts "#{c.name}|#{c.type}|#{c.limit}"
end if tbl
nil

Question: Who are the angels who have funded Austin companies?

Crunchbase Query : Company search within 25 miles of Austin who had Angel funding of some kind. Then, collect who were the angels?

Companies:

Minggl (no angel names listed)
OtherInbox
MobiTX (no angel names listed)
Fancorps

#!/usr/bin/env ruby
require 'rubygems'
require 'json'
require 'httparty'
require 'active_support'
# How to use this quick-and-dirty CrunchBase search script
# You'll need Ruby, Rubygems, and a few gems
# $ sudo gem install json