This file contains hidden or 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
| migration 1, :create_accounts do | |
| up do | |
| create_table :accounts do | |
| column :id, Integer, :serial => true | |
| column :name, String | |
| column :surname, String | |
| column :email, String | |
| column :crypted_password, String, :length => 64 | |
| column :role, String | |
| end |
This file contains hidden or 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
| source 'https://rubygems.org' | |
| gem 'sinatra' | |
| gem 'rack-fiber_pool', :require => 'rack/fiber_pool' | |
| group :development do | |
| gem 'thin' | |
| gem 'pry-rails' | |
| end |
This file contains hidden or 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
| source 'https://rubygems.org' | |
| gem 'thin' | |
| gem 'eventmachine', '1.0.0.rc.4' | |
| gem 'sinatra' | |
| gem 'sinatra-contrib', :require => 'sinatra/contrib' | |
| gem 'sinatra-flash', :require => 'sinatra/flash' | |
| gem 'rack-protection' |
This file contains hidden or 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
| source 'https://rubygems.org' | |
| gem 'sinatra' | |
| gem 'sinatra-contrib', require: 'sinatra/streaming' | |
| group :development do | |
| gem 'thin' | |
| gem 'pry-rails' | |
| end |
This file contains hidden or 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 fib n;n==0?[0]:n==1?[0,1]:(2..n-1).inject([0,1]){|a|a<<(a[-1]+a[-2])};end |
This file contains hidden or 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 fib(n)a,b,s=0,1,[];n.times{s<<a;c=b;b=a+b;a=c};s end | |
| p fib(33) | |
| [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, ...] |
This file contains hidden or 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 'em/pure_ruby' | |
| require 'eventmachine' | |
| require 'delorean' | |
| require 'benchmark' | |
| Benchmark.measure do | |
| EM.run do | |
| ticks = 0 | |
| timer = EM.add_periodic_timer 10 do | |
| print '.' |
This file contains hidden or 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 BaseWall | |
| def self.Wall length, width, material | |
| Module.new do | |
| define_method(:length) { length } | |
| define_method(:width) { width } | |
| define_method(:material) { material } | |
| def self.included clazz | |
| private :length, :width, :material | |
| end |
This file contains hidden or 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
| mkdir "${1%.*}" | |
| ( cd "${1%.*}" | |
| xargs -n1 -P10 -0 -d"\n" -Iuri bash -c "wget -O \"\$(echo \"uri\" | sed -e \"s/^.*&\///g\" -f ../urldecode.sed)\" \"uri\"" <../$1 | |
| ) |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <!-- saved from url=(0032)http://habrahabr.ru/post/147793/ --> | |
| <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| <meta name="viewport" content="width = 1080"> | |
| <title>GNU/Linux и устройство на Rockchip 2918 / Хабрахабр</title> | |