Skip to content

Instantly share code, notes, and snippets.

require 'benchmark'
PATH_INFO = '/assets/'
iterations = 100_000_000
Benchmark.bm do |bm|
bm.report do
iterations.times do
PATH_INFO =~ /^\/assets\//
@biow0lf
biow0lf / selenium.xml
Created January 28, 2012 17:02
Selenium manifest file for Solaris 10 (/var/svc/manifest/local/selenium.xml)
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type="manifest" name="Selenium">
<service name="application/selenium" type="service" version="1">
<!-- Initial state of the service is disabled -->
<create_default_instance enabled="false" />
<!-- Only one instance of Selenium server should ever run per server -->
@biow0lf
biow0lf / xvfb.xml
Created January 28, 2012 16:58
Xvfb manifest file for Solaris 10 (/var/svc/manifest/local/xvfb.xml)
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='xvfb'>
<service
name='system/xvfb'
type='service'
version='1'>
<create_default_instance enabled='false' />
<single_instance />
@biow0lf
biow0lf / gist:1486342
Created December 16, 2011 14:53
liquid + i18n from rails
# lib/liquid_i18n_rails.rb
module LiquidI18nRails
def t(string)
I18n.t(string.to_sym)
end
end
# config/initializers/liquid.rb
require 'liquid_i18n_rails'
Liquid::Template.register_filter LiquidI18nRails
@biow0lf
biow0lf / gist:1154387
Created August 18, 2011 15:59
bundler outdated fail
$ bundle outdated
Fetching dependency information from the API at http://rubygems.org/......
Fetching dependency information from the API at http://rubygems.org/.
Outdated gems included in the bundle:
Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!
/Users/biow0lf/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.pre.7/lib/bundler/cli.rb:325:in `block in outdated': undefined method `version' for nil:NilClass (NoMethodError)
from /Users/biow0lf/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.pre.7/lib/bundler/cli.rb:306:in `outdated'
from /Users/biow0lf/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.pre.7/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Users/biow0lf/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.pre.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Users/biow0lf/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.pre.7/lib/bundler/vendor/thor.rb:263:in `dispatch'
Using remarkable_core (4.0.0.alpha4) from git://github.com/jeroenvandijk/remarkable.git (at master) Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!
/opt/ruby-1.9.2p180.build1/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1912:in `gsub': invalid byte sequence in US-ASCII (ArgumentError)
from /opt/ruby-1.9.2p180.build1/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1912:in `to_yaml'
from /opt/ruby-1.9.2p180.build1/lib/ruby/site_ruby/1.9.1/rubygems/builder.rb:79:in `block (2 levels) in write_package'
from /opt/ruby-1.9.2p180.build1/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_output.rb:73:in `block (3 levels) in add_gem_contents'
from /opt/ruby-1.9.2p180.build1/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_writer.rb:83:in `new'
from /opt/ruby-1.9.2p180.build1/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_output.rb:67:in `block (2 levels) in add_gem_contents'
from /opt/ruby
@biow0lf
biow0lf / gist:1032862
Created June 18, 2011 06:26
bundle, ok
MacBook-Pro-15-Igor-Zubkov:~ biow0lf$ rvm install 1.9.2
Installing Ruby from source to: /Users/biow0lf/.rvm/rubies/ruby-1.9.2-p180, this may take a while depending on your cpu(s)...
ruby-1.9.2-p180 - #fetching
ruby-1.9.2-p180 - #downloading ruby-1.9.2-p180, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 8609k 100 8609k 0 0 79464 0 0:01:50 0:01:50 --:--:-- 165k
ruby-1.9.2-p180 - #extracting ruby-1.9.2-p180 to /Users/biow0lf/.rvm/src/ruby-1.9.2-p180
ruby-1.9.2-p180 - #extracted to /Users/biow0lf/.rvm/src/ruby-1.9.2-p180
@biow0lf
biow0lf / gist:1032191
Created June 17, 2011 20:02
bundler and ruby 1.9.2
$ rvm 1.8.7 gem build bundler.gemspec
Successfully built RubyGem
Name: bundler
Version: 1.1.pre.5
File: bundler-1.1.pre.5.gem
$ rvm 1.9.2 gem build bundler.gemspec
ERROR: While executing gem ... (NoMethodError)
undefined method `write' for #<Syck::Emitter:0x007fe762172338>
$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin11.0.0]
@biow0lf
biow0lf / gist:1032174
Created June 17, 2011 19:56
current bundler master broken outdated
$ bundle outdated
Updating git://github.com/jeroenvandijk/remarkable.git
Fetching dependency information from the API at http://rubygems.org/......
Outdated gems included in the bundle:
* activesupport (3.0.9 > 3.0.8)
* builder (3.0.0 > 2.1.2)
* i18n (0.6.0 > 0.5.0)
* activemodel (3.0.9 > 3.0.8)
* erubis (2.7.0 > 2.6.6)
* rack (1.3.0 > 1.2.3)
$ cat Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.8'
gem 'jquery-rails'
gem 'sqlite3'
gem 'devise'
gem 'aws-ses', :require => 'aws/ses'
gem 'kaminari'
gem 'delayed_job'