Skip to content

Instantly share code, notes, and snippets.

View webgago's full-sized avatar
🏠
Working from home

Anton Sozontov webgago

🏠
Working from home
View GitHub Profile
@webgago
webgago / deploy.rb
Created July 5, 2012 19:24 — forked from mikhailov/0. nginx_setup.sh
Nginx+Unicorn (production-ready setup)
# Capistrano configuration
#
# require 'new_relic/recipes' - Newrelic notification about deployment
# require 'capistrano/ext/multistage' - We use 2 deployment environment: staging and production.
# set :deploy_via, :remote_cache - fetch only latest changes during deployment
# set :normalize_asset_timestamps - no need to touch (date modification) every assets
# "deploy:web:disable" - traditional maintenance page (during DB migrations deployment)
# task :restart - Unicorn with preload_app should be reloaded by USR2+QUIT signals, not HUP
def ApplicationController
def blah
@meme.drop!
end
end
class FooController < ApplicationController
#!/usr/local/bin/ruby
module DocSorter
extend self
require 'ap'
DOC = %w{doc docx xls odt xlsx dwg txt cdr psd ppt eml csv log xslic}
CODE = %w{yml sql mht htm html php rb diff conf}
PDF = %w{pdf}
GRAPH = %w{tiff jpg jpeg bmp gif png}
ARH = %w{zip rar 7z gz tgz bz2 bz exe jnlp msi apk xpi gem ipsw}
#!/usr/local/bin/ruby
require 'ap'
DOCS = %w{doc docx odt xls}
SCANS = %w{pdf tiff jpg jpeg bmp}
ARCHS = %w{zip rar 7z gz tgz bz2 bz}
MUZ = %w{mp3 wav flac}
dowsdir = '/home/achernikov/Downloads'
docs = []
archs = []
user app;
worker_processes 2;
error_log /home/app/logs/nginx.error.log info;
events {
worker_connections 1024;
}
@webgago
webgago / time_steps.rb
Created October 22, 2010 07:59 — forked from danielmorrison/time_steps.rb
timecop_steps
# just add a gem dependency for Timecop or require it yourself
Given 'the time is $time' do |time|
Timecop.freeze Time.parse(time)
end
When '$time pass' do |time|
Timecop.travel future_time(time)
Given 'delayed jobs are run' # we use delayed jobs and have some that get scheduled in the future.
end
@webgago
webgago / .irbrc.rb
Created September 29, 2010 11:14 — forked from dekart/.irbrc.rb
# Put this content to ~/.irbrc file (no extension)
require "rubygems"
begin
require "ap"
rescue LoadError => err
puts "Cannot find awesome_print gem. Please run 'gem install awesome_print' to install it."
end
ru:
errors:
messages:
not_found: "не найдена"
already_confirmed: "уже подтверждена"
not_locked: "не заблокирована"
devise:
sessions:
link: 'Вход'
ru:
errors:
messages:
not_found: "не найдена"
already_confirmed: "уже подтверждена"
not_locked: "не заблокирована"
devise:
sessions:
link: 'Вход'
/* Ismael Celis 2010
Simplified WebSocket events dispatcher (no channels, no users)
var socket = new ServerEventsDispatcher();
// bind to server events
socket.bind('some_event', function(data){
alert(data.name + ' says: ' + data.message)
});