Skip to content

Instantly share code, notes, and snippets.

View andriytyurnikov's full-sized avatar

Andriy Tyurnikov andriytyurnikov

View GitHub Profile
mysql -h hostname -u USER --password=PASSWORD DATABASENAME < FILENAME
git checkout --track -b speed origin/speed
*~
*.cache
*.log
*.pid
tmp/**/*
log/*.log
.DS_Store
db/cstore/**
*~
*.cache
*.log
*.pid
tmp/**/*
log/*.log
.DS_Store
db/cstore/**
LoadError in UploadController#listener_photo
libWand.so.10: cannot open shared object file: No such file or directory - /usr/lib64/ruby/gems/1.8/gems/rmagick-2.2.2/lib/RMagick2.so
RAILS_ROOT: /home/mtraks/apps/staging/mtraks/current/config/..
Application Trace | Framework Trace | Full Trace
/usr/lib64/ruby/gems/1.8/gems/rmagick-2.2.2/lib/RMagick2.so
/usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require'
/home/mtraks/apps/staging/mtraks/releases/20100513130252/vendor/rails/activesupport/lib/active_support/dependencies.rb:495:in `require'
/home/mtraks/apps/staging/mtraks/releases/20100513130252/vendor/rails/activesupport/lib/active_support/dependencies.rb:342:in `new_constants_in'
@andriytyurnikov
andriytyurnikov / application.js
Created May 3, 2011 12:55
Expose rails routes to javascript. Improve this stuff and get beer from me ;)
// This is not a parser - just simple implementation, which ignores optional segments, constraints, conditions,
// nesting of optional segments etc...
// Feel free to implement rich parser in JS ;)
var RailsRouter = {
expose_all : function(arr) {
for each (var route in arr) {
this.expose_route(route)
}
},
require 'formula'
class Ab < Formula
homepage 'http://httpd.apache.org/docs/trunk/programs/ab.html'
url 'http://www.apache.org/dist/httpd/httpd-2.4.3.tar.bz2'
sha1 '0ef1281bb758add937efe61c345287be2f27f662'
def patches
{
# The ab tool of the latest stable httpd (2.4.2) does not work
@andriytyurnikov
andriytyurnikov / config.ru
Last active December 14, 2015 10:49 — forked from josevalim/config.ru
# rackup -s puma
require 'puma' # thin does some weird caching
run proc { |env|
body = Enumerator.new do |socket|
socket << " "*1024 # Browsers wait for time or big data chunk
5.times do
socket << "Hello"
puts "Hello"
@andriytyurnikov
andriytyurnikov / application_controller.rb
Created May 17, 2013 15:54
controller filter for db-charmer
# this is around filter
# to use with db-charmer
# much more convinient then DbCharmer.enable_controller_magic!
# and force_slave_reads
around_filter :read_from_slave
def read_from_slave
DbCharmer.force_slave_reads do
yield
@andriytyurnikov
andriytyurnikov / module_monkeypatch.rb
Created September 30, 2013 21:35
DCI'ish roles for logic separation Experimental, proof of concept only, schizo still looks better then refinements: ActiveRecord has no business logic - only storage logic All business methods are stored in ActiveSupport::Concern modules
#lib/module_monkeypatch.rb
# helper method to use
# be sure load it before using)))
# P.S. modules can not use refinements so far
class Module
# it is for classes and ActiveSupport::Concern
# like :
# using refine_with_concern(User => PasswordAuthenticable)
def refine_with_concern(role_mapping={})