Skip to content

Instantly share code, notes, and snippets.

John Nunemaker jnunemaker

Block or report user

Report or block jnunemaker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View my_mile_marker.rb
# Quick wrapper for undocumented and unsupported MyMileMarker.com API
require 'rubygems'
gem 'httparty', '>= 0.3.1'
require 'httparty'
module MyMileMarker
class Client
include HTTParty
@jnunemaker
jnunemaker / test_helper.rb
Created Mar 24, 2009
Rails test_helper with jnunemaker's matchy and a few handy custom matchers
View test_helper.rb
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
@jnunemaker
jnunemaker / .gitignore
Created Apr 7, 2009
Rails template for starting apps
View really_hackish_spec_to_shoulda.rb
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 / instructions.txt
Created Jun 5, 2009
How to open a clone of the current tab in terminal with a simple command
View instructions.txt
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 nunemaker@gmail.com.
@jnunemaker
jnunemaker / lighter.rb
Created Jun 17, 2009 — forked from macournoyer/lighter.rb
Campfire from the command line
View lighter.rb
# 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
View iphone-tethering.mdown

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 / gist:142568
Created Jul 8, 2009
Recently added to mongomapper readme. Has really improved pull requests when compared to projects without the note.
View gist:142568
= 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.
@jnunemaker
jnunemaker / .git-completion.sh
Created Jul 8, 2009
bash completion support for git
View .git-completion.sh
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
@jnunemaker
jnunemaker / errors.js
Created Jul 14, 2009
jQuery and Rails form errors
View errors.js
(function($) {
// errors is an array of errors
// render :json => {:errors => @item.errors.full_messages}
function FormErrors(errors) {
var self = this,
error_count = errors.length;
this.html = function() {
var html = '';
html += '<div class="errorExplanation" id="errorExplanation">';
You can’t perform that action at this time.