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
| -module(ring). | |
| -export([start/3, proc/1, master_proc/1]). | |
| start(M, ProcessCount, Message) -> | |
| Pid = spawn_link(ring, master_proc, [ProcessCount]), | |
| Pid ! {M, Message}, | |
| ok. | |
| master_proc(ProcessCount) -> |
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
| -module(grabber). | |
| -export([start/1]). | |
| -export([downloader/2, storage/1]). | |
| start(Host) -> | |
| inets:start(), | |
| StoragePid = spawn(grabber, storage, [Host]), | |
| StoragePid ! {links, [Host]}. |
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
| # gem install capybara | |
| # gem install rspec | |
| # rspec capybara_test.rb | |
| require 'rubygems' | |
| require 'capybara' | |
| require 'capybara/rspec' | |
| Capybara.configure do |c| | |
| c.current_driver = :selenium |
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
| AutoMonitoring::Application.routes.draw do | |
| mount Ckeditor::Engine => '/ckeditor' | |
| namespace :api do | |
| resources :employees, :only => [:update, :show] do | |
| get :employees_without_department, :on => :collection | |
| end | |
| resources :juridical_people, :only => [:show] |
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
| # encoding: utf-8 | |
| # @api public | |
| # @version 1.0 | |
| class Api::EventsPhotosController < Api::ApplicationController | |
| # Фотография события | |
| # | |
| # - id: Дата и время подготовки ответа | |
| # - event_id: 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
| class Api::SearchController < ApplicationController | |
| ## | |
| # Search | |
| # | |
| # @example [Request] GET /search?q=name&page=2 | |
| # @example [Response] total: <count>, episodes: [<episode>, <episode>, ...] | |
| # | |
| # @overload show(q, page) | |
| # @param [String] q Query string |
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
| runit_service "resque" do | |
| finish_script true | |
| options :env => "production" | |
| end | |
| runit_service "ffmpeg" | |
| template '/etc/nginx/conf.d/default.conf' do | |
| source "nginx_host.conf.erb" | |
| variables :deploy_to => '/u/apps/commersant/current', :resolver => '192.168.249.1', |
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 Ability | |
| include CanCan::Ability | |
| def initialize(user) | |
| can :create, EventPhoto | |
| if (user && user.roles) | |
| if user.roles.map(&:to_sym).include?(:do_manager) |
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 Slug | |
| def self.generate(text) | |
| translit = Russian.transliterate text.gsub(' ', '-') | |
| translit.gsub(/[^\w_-]/, '').gsub(/#/, '').downcase | |
| 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 Web::InvestController < Web::ApplicationController | |
| layout 'invest' | |
| before_filter do | |
| title configus.base_title | |
| title current_section | |
| add_breadcrumb t(:bc_main), root_path | |
| add_breadcrumb current_section, invest_path | |
| end |