Skip to content

Instantly share code, notes, and snippets.

View brainopia's full-sized avatar

Ravil Bayramgalin brainopia

View GitHub Profile
#!/usr/bin/env ruby
# Usually you want to stick with git rebase --onto, but if you have conflicts, you can use this script instead
raise 'You need to specify a commit' unless ARGV.first
commit = ARGV.first
following_commits = `git rev-list #{commit}..`.split.reverse
def info(commit, format)
full transformation:
Matrix[
[(((((((((cos(θ0)*cos((45.0+θ1)))*cos((177.6141+θ2)))+(((-sin(θ0))*-1.0)*sin((177.6141+θ2))))*cos((2.3859+θ3)))+((((cos(θ0)*cos((45.0+θ1)))*(-sin((177.6141+θ2))))+(((-sin(θ0))*-1.0)*cos((177.6141+θ2))))*sin((2.3859+θ3))))*cos(θ4))+((((((cos(θ0)*cos((45.0+θ1)))*cos((177.6141+θ2)))+(((-sin(θ0))*-1.0)*sin((177.6141+θ2))))*(-sin((2.3859+θ3))))+((((cos(θ0)*cos((45.0+θ1)))*(-sin((177.6141+θ2))))+(((-sin(θ0))*-1.0)*cos((177.6141+θ2))))*cos((2.3859+θ3))))*sin(θ4)))*cos(θ5))+(((cos(θ0)*(-sin((45.0+θ1))))*-1.0)*sin(θ5))), (((((((((cos(θ0)*cos((45.0+θ1)))*cos((177.6141+θ2)))+(((-sin(θ0))*-1.0)*sin((177.6141+θ2))))*cos((2.3859+θ3)))+((((cos(θ0)*cos((45.0+θ1)))*(-sin((177.6141+θ2))))+(((-sin(θ0))*-1.0)*cos((177.6141+θ2))))*sin((2.3859+θ3))))*cos(θ4))+((((((cos(θ0)*cos((45.0+θ1)))*cos((177.6141+θ2)))+(((-sin(θ0))*-1.0)*sin((177.6141+θ2))))*(-sin((2.3859+θ3))))+((((cos(θ0)*cos((45.0+θ1)))*(-sin((177.6141+θ2))))+(((-sin(θ0))*-1.0)*cos((177.6141+θ2))))*cos((2.3859+θ3))))*sin(θ4)))*(-sin(θ5)))+((
$ rvm 1.8.6,1.8.7,1.9.1,1.9.2 ruby benchmark.rb
ruby-1.8.6-p383: ruby 1.8.6 (2009-08-04 patchlevel 383) [x86_64-darwin10.2.0]
benchmarking Create 100,000 times
-------------------------------------------------
proc 0.718 |
lambda 0.724 |
# 1.8.7
R18n | Rails I18n | R18n/I18n |
----------------------------------------------------
load 3.136 | 0.774 | 4.05x |
get 0.069 | 0.155 | 0.45x |
variables 0.074 | 0.145 | 0.51x |
pluralize 0.250 | 0.129 | 1.94x |
localize 0.156 | 0.361 | 0.43x |
default 0.073 | 0.247 | 0.30x |
fallback 0.048 | 0.064 | 0.75x |
6x * 2x**(3**4) / 3 / x**6
3 ** 4 = (1) 81
x ** (1) = (2) [1, { x => 81 }]
x ** 6 = (3) [1, { x => 6 }]
6 * x = (4) [6, { x => 1 }]
(4) * 2 = (5) [12, { x => 1 }]
(5) * (2) = (6) [12, { x => 82 }]
(6) / 3 = (7) [4, { x => 82 }]
(7) / (3) = (8) [4, { x => 76 }]
From 3b1700f697f8013fa65ef915fc2928350b0d1945 Mon Sep 17 00:00:00 2001
From: brainopia <ravwar@gmail.com>
Date: Wed, 6 Jan 2010 11:00:35 +0300
Subject: [PATCH] Add compatibility with latest ActiveSupport
---
lib/carrierwave/orm/mongoid.rb | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/carrierwave/orm/mongoid.rb b/lib/carrierwave/orm/mongoid.rb
class Rails < Thor
include Thor::Actions
desc 'generate NAME', 'generate my own rails skeleton'
def generate(name)
prepare name
create_application_folder
copy_custom_gemfile
generate_rails_app
remove_extra_files
-0.7071*cos(x1)*cos(x2)*cos(x3)*cos(x4)*cos(x5)*cos(x6)+0.7071*sin(x2)*cos(x3)*cos(x4)*cos(x5)*cos(x6)-0.7071*sin(x1)*sin(x3)*cos(x4)*cos(x5)*cos(x6)+0.7071*cos(x1)*cos(x2)*sin(x3)*sin(x4)*cos(x5)*cos(x6)-0.7071*sin(x2)*sin(x3)*sin(x4)*cos(x5)*cos(x6)-0.7071*sin(x1)*cos(x3)*sin(x4)*cos(x5)*cos(x6)+0.7071*cos(x1)*cos(x2)*cos(x3)*sin(x4)*sin(x5)*cos(x6)-0.7071*sin(x2)*cos(x3)*sin(x4)*sin(x5)*cos(x6)+0.7071*sin(x1)*sin(x3)*sin(x4)*sin(x5)*cos(x6)+0.7071*cos(x1)*cos(x2)*sin(x3)*cos(x4)*sin(x5)*cos(x6)-0.7071*sin(x2)*sin(x3)*cos(x4)*sin(x5)*cos(x6)-0.7071*sin(x1)*cos(x3)*cos(x4)*sin(x5)*cos(x6)-0.7071*cos(x1)*sin(x2)*sin(x6)-0.7071*cos(x2)*sin(x6)
0.7071*cos(x1)*cos(x2)*cos(x3)*cos(x4)*cos(x5)*sin(x6)-0.7071*sin(x2)*cos(x3)*cos(x4)*cos(x5)*sin(x6)+0.7071*sin(x1)*sin(x3)*cos(x4)*cos(x5)*sin(x6)-0.7071*cos(x1)*cos(x2)*sin(x3)*sin(x4)*cos(x5)*sin(x6)+0.7071*sin(x2)*sin(x3)*sin(x4)*cos(x5)*sin(x6)+0.7071*sin(x1)*cos(x3)*sin(x4)*cos(x5)*sin(x6)-0.7071*cos(x1)*cos(x2)*cos(x3)*sin(x4)*sin(x5)*sin(x6)+0.7071*sin(x2)*cos(
require 'em-synchrony'
require 'em-synchrony/em-http'
EventMachine.synchrony do
multi = EventMachine::Synchrony::Multi.new
multi.add :a, EventMachine::HttpRequest.new('http://ya.ru/').aget
EventMachine.add_timer(2) do
multi.perform; EventMachine.stop
end
end
require 'em-resolv-replace'
require 'em-synchrony/em-http'
require 'fiber_pool'
gem 'em_postgresql'
class Pool
delegate :spawn, to: :@pool
attr_reader :processed, :concurrent
def initialize(size)