Skip to content

Instantly share code, notes, and snippets.

class Object
Dir[root_path("app/models/*.rb")].each do |file|
autoload File.basename(file, '.rb').camelize, file
end
end
# default.gems generated gem export file. Note that any env variable settings will be missing. Append these after using a ';' field separator
activemodel -v3.0.0.beta
activerecord -v3.0.0.beta
activesupport -v3.0.0.beta
archive-tar-minitar -v0.5.2
arel -v0.2.1
builder -v2.1.2
carrierwave -v0.4.5
columnize -v0.3.1
crack -v0.1.7
<div id="disqus_thread"></div><script type="text/javascript" src="http://disqus.com/forums/<%= Blog.disqus_shortname %>/embed.js"></script><noscript><a href="http://<%= Blog.disqus_shortname %>.disqus.com/?url=ref">View the discussion thread.</a></noscript><a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
" Ruby
au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec set filetype=ruby
" Ruby on Rails
au BufNewFile,BufRead *.builder,*.rxml,*.rjs set filetype=ruby
" Rakefile
au BufNewFile,BufRead [rR]akefile,*.rake set filetype=ruby
" Rantfile
" Vim syntax file
" Language: Ruby
" Maintainer: Doug Kearns <[email protected]>
" URL: http://vim-ruby.rubyforge.org
" Anon CVS: See above site
" Release Coordinator: Doug Kearns <[email protected]>
" ----------------------------------------------------------------------------
"
" Previous Maintainer: Mirko Nasato
" Thanks to perl.vim authors, and to Reimer Behrends. :-) (MN)
#!/usr/bin/env zsh
function resolve_symlink() {
local result=`readlink $1`
[ -z $result ] && echo $1 || $0 $result
}
function expand_path() {
cd -qP $1
pwd
require 'rubygems'
require 'sinatra'
require 'twitter/login'
require 'haml'
use Rack::Session::Cookie
use Twitter::Login,
consumer_key: "__YOUR_KEY_HERE__",
secret: "__YOUR_SECRET_HERE__",
return_to: "/authenticated"
require 'open-uri'
require 'benchmark'
total = Benchmark.realtime {
threads = 30.times.map do
Thread.new {
gamers = Benchmark.realtime {
open("http://boughtstuff.com").read
}
puts "-----> Done in #{gamers}!"
__END__
-----> Done in 6.2943651676178!
-----> Done in 6.49692893028259!
-----> Done in 6.55151987075806!
-----> Done in 6.82303881645203!
-----> Done in 6.86100506782532!
-----> Done in 6.87509894371033!
-----> Done in 6.94020700454712!
-----> Done in 7.06164002418518!
-----> Done in 7.09178400039673!
require "ostruct"
module Spawn
Invalid = Class.new(ArgumentError)
def spawner &default
@@spawn ||= Hash.new
@@spawn[self] = default
end