Skip to content

Instantly share code, notes, and snippets.

View ahoward's full-sized avatar
probably outside if i'm not hacking.

ara.t.howard ahoward

probably outside if i'm not hacking.
View GitHub Profile
copiousfreetime /
Created January 16, 2013 17:59
Links used for 2013-01-15 Boulder Ruby User Group talk about the recent Rails vulnerabilities.
ahoward / a.rb
Created July 25, 2012 21:13
pry without a prompt
def console!(&block)
require 'pry'
each{|which| Pry.config.hooks.clear(which)}
prompt = ">> "
Pry.config.prompt = proc{|*a| prompt }
cookrn /
Last active March 29, 2017 15:12
Named Screen -- Inspired by @ahoward

Named Screen

A utility inspired by @ahoward that allows screens to be the name of the directory they were spawned from. This is mainly helpful for Terminal/iTerm tabs.

Executing this should rejoin sessions with the same name if they already exist or otherwise create them.


  1. Place or symlink into your path (I symlink as ns)
  2. Ensure the script is executable
cookrn /
Created April 10, 2012 02:27
A Reasonable `to_map` for `ActiveRecord::Base`


A to_map function is very useful when you want to convert models to PLAIN OLD DATA. Think presenters, conductors, APIs, JSON, etc...


Add this monkey-patch to your Rails project and call it on your model instances.

Example Models

cookrn /
Created March 20, 2012 19:51
How to Create and Apply a Patch w/ Git Across Similar Repositories
durran / sequence.rb
Created December 29, 2011 12:41
Integer sequence ids in Mongo
Mongoid.database.add_stored_function "sequence", <<-__
function(name) {
var ret = db.counters.findAndModify({ query: { _id: name}, update: { $inc : { next: 1}}, "new" :true, upsert: true});
class Sequence
include Mongoid::Fields::Serializable
protocool / caveatPatchor.js
Created February 14, 2011 02:29
Sample caveatPatchor.js file for use in Propane 1.1.2 and above
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.
nathos / lorem.rb
Created November 11, 2010 21:24
LoremHelper - a placeholder content generator for Webby
# LoremHelper - a placeholder content generator for Webby
# =======================================================
# based on Travis Dunn's Frank - lorem.rb:
# -
# - original license:
# LoremHelper creates placeholder content for your Webby [] projects.
# It's great for quickly prototyping/wireframing a site.
#Kind of like tail -f -n1
db =
coll = db.collection(mongo_collection)
start_count = coll.count
tail =, :tailable => true, :order => [['$natural', 1]]).skip(start_count- 1)
loop do
if doc = tail.next_document
puts doc
sleep 1