Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am nate on github.
  • I am natesutton ( on keybase.
  • I have a public key ASA_ddu-DEDagScIhggwQs12FUQ2F-8wKK_MUsW_ATBpbwo

To claim this, I am signing this object:

nate / orgmode.gcemode
Created Oct 8, 2017 — forked from mpeuster/orgmode.gcemode
Highlights headings, TODOs, checkboxes, and links in Emacs Orgmode files
View orgmode.gcemode
// GoCoEdit demo mode - visit for more information
"name": "orgfile", // The name of the Mode
// An Array of file extensions to associate with your mode
"org", "ORG", "Org",
"dash_docsets": "", // Docsets to search if you are using the dash app
View intro.scss
// Cascading and Mutability cause pain
// and all sorts of trouble for your brain
// so quit being pedantic
// those styles are gigantic
// and Functional CSS is quite sane
nate / assert_queries.rb
Created Sep 19, 2016 — forked from pch/assert_queries.rb
assert_queries - rails 4
View assert_queries.rb
# Assertion for checking the number of queries executed within the &block
def assert_queries(num = 1, &block)
queries = []
callback = lambda { |name, start, finish, id, payload|
queries << payload[:sql] if payload[:sql] =~ /^SELECT|UPDATE|INSERT/
ActiveSupport::Notifications.subscribed(callback, "sql.active_record", &block)
assert_equal num, queries.size, "#{queries.size} instead of #{num} queries were executed.#{queries.size == 0 ? '' : "\nQueries:\n#{queries.join("\n")}"}"
nate / Generate tmux 2.1 packages on ubuntu 12.04
Last active Apr 9, 2016 — forked from saiqulhaq/latest-tmux-1.7 on ubuntu12.04
Generate tmux 2.1 packages on ubuntu 12.04
View Generate tmux 2.1 packages on ubuntu 12.04
sudo apt-get install git checkinstall automake libtool pkg-config alien
sudo apt-get build-dep tmux
git clone
cd tmux
git checkout 2.1
./configure --prefix=/usr/local
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:


start new with session name:

tmux new -s myname
nate / sortable_bools.rb
Created Feb 11, 2014
Make TrueClass and FalseClass sortable in ruby. Don't ever use this.
View sortable_bools.rb
class TrueClass
include Comparable
def <=>(other)
case other
when FalseClass
when TrueClass
View cond_variable_wtf.rb
require 'thread'
def signal_benchmark(klass, iterations)
mutex =
cond =
mutex.synchronize do do
iterations.times { |n| mutex.synchronize { print "cond.signal\n"; cond.signal } }
nate / offline_view_rendering.rb
Created Jun 20, 2013
We use this for indexing our documentation offline. This is known to work with Rails 3.2.13. A rake task renders all the views, strips all tags, mass deletes the docs from the index, and then batch inserts the new ones in the index. We need to render the views since helpers often generate text. The bonus of doing it this way is that the people m…
View offline_view_rendering.rb
# Examples:
#{<%= foos_path %>})
# # => "/foos"
# # => "..."

RSpec Around All

Provides around(:all) hooks for RSpec.


In your Gemfile:

gem 'rspec_around_all', git: 'git://'