Skip to content

Instantly share code, notes, and snippets.

View mokevnin's full-sized avatar

Kirill Mokevnin mokevnin

View GitHub Profile
-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) ->
-module(grabber).
-export([start/1]).
-export([downloader/2, storage/1]).
start(Host) ->
inets:start(),
StoragePid = spawn(grabber, storage, [Host]),
StoragePid ! {links, [Host]}.
@mokevnin
mokevnin / capybara_test.rb
Created October 17, 2012 19:05
capybara example (bdd)
# 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
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]
# encoding: utf-8
# @api public
# @version 1.0
class Api::EventsPhotosController < Api::ApplicationController
# Фотография события
#
# - id: Дата и время подготовки ответа
# - event_id: Id события
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
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',
class Ability
include CanCan::Ability
def initialize(user)
can :create, EventPhoto
if (user && user.roles)
if user.roles.map(&:to_sym).include?(:do_manager)
class Slug
def self.generate(text)
translit = Russian.transliterate text.gsub(' ', '-')
translit.gsub(/[^\w_-]/, '').gsub(/#/, '').downcase
end
end
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