Skip to content

Instantly share code, notes, and snippets.

View melnikaite's full-sized avatar

Eugene Melnikov melnikaite

View GitHub Profile
Benchmark activerecord-mysql activerecord-postgresql activerecord-sqlite mongoid-mongodb sequel-mysql sequel-postgresql sequel-sqlite
Eager Loading Query Per Association With 1-1 Records: 640 objects 22 times-No Transaction 5.921149 6.284935 5.860397 1.314835 0.254055 0.283381 0.356529
Eager Loading Query Per Association With 1-1 Records: 640 objects 22 times-Transaction 6.012105 6.493957 5.738628 0.253842 0.282353 0.376487
Eager Loading Query Per Association With 1-32 Records: 1024 objects 22 times-No Transaction 1.087165 1.114392 1.037673 0.908334 0.190097 0.206294 0.273892
Eager Loading Query Per Association With 1-32 Records: 1024 objects 22 times-Transaction 1.085952 1.150046 1.015849 0.191712 0.212131 0.271282
Eager Loading Query Per Association With 1-32-32 Records: 2048 objects 9 times-No Transaction 0.848494 0.894651 0.810860 0.082494 0.168703 0.170906 0.239950
Eager Loading Query Per Association With 1-32-32 Records: 2048 objects 9 times-Transaction 0.835610 0.867175 0.787067 0.168840 0.171462 0.
@melnikaite
melnikaite / gist:f0730dc6ade93ec83527
Created October 3, 2014 11:24
create yml file from ENV variable
# remove all unused environments from applicationюньд and generate hash
ruby -e 'require "yaml"; puts YAML.load(File.read("config/application.yml"))'
# run script to create yml file
application_yml='{"test"=>{"protocol"=>"https", "host"=>"example.com"}}' ruby -e 'require "yaml"; File.open("config/application.yml", "w") {|f| f.write(eval(ENV["application_yml"]).to_yaml) }'
# lib/capistrano/tasks/assets.rake
Rake::Task['deploy:assets:precompile'].clear
namespace :deploy do
namespace :assets do
desc 'Precompile assets locally and then rsync to remote servers'
task :precompile do
local_manifest_path = %x{ls public/assets/manifest*}.strip
@melnikaite
melnikaite / bootstrap-fileupload.js
Created June 13, 2013 13:48
client-side-validations-formtastic jasny bootstrap fileupload image input
//conflict with ClientSideValidations
//this.$input.attr('name', this.name)