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
namespace :deploy do | |
task :restart do | |
run "if [ -f #{unicorn_pid} ]; then kill -USR2 `cat #{unicorn_pid}`; else cd #{deploy_to}/current && bundle exec unicorn_rails -c #{unicorn_conf} -E #{rails_env} -D; fi" | |
end | |
task :start do | |
run "bundle exec unicorn_rails -c #{unicorn_conf} -E #{rails_env} -D" | |
end | |
task :stop do |
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
server 'domain.ru', :app, :web, :db, :primary => true | |
set :deploy_to, "/home/www/domain" | |
set :rails_env, "staging" | |
set :user, "apps" | |
set :unicorn_conf, "#{deploy_to}/current/config/unicorn_staging.rb" | |
set :unicorn_pid, "#{deploy_to}/shared/pids/unicorn.pid" | |
set :shared_path, "#{deploy_to}/shared" |
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
#!/bin/bash | |
source ~/.bash_profile | |
cd /var/lib/jenkins/jobs/SEOTracker/workspace/ | |
rvm 1.9.3 | |
bundle install --without development test | |
RAILS_ENV=staging rspec spec |
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
resources :campaigns, only: [:index, :update] do | |
resources :banners | |
resources :phrases do | |
member do | |
get 'statistics' | |
end | |
end | |
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
{ | |
'А' => 'a', 'Б' => 'b', 'В' => 'v', 'Г' => 'g', 'Д' => 'd', 'Е' => 'e', 'Ё' => 'yo', 'Ж' => 'zh', 'З' => 'z', | |
'И' => 'i', 'Й' => 'j', 'К' => 'k', 'Л' => 'l', 'М' => 'm', 'Н' => 'n', 'О' => 'o', 'П' => 'p', 'Р' => 'r', | |
'С' => 's', 'Т' => 't', 'У' => 'u', 'Ф' => 'f', 'Х' => 'kh', 'Ц' => 'c', 'Ч' => 'ch', 'Ш' => 'sh', 'Щ' => 'shh', | |
'Ъ' => '', 'Ы' => 'y', 'Ь' => '', 'Э' => 'e', 'Ю' => 'yu', 'Я' => 'ya', | |
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'yo', 'ж' => 'zh', 'з' => 'z', | |
'и' => 'i', 'й' => 'j', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', | |
'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'kh', 'ц' => 'c', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'shh', | |
'ъ' => '', 'ы' => 'y', 'ь' => '', 'э' => 'e', 'ю' => 'yu', 'я' => 'ya', | |
}.map { |k, v| self.title_url.gsub!(k, v) } |
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 get_content_blocks | |
page_name = "#{params[:controller]}_#{params[:action]}" | |
page = Page.where(name: page_name).first.contents rescue [] | |
page.each { |obj| instance_variable_set("@"+obj.name, obj.body) } | |
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
# app/views/some/actionhtml.haml | |
some content here |
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
require 'sinatra/base' | |
require 'sinatra/config_file' | |
require 'json' | |
class Npi < Sinatra::Base | |
register Sinatra::ConfigFile | |
config_file 'config.yml' | |
get '/npi/:npi' do | |
content_type :json |
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 create | |
@question = Question.new(params[:question]) | |
// @conversation = Conversation.create | |
if @question.save | |
@message = current_user.send_message(@question, @question.question, "You have a question from #{@question.sender_id}") | |
//messages.new(:subject => "You have a question from #{@question.sender_id}", | |
// :notification_id => @question.sender_id, | |
// :receiver_id => @question.recipient_id, | |
// :conversation_id => @conversation.id, |
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
# | |
# ContsestContorller | |
# TODO: some ugly logic here, it's better to add it to Survey gem? | |
# | |
def show | |
q = survey.questions.first | |
@total_answers = Survey::Answer.where(question: q).count | |
@options_answers = [] | |
q.options.each do |o| | |
@options_answers << { count: Survey::Answer.where(question: q, option: o).count, text: o.text } |