Skip to content

Instantly share code, notes, and snippets.

💭
skiing

ara.t.howard ahoward

💭
skiing
Block or report user

Report or block ahoward

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 injection.js
App.Poller = Em.Object.extend({
});
App.register('poller', 'main', App.Poller);
App.inject('controller', 'poller', 'poller:main');
// inside a controller
this.get('poller') // -> the instance of your poller
// inside your poller
@ahoward
ahoward / a.rb
Created Jul 25, 2012
pry without a prompt
View a.rb
def console!(&block)
require 'pry'
Pry.config.hooks.send(:hooks).keys.
each{|which| Pry.config.hooks.clear(which)}
prompt = ">> "
Pry.config.prompt = proc{|*a| prompt }
block.binding.pry
@cookrn
cookrn / instructions.md
Last active Mar 29, 2017
Named Screen -- Inspired by @ahoward
View instructions.md

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.

Usage

  1. Place or symlink into your path (I symlink as ns)
  2. Ensure the script is executable
@cookrn
cookrn / 00_usage.md
Created Apr 10, 2012
A Reasonable `to_map` for `ActiveRecord::Base`
View 00_usage.md

to_map

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

Installation

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

Example Models

@cookrn
cookrn / links.md
Created Mar 20, 2012
How to Create and Apply a Patch w/ Git Across Similar Repositories
@durran
durran / sequence.rb
Created Dec 29, 2011
Integer sequence ids in Mongo
View sequence.rb
Mongoid.database.add_stored_function "sequence", <<-__
function(name) {
var ret = db.counters.findAndModify({ query: { _id: name}, update: { $inc : { next: 1}}, "new" :true, upsert: true});
return ret.next;
}
__
class Sequence
include Mongoid::Fields::Serializable
@sghael
sghael / gist:896445
Created Mar 31, 2011
Capistrano recipe for multi-stage deployment running Passenger standalone
View gist:896445
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
# REPLACE this below with your ruby version/gemset version: YOUR_RUBY_VERSION@YOUR_GEM_SET
set :rvm_ruby_string, 'ruby-1.9.2-p136@example_gemset'
set :use_sudo, false
set :stages, %w(production staging)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
@protocool
protocool / caveatPatchor.js
Created Feb 14, 2011
Sample caveatPatchor.js file for use in Propane 1.1.2 and above
View caveatPatchor.js
/*
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.
You can’t perform that action at this time.