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 MyClass | |
def do_somth_with_class(class) | |
class.send(method.to_sym) | |
other_stuff | |
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 Formatter | |
def output_report(title, text) | |
raise 'Abstract method called' | |
end | |
end | |
class HtmlFormatter < Formatter | |
def output_report(title, text) | |
<<-EOF | |
<html> |
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 Generator | |
def initialize(reporter, title, text) | |
@reporter = reporter | |
@title = title | |
@text = text | |
end | |
def make_report | |
@reporter.output_report(title, text) | |
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
formatter = HtmlFormatter.new | |
g = Generator.new(formatter, 'title', 'my long and interesting text') | |
g.make_report |
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
formatter = PdfFormatter.new | |
g = Generator.new(formatter, 'title', 'my long and interesting text') | |
g.make_report |
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
/// было | |
$select = $table->select() | |
->where('parent_id = ?', $this->_post->getId()) | |
->order('time'); | |
$repliesXml = ''; | |
foreach ($select->fetchAll() as $item) { | |
$repliesXml .= $item->getFullXml(); | |
} |
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
apps@vs1191219:/srv/www$ sudo apt-get upgrade | |
Reading package lists... Done | |
Building dependency tree | |
Reading state information... Done | |
You might want to run 'apt-get -f install' to correct these. | |
The following packages have unmet dependencies: | |
libc-dev-bin : Depends: libc6 (> 2.13) but 2.11.2-10 is installed | |
libc6 : Depends: libc-bin (= 2.11.2-10) but 2.13-21 is installed | |
libc6-dev : Depends: libc-dev-bin (= 2.11.2-10) but 2.13-21 is installed | |
libstdc++6-4.4-dev : Depends: libc6-dev (>= 2.13-5) but 2.11.2-10 is installed |
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
upstream domain { | |
server unix:/home/www/domain/tmp/sockets/unicorn.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name domain.ru www.domain.ru; | |
access_log /var/log/domain.ru/nginx-access.log; | |
error_log /var/log/domain.ru/nginx-error.log; | |
client_max_body_size 1G; |
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
deploy_to = "/home/www/domain" | |
rails_root = "#{deploy_to}/current" | |
pid_file = "#{deploy_to}/shared/pids/unicorn.pid" | |
log_file = "#{rails_root}/log/unicorn.log" | |
err_log = "#{rails_root}/log/unicorn_error.log" | |
old_pid = pid_file + '.oldbin' | |
listen "/home/www/domain/tmp/sockets/unicorn.sock", :backlog => 64 | |
timeout 30 |
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
set :stages, %w(production staging) | |
set :default_stage, "staging" | |
require 'capistrano/ext/multistage' | |
set :application, "application_name" | |
set :repository, "git@your_path_to_git.git" | |
set :scm, :git | |
set :keep_releases, 5 |