Skip to content

Instantly share code, notes, and snippets.

@daveyeu
daveyeu / gist:1884
Created July 23, 2008 20:10 — forked from mnutt/gist:1881
hi there
likewise
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
require "activeresource"
require "active_resource/http_mock"
require "ruby-debug"
class RemotePerson < ActiveResource::Base
self.site = "http://localhost:3000"
self.element_name = "person"
end
#!/usr/bin/env ruby
require "pp"
DICTIONARY_PATH = "/usr/share/dict/words"
if ARGV.empty?
puts "Usage: ruby t9-lookup.rb 12345 [max_length]"
exit 1
end
require "highline"
# Allows Autotest scope to be set on the fly
#
# This owes a lot to the original autotest/menu.rb and David Chelimsky's post
# on scoping Autotest:
# http://blog.davidchelimsky.net/articles/2008/03/05/limiting-scope-of-autotest
#
# ^C will now bring up a menu, with some self-explanatory choices and a
# "Re-scope" option. Choosing that prompts for a new scope. Some magic words
class Tumblr
class << self
def email
credentials["email"]
end
def password
credentials["password"]
end
#!/usr/bin/env ruby
require "rubygems"
require "eventmachine"
$search_terms = ARGV
if $search_terms.empty?
puts "Hey now, add some search terms for your buckets."
exit 1
end
@daveyeu
daveyeu / gist:2893119
Created June 8, 2012 02:24
Short PWD
#
# Spit out a shortened working directory
#
# I tried out the fish shell (http://ridiculousfish.com/shell/) recently
# after it showed up on Hacker News, and the part I really liked was the
# shortened working directory on the prompt:
#
# dave@lew ~/w/g/transport>
#
# Here's a first cut at making it work for bash.
@daveyeu
daveyeu / gist:4960893
Created February 15, 2013 15:04
Displays accurate request queue times for New Relic on Heroku Cedar
# Accurate queue times for Heroku Cedar + Rails (or Rack)
#
# For Rails:
#
# Rails::Application.middleware.insert(0, QueueTimeLogger)
#
class QueueTimeLogger
attr_reader :app
def initialize(app, options = {})
@daveyeu
daveyeu / getit.rb
Created November 18, 2013 14:42
Fetch GroupMe chat history
require "yajl"
GROUP_ID = ENV["GROUP_ID"]
TOKEN = ENV["TOKEN"]
file = File.open("Group-#{GROUP_ID}.txt", "w")
query_string = ""
results = []
loop do