Skip to content

Instantly share code, notes, and snippets.

@jnunemaker
jnunemaker / gist:142568
Created July 8, 2009 04:00
Recently added to mongomapper readme. Has really improved pull requests when compared to projects without the note.
= Note on Patches/Pull Requests
* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don’t break it in a
future version unintentionally.
* Commit, do not mess with rakefile, version, or history.
(if you want to have your own version, that is fine but
bump version in a commit by itself I can ignore when I pull)
* Send me a pull request. Bonus points for topic branches.

HOWTO: iPhone AT&T Tethering

In 10 steps:

  • Update iTunes to 8.2 via Software Update
  • Update your iPhone to the 3.0 release (out today - June 17th)
  • Download this dmg and mount it: tethering file
  • Enable hidden carrier testing option (in Terminal.app): defaults write com.apple.iTunes carrier-testing -bool TRUE
  • Start up iTunes
@jnunemaker
jnunemaker / lighter.rb
Created June 17, 2009 15:47 — forked from macournoyer/lighter.rb
Campfire from the command line
# Lighter -- Campfire from the command line
# usage: ruby lighter.rb subdomain "Main Room" macournoyer@gmail
require "rubygems"
require "tinder"
require "readline"
require "highline/import"
class Lighter
def initialize(room)
@room = room
@jnunemaker
jnunemaker / instructions.txt
Created June 5, 2009 18:06
How to open a clone of the current tab in terminal with a simple command
1) Put terminal_clone_tab.sh somewhere in
your path and make sure it is executable
chmod u+x terminal_clone_tab.sh
2) Then add the following alias (~/.bash_profile or something)
alias nt='terminal_clone_tab.sh'
3) Then you can hit nt (for new tab) anywhere
and a new tab will open up in same directory.
If there is an easier way to do this, let me know [email protected].
require 'rubygems'
data = open(ARGV[0]).read
data.gsub!(/^require.*/, '')
data.gsub!(/describe\s/, 'context ')
data.gsub!(/it\s(\"|\')should\s?/, 'should \1')
data.gsub!('before(:each)', 'setup')
data.gsub!('before', 'setup')
data.gsub!('be_nil', 'be(nil)')
data.gsub!('be_true', 'be(true)')
data.gsub!('be_false', 'be(false)')
@jnunemaker
jnunemaker / .gitignore
Created April 7, 2009 02:29
Rails template for starting apps
testapp
@jnunemaker
jnunemaker / test_helper.rb
Created March 24, 2009 19:33
Rails test_helper with jnunemaker's matchy and a few handy custom matchers
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
gem 'jnunemaker-matchy', '>= 0.4.0'
require 'matchy'
class ActiveSupport::TestCase
self.use_transactional_fixtures = true
self.use_instantiated_fixtures = false
# Quick wrapper for undocumented and unsupported MyMileMarker.com API
require 'rubygems'
gem 'httparty', '>= 0.3.1'
require 'httparty'
module MyMileMarker
class Client
include HTTParty
# more examples here: http://blog.codefront.net/2008/01/14/retrying-code-blocks-in-ruby-on-exceptions-whatever/
begin
retryable( :tries => 2 ) do
Timeout::timeout(5) do |t|
xml_string = open( my_url, "User-Agent" => "Firefox/2.0" ).read
end
end
rescue Timeout::Error
require 'rubygems'
require 'httparty'
require 'time'
require 'active_support'
File.read("#{ENV['HOME']}/.gitconfig").match(/token = (\w+)/)
TOKEN = $1
class Github
include HTTParty