This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user www-data; | |
worker_processes 2; | |
error_log /var/log/nginx/error.log; | |
pid /opt/nginx/logs/nginx.pid; | |
events { | |
worker_connections 1024; | |
multi_accept on; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Fixnum #:nodoc: | |
XChar = Builder::XChar unless defined?(XChar) | |
# XML escaped version of chr (inlines cyrillic unicode range) | |
def xchr | |
n = XChar::CP1252[self] || self | |
n = 42 unless XChar::VALID.find { |value| value.kind_of?(Range) ? value.include?(n) : (value == n) } | |
XChar::PREDEFINED[n] or case n | |
when 0...128 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# миграции генерятся при генерации модели | |
# $ rails generate model Post title:string content:text author_id:integer | |
# генерирует db/migrate/{TIME}_create_posts.rb | |
class CreatePosts < ActiveRecord::Migration | |
def self.up | |
create_table :posts do |t| | |
t.string :name | |
t.text :content | |
t.integer :author_id | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$file_mode = 'w' | |
$file_path = 'file.tmp' | |
$lines = [] | |
def generate_lines | |
for i in 0..999 | |
$lines << ("0".."z").to_a.sample((10..20).to_a.sample).join('') | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post < ActiveRecord::Base | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user www-data; | |
worker_processes 8; | |
error_log /var/log/nginx/error.log; | |
pid /opt/nginx/logs/nginx.pid; | |
events { | |
worker_connections 1024; | |
multi_accept on; | |
use epoll; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ApplicationController | |
def blah | |
@meme.drop! | |
end | |
end | |
class FooController < ApplicationController |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |