Skip to content

Instantly share code, notes, and snippets.

@kirs
kirs / chef_solo_bootstrap.sh
Created April 12, 2012 10:14 — forked from ryanb/chef_solo_bootstrap.sh
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
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
<% if @price_total_monthly > 100 %>
<%= number_to_currency(@price_total_monthly.to_f/100, :precision => 2, :separator => ",") %>
<% else %>
<%= number_to_currency(@price_total_monthly.to_f/100, :precision => 1, :separator => ",") %>
<% end %>
# покороче
<%= number_to_currency(@price_total_monthly.to_f/100, :precision => (@price_total_monthly > 0 ? 2 : 1), :separator => ",") %>
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
end
end
@kirs
kirs / gist:2841999
Created May 31, 2012 08:51
My ST2 config
{
"auto_complete_commit_on_tab": true,
"color_scheme": "Packages/Solarized Color Scheme (TextMate)/Solarized (light).tmTheme",
"create_window_at_startup": false,
"draw_white_space": "all",
"folder_exclude_patterns":
[
".bundle",
"tmp",
".git",
@kirs
kirs / gist:2900219
Created June 9, 2012 09:12
cocoa webView didReceiveServerRedirectForProvisionalLoadForFrame example
- (void)webView:(WebView *)sender didReceiveServerRedirectForProvisionalLoadForFrame:(WebFrame *)frame {
NSURL *currentUrl = [[[frame dataSource] request] URL];
NSString *currentRequest = [authDialog mainFrameURL];
NSLog(@"URL:");
NSLog(currentRequest);
NSLog([currentUrl absoluteString]);
}
@kirs
kirs / deploy.rb
Created July 5, 2012 12:38 — forked from mikhailov/0. nginx_setup.sh
Nginx+Unicorn (production-ready setup)
# 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
kirs / gist:3394057
Created August 19, 2012 09:55
Import Skype history to plain text
sqlite3 ~/Library/Application\ Support/Skype/your_userbane/main.db "SELECT author,timestamp, body_xml FROM messages WHERE dialog_partner = 'friend_username'" > ~/Desktop/skype_chat_history.txt
@kirs
kirs / deploy.rb
Created September 18, 2012 15:32
lxc-frontend deploy example
require "bundler/capistrano"
set :default_environment, {
'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"
}
set :application, "lxc-frontend"
set :repository, "path to repo"
set :scm, :git
@kirs
kirs / leaderboard.coffee
Created October 1, 2012 22:22
leaderboard hubot extension
# Description:
# Displays a leaderboard.pro company leader
#
# Dependencies:
# None
#
# Configuration:
# HUBOT_LEADERBOARD_AUTH_TOKEN
# HUBOT_LEADERBOARD_COMPANY
#
@kirs
kirs / run
Created October 3, 2012 05:59
Unicorn service for Runit
#!/bin/sh
exec 2>&1
export RAILS_ENV=production
APP_ROOT=/home/deploy/project_name
UNICORN="/usr/local/rvm/bin/rvm 1.9.2@project_name exec bundle exec unicorn_rails -c $APP_ROOT/current/config/unicorn.rb -E $RAILS_ENV"
cd $APP_ROOT/current
exec $UNICORN