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 'benchmark' | |
n = 1000000 | |
words = ["string", :symbol] | |
Benchmark.bm(20) do |x| | |
x.report("join('_')") do | |
n.times do | |
res = words.map{|s| s}.join("_") | |
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
require 'rack/utils' | |
module Fx | |
class FlashSessionCookie | |
def initialize(app, session_key = '_session_id') | |
@app = app | |
@session_key = session_key | |
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
Терминатор | |
Терминатор: Да придёт спаситель | |
Терминатор 2: Судный день | |
Терминатор 3: Восстание машин | |
Терминатор: Битва за будущее (сериал) | |
Терминатор 2 - 3D |
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
#encoding: utf-8 | |
require 'mechanize' | |
class MechanizeEncodingHook | |
def call(params) | |
return if params[:response].nil? || params[:response_body].nil? | |
response = params[:response] | |
content_type = response['Content-Type'] |
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
Òåðìèíàòîð | |
Òåðìèíàòîð: Äà ïðèä¸ò ñïàñèòåëü | |
Òåðìèíàòîð 2: Ñóäíûé äåíü | |
Òåðìèíàòîð 3: Âîññòàíèå ìàøèí | |
Òåðìèíàòîð: Áèòâà çà áóäóùåå (ñåðèàë) | |
Òåðìèíàòîð 2 - 3D |
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
#encoding: utf-8 | |
require 'mechanize' | |
KINOPOISK_SEARCH_URL = 'http://kinopoisk.ru/index.php?kp_query=' | |
query = 'терминатор' | |
agent = Mechanize.new | |
agent.get "#{KINOPOISK_SEARCH_URL}#{query.encode("windows-1251")}" | |
agent.page.search("td.news[width]").map do |section| |
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
/Users/yury/.rvm/gems/ruby-1.9.1-p378/gems/mysql2-0.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:244:in `close': already closed MySQL connection (Mysql2::Error) | |
from /Users/yury/.rvm/gems/ruby-1.9.1-p378/gems/mysql2-0.1.6/lib/active_record/connection_adapters/mysql2_adapter.rb:244:in `disconnect!' | |
from /Users/yury/Work/planet33/sources/web2/config/unicorn.rb:40:in `block in reload' | |
from /Users/yury/.rvm/gems/ruby-1.9.1-p378/gems/unicorn-0.97.0/lib/unicorn.rb:592:in `call' | |
from /Users/yury/.rvm/gems/ruby-1.9.1-p378/gems/unicorn-0.97.0/lib/unicorn.rb:592:in `block in spawn_missing_workers' | |
from /Users/yury/.rvm/gems/ruby-1.9.1-p378/gems/unicorn-0.97.0/lib/unicorn.rb:589:in `each' | |
from /Users/yury/.rvm/gems/ruby-1.9.1-p378/gems/unicorn-0.97.0/lib/unicorn.rb:589:in `spawn_missing_workers' | |
from /Users/yury/.rvm/gems/ruby-1.9.1-p378/gems/unicorn-0.97.0/lib/unicorn.rb:603:in `maintain_worker_count' | |
from /Users/yury/.rvm/gems/ruby-1.9.1-p378/gems/unicorn-0.97.0/lib/unicorn.rb:270:in `start' | |
fr |
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 bash | |
if [[ -s /usr/local/rvm/scripts/rvm ]] ; then source /usr/local/rvm/scripts/rvm ; fi | |
FILE_NAME=`basename $0` | |
if [ "`echo $0 | cut -c1`" = "/" ]; then | |
RAILS_BIN=`dirname $0` | |
else | |
RAILS_BIN=`pwd`/`echo $0 | sed -e s/$FILE_NAME//` | |
fi |
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
** Erubis 2.6.5 | |
Processing HomeController#index (for 91.192.32.186 at 2010-03-12 15:50:29) [GET] | |
Parameters: {"controller"=>"home", "action"=>"index"} | |
Rendering template within layouts/home | |
Rendering home/index | |
ActionView::TemplateError (invalid byte sequence in US-ASCII) in app/views/home/index.html.erb: |
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
mobot:TestApp yury$ bundle install | |
Updating git://github.com/Manfred/unichars.git | |
Fetching source index from http://gemcutter.org/ | |
Resolving dependencies | |
Updating git://github.com/Manfred/unichars.git | |
Installing rake (0.8.7) from system gems | |
Installing rails (2.3.5) from system gems | |
Installing unichars (0.5) from git://github.com/Manfred/unichars.git (at master) with native extensions | |
Installing activeresource (2.3.5) from system gems | |
Installing actionmailer (2.3.5) from system gems |