View gist:355902
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add to the bottom of the rake file: | |
require 'hydra' | |
require 'hydra/tasks' | |
Hydra::TestTask.new('hydra:spec') do |t| | |
t.add_files 'spec/**/*_spec.rb' | |
end | |
Hydra::TestTask.new('hydra:features') do |t| | |
t.add_files 'features/**/*.feature' | |
end |
View gist:356857
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Search | |
VECTORS = [ | |
{:klass => Company, :columns => ['ticker', 'name']}, | |
{:klass => Executive, :columns => ['name']} | |
] | |
class << self | |
def find(query) | |
query = query.split(' ').join(' & ') | |
return Search::VECTORS.collect{|tuple| | |
Array(tuple[:columns]).collect{|column| |
View gist:359331
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-# render your objects with their dom_id from ActionController::RecordIdentifier | |
-# this means each TR will have an id like "object_47" | |
%table | |
- @objects.each do |obj| | |
%tr{:id => dom_id(obj)} | |
%td= h obj.title | |
%td | |
%li= link_to "Edit", edit_obj_path(obj) |
View Thread Timeout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
def sleep_for_5 | |
puts 'gonna sleep for 5' | |
sleep(5) | |
puts 'yawn!' | |
end | |
def sleep_for_15 | |
puts 'gonna sleep for 15' |
View ActiveRecord TXN Name override.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveRecord | |
module ConnectionAdapters | |
class AbstractAdapter | |
def current_savepoint_name | |
"active_record_#{Process.pid.to_s}_#{open_transactions}" | |
end | |
end | |
end | |
end |
View Ruby GC for Testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export RUBY_HEAP_MIN_SLOTS=1000000 | |
export RUBY_HEAP_SLOTS_INCREMENT=250000 | |
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 | |
export RUBY_GC_MALLOC_LIMIT=100000000 | |
export RUBY_HEAP_FREE_MIN=1000000 |
View gist:385614
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ree-1.8.7-2010.01 > require 'rubygems' | |
=> true | |
ree-1.8.7-2010.01 > require 'fastercsv' | |
=> true | |
ree-1.8.7-2010.01 > FasterCSV.open('test.csv', 'w') do |csv| | |
ree-1.8.7-2010.01 > csv << ["this", "is", "test, or not"] | |
ree-1.8.7-2010.01 ?> end | |
=> <#FasterCSV io_type:File io_path:"test.csv" lineno:1 col_sep:"," row_sep:"\n" quote_char:"\""> | |
File contains: |
View quickerclip.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Paperclip | |
class Geometry | |
def self.from_file file | |
parse("100x100") | |
end | |
end | |
class Thumbnail | |
def make | |
src = Test::FileHelper.fixture_file('white_pixel.jpg') | |
dst = Tempfile.new([@basename, @format].compact.join(".")) |
View pom.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
def notify(msg) | |
puts "NOTIFY: #{msg}" | |
`notify-send -i /home/nick/bin/nicks-toolbox/pom.png "Pomodoro" "#{msg}"` | |
end | |
unless ARGV.size == 2 | |
puts "Usage: pomodoro <work time> <rest time>" | |
exit(1) | |
end |
View firetower-setup-ssl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ firetower setup | |
What is your Campfire subdomain? If your Campfire address is | |
http://mycompany.campfirenow.com, your subdomain is "mycompany" (without the | |
quotes). | |
smartlogic | |
Please enter your Campfire API token. You can find your token at | |
http://smartlogic.campfirenow.com/member/edit | |
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (my real token was here) | |
Use SSL when connecting to Campfire? | |
y |
OlderNewer