Skip to content

Instantly share code, notes, and snippets.

View jherdman's full-sized avatar

James Herdman jherdman

View GitHub Profile
# Adapted from http://blogs.sun.com/Jacobkessler/entry/capistrano_and_glassfish_now_with
namespace :deploy do
desc "Start Glassfish Gem from a shutdown state"
task :cold do
start
end
desc "Stop a server running Glassfish Gem"
task :stop do
# an example Monit configuration file for delayed_job
#
# To use:
# 1. copy to /var/www/apps/{app_name}/shared/delayed_job.monitrc
# 2. replace {app_name} and {environment} as appropriate
# 3. add this to your /etc/monit/monitrc
#
# include /var/www/apps/{app_name}/shared/delayed_job.monitrc
check process delayed_job with pidfile /var/www/apps/{app_name}/shared/pids/delayed_job.pid
; Enable Vimpulse
(setq viper-mode t) ; enable Viper at load time
(setq viper-ex-style-editing nil) ; can backspace past start of insert / line
(require 'viper) ; load Viper
(setq vimpulse-experimental nil) ; don't load bleeding edge code (see 6. installation instruction)
(require 'vimpulse) ; load Vimpulse
(setq woman-use-own-frame nil) ; don't create new frame for manpages
(setq woman-use-topic-at-point t) ; don't prompt upon K key (manpage display)
(require 'redo)
# mongo_template.rb
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/javascripts/controls.js"
run "rm public/javascripts/dragdrop.js"
run "rm public/javascripts/effects.js"
run "rm public/javascripts/prototype.js"
module YARD
module Tags
##
# Used to document requests to controllers. This processor provides a link
# to documentation about the particular type of HTTP request made. We use
# the W3C HTTP 1.1 (RFC2616) as a target for HTTP documentation. The
# recognized verbs by this class are GET, PUT, POST, DELETE.
#
# Sample format for using the request tag are as follows:
#
## From http://shanesbrain.net/2008/7/9/using-xcode-with-git
# Treat stuff in the project folder as binary
*.pbxproj -crlf -diff -merge
We couldn’t find that file to show.
@jherdman
jherdman / intersect_with_matcher.rb
Created December 2, 2009 22:32
An RSpec matcher to check for intersection between two enumerables
Spec::Matchers.define :intersect_with do |challenge_range|
# Check to see if any elements exist in the intersection
match do |current_range|
[current_range.to_a & challenge_range.to_a].flatten.any?
end
failure_message_for_should do |current_range|
"#{current_range.inspect} doesn't overlap with #{challenge_range.inspect}"
end
// e.g....
var MyObject = exports.MyObject = function () {
this.my_attr = "I'm an attribute!";
}
// I expected to do this...
var MyObject = require('my_object');
var my_instance = new MyObject(); // EXPLOSIONS!!!
# A sample class...
class Person
attr_accessor :name, :gender, :born_on
def initialize(name, age, born_on)
self.name = name
self.gender = gender
self.born_on = born_on
end