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
begin | |
require 'thinking_sphinx/0.9.8' | |
require 'thinking_sphinx/tasks' | |
require 'thinking_sphinx/deltas/datetime_delta/tasks' | |
rescue LoadError | |
end |
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
class CreateUsers < ActiveRecord::Migration | |
def self.up | |
create_table :users do |t| | |
t.string :type | |
t.string :email | |
t.timestamps | |
end | |
end |
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
def find_cmd(*commands) | |
dirs_on_path = ENV['PATH'].to_s.split(File::PATH_SEPARATOR) | |
commands += commands.map{|cmd| "#{cmd}.exe"} if RUBY_PLATFORM =~ /win32/ | |
full_path_command = nil | |
found = commands.detect do |cmd| | |
dir = dirs_on_path.detect do |path| | |
full_path_command = File.join(path, cmd) | |
File.executable? full_path_command | |
end |
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
# ~/Projects/simfy $ bundle -v | |
Bundler version 1.1.rc | |
# ~/Projects/simfy $ time bundle exec ./script/runner "puts 1" | |
1 | |
real 0m12.492s | |
user 0m10.768s | |
sys 0m1.602s | |
# ~/Projects/simfy $ time bundle exec ./script/runner "puts 1" | |
1 | |
real 0m12.963s |
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
require "fileutils" | |
require "ostruct" | |
class Runner | |
class << self | |
attr_accessor :type | |
def run(tests_per_file, max_number_of_files, method = nil) | |
method ||= :total_time | |
tupels = (max_number_of_files / 50).times.map do |i| |
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 this to your Gemfile | |
# | |
# gem "ruby-debug-base19", "0.11.26" | |
# | |
# and run this script: | |
# | |
test -e /tmp/linecache19-0.5.13.gem || wget http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem -O /tmp/linecache19-0.5.13.gem | |
test -e /tmp/ruby-debug-base19-0.11.26.gem || wget http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem /tmp/ruby-debug-base19-0.11.26.gem |
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 the following lines to theme's html code right before </head> --> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script> | |
<script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script> | |
<script src="http://static.tumblr.com/fpifyru/AKFlv9zdu/embedgist.js"></script> | |
<!-- | |
Usage: just add <div class="gist">[gist URL]</div> | |
Example: <div class="gist">https://gist.github.com/1395926</div> | |
--> |
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
require "redis" | |
Redis.current.del("test") | |
def do_set! | |
did_set = nil | |
Redis.current.pipelined do | |
did_set = Redis.current.setnx("test", "ja") | |
Redis.current.expire("test", 3600) |
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
first,link: http://www.some.url | |
second,link: http://www.someother.url |