gem install rails --pre
rails new my_app -T
I, Jason Huggins, the author of the work "CoffeeScript Web Server" (2010), irrevocably renounce | |
all current and future legal rights to the work in any medium whatsoever. | |
I stand behind the merit of the work, but disclaim all liability for it under law. | |
I encourage you, the audience, to share, copy, distribute, perform, remix, mash up, interpret, | |
excerpt, translate, and otherwise enjoy and use the work as you will. | |
I request that you acknowledge my authorship. |
# USAGE: Hash.from_xml:(YOUR_XML_STRING) | |
require 'nokogiri' | |
# modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#1231297 | |
class Hash | |
class << self | |
def from_xml(xml_io) | |
begin | |
result = Nokogiri::XML(xml_io) | |
return { result.root.name.to_sym => xml_node_to_hash(result.root)} |
;; For Emacs on Mac OS X http://emacsformacosx.com/ | |
;; Opens files in the existing frame instead of making new ones. | |
(setq ns-pop-up-frames nil) |
# (1) copy the newrelic rpm java client into #{RAILS_ROOT}/solr/newrelic | |
# (2) add a newrelic.yml in that directory with you API key | |
# (3) add this monkey patch in an initializer to load newrelic with the solr server | |
Sunspot::Server.class_eval do | |
def run | |
command = ['java'] | |
command << "-Xms#{min_memory}" if min_memory | |
command << "-Xmx#{max_memory}" if max_memory | |
command << "-Djetty.port=#{port}" if port | |
command << "-Dsolr.data.dir=#{solr_data_dir}" if solr_data_dir |
# Run me with: $ watchr watchr.rb | |
def run(cmd) | |
puts(cmd) | |
system(cmd) | |
end | |
def run_all_tests | |
cmd = "ruby run_specs.rb -f n -c" | |
run(cmd) | |
end |
#! /usr/bin/env ruby | |
status = DATA.flock(File::LOCK_EX | File::LOCK_NB) | |
if status == 0 | |
puts "we have the lock..." | |
sleep | |
else |
#!/usr/bin/env ruby | |
REGXS = { | |
/context/ => "describe", | |
/assert_equal\(?\s*([^,]+), (.*)\s*\)?$/ => "\\2.should == \\1", | |
/setup do/ => "before( :each ) do", | |
/should([^_])/ => "it\\1", | |
/require File.dirname.*$/ => "require \"spec_helper\"", | |
/class (.*)Test < [^:]*::TestCase/ => "describe \\1 do" | |
} |
% git status --branch | |
# On branch master | |
# Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded. | |
# | |
nothing to commit (working directory clean) | |
% git branch -v | |
* master a60b37e [behind 1] First checkin | |
mynewfeature 7a910dc Checking in everything |
#!/usr/bin/env ruby | |
require 'capistrano/cli' | |
class TranscriptLogger | |
module TranscriptLoggerMetadata | |
attr_accessor :tx_logger_metadata | |
def self.apply_to(object, options={}) | |
object.extend(self) unless object.respond_to?(:tx_logger_metadata) |