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 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 / 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 somewhere in
your path and make sure it is executable
chmod u+x
2) Then add the following alias (~/.bash_profile or something)
alias nt=''
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
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 defaults write carrier-testing -bool TRUE
  • Start up iTunes
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 /
Created Jul 8, 2009
bash completion support for git
# bash completion support for core Git.
# Copyright (C) 2006,2007 Shawn O. Pearce <>
# Conceptually based on gitcompletion (
# Distributed under the GNU General Public License, version 2.0.
# The contained completion routines provide support for completing:
# *) local and remote branch names
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">';
jnunemaker / authentication.rb
Created Jul 15, 2009
a starting point for authentication with mongomapper and rails
View authentication.rb
# include this in application controller
module Authentication
# Inclusion hook to make #current_user and #signed_in?
# available as ActionView helper methods.
def self.included(base)
base.send :helper_method, :current_user, :signed_in?, :authorized? if base.respond_to? :helper_method
# Returns true or false if the user is signed in.
jnunemaker / application.js
Created Aug 11, 2009
Pretty output of rails errors when doing ajax requests with jQuery
View application.js
// only outputs if console available and does each argument on its own line
function log() {
if (window && window.console && window.console.log) {
var i, len;
for (i=0, len=arguments.length; i<len; i++) {
View jquery.js
* jQuery JavaScript Library v1.3.3pre
* Copyright (c) 2009 John Resig
* Dual licensed under the MIT and GPL licenses.
* Date: 2009-07-16 03:32:39 -0400 (Thu, 16 Jul 2009)
* Revision: 6447
You can’t perform that action at this time.