Skip to content

Instantly share code, notes, and snippets.

View brainopia's full-sized avatar

Ravil Bayramgalin brainopia

View GitHub Profile
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
From 3b1700f697f8013fa65ef915fc2928350b0d1945 Mon Sep 17 00:00:00 2001
From: brainopia <[email protected]>
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
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 }]
# 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 |
$ 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 |
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)))+((
#!/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)
diff -ur old/src-ILU/ilur/ilur.c new/src-ILU/ilur/ilur.c
--- old/src-ILU/ilur/ilur.c 2009-09-08 05:31:29.000000000 +0400
+++ new/src-ILU/ilur/ilur.c 2009-09-07 07:32:33.000000000 +0400
@@ -1,6 +1,6 @@
#include <string.h>
#include <stdio.h>
-#include <malloc.h>
+#include <malloc/malloc.h>
#include <IL/il.h>
application_name = root.split('/').last
initializer 'session_store.rb', <<-END
ActionController::Base.session = {
:key => '_#{application_name}_session',
:secret => '#{ActiveSupport::SecureRandom.hex(64)}'
}
# ActionController::Base.session_store = :active_record_store
END
namespace 'sync' do
desc "Sync data from server with client"
task :client do
host, user = credentials
puts `rsync -rlpgtvz --delete #{user}@#{host}:#{remote_project}/public/system/ public/system`
puts 'Transfering data.yml'
Net::SSH.start host, user do |cmd|
cmd.exec! 'rake RAILS_ENV=production db:data:dump'
cmd.scp.download! "#{remote_project}/db/data.yml", 'db/data.yml'