Skip to content

Instantly share code, notes, and snippets.

kirs / action.php
Created September 10, 2011 06:47 — forked from anonymous/gist:1208029
View action.php
public function actionRegistr()
$form = new RegistrForm;
if (!Yii::app()->user->isGuest) {
throw new CException('Вы уже зарегистрированны!');
} else {
if (isset($_POST['RegistrForm'])) {
$form->attributes = $_POST['RegistrForm'];
kirs /
Created April 12, 2012 10:14 — forked from ryanb/
Bootstrap Chef Solo
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev
cd /tmp
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make install
View spec__requests__history_items_spec.rb
require 'spec_helper'
describe "HistoryItems" do
before(:each) {login_as :user}
describe "GET /history_items" do
it "works!" do
visit history_items_path
response.should be_success
kirs / deploy.rb
Created July 5, 2012 12:38 — forked from mikhailov/0.
Nginx+Unicorn (production-ready setup)
View deploy.rb
# 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
kirs /
Created November 4, 2012 22:29 — forked from syabruk/
Manage ssh connection information
if [ ! -d $SSHC_PATH ] ; then
mkdir "$SSHC_PATH"
case "$1" in
-a | --add)
View gist:5599184
namespace :app do
namespace :error_pages do
desc "Generates static pages 500, 403, 404, 422"
task :generate => :environment do
av =
av.class_eval do
include ApplicationHelper
include Rails.application.routes.url_helpers
kirs / user.rb
Last active December 19, 2015 12:39 — forked from Olefine/user.rb
View user.rb
class User < ActiveRecord::Base
#default_scope where(:banned => false)
scope :unbanned, where(:banned => false)
include ChooseCity
has_karma(:questions, :as => :submitter, :weight => 0.5)
mount_uploader :avatar, AvatarUploader
kirs / upload.rb
Last active December 21, 2015 08:59 — forked from Olefine/upload.rb
View upload.rb
class MessageImageWorker
@queue = :message_image_queue
def self.perform(message_id, image_path)
MessageImage.create!(message_id: message_id, image: image_path)
View gist:93ffcf793c6874f29d2b

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

kirs /
Created July 5, 2016 19:37 — forked from strizhechenko/
Программа для underhood.ko

Опции bash для разработки

Разрабатывайте скрипты с опциями set -eu

  • set -e - падать на ошибках
  • set -u - считать ошибкой обращение к неопределенной переменной


  • максимально быстрое выявление скрытых ошибок в коде.
  • не надо самому писать многие проверки значений.
  • Это сделает shell-код похожим на нормальный язык программирования, а не на набор последовательно выполняющихся команд, которым на всё пофиг.