Skip to content

Instantly share code, notes, and snippets.

@inferno
inferno / Rakefile
Created June 25, 2012 12:47
Rake task for show defined routes in Sinatra
desc 'List defined routes'
task 'routes' do
App::routes.each_pair do |method, list|
puts ":: #{method} ::"
routes = []
list.each do |item|
source = item[0].source
item[1].each do |s|
source.sub!(/\(.+?\)/, ':'+s)
@inferno
inferno / unicorn.rb
Created July 20, 2013 11:23
Example Unicorn configuration file with Capistrano support
app_root = File.expand_path(File.dirname(__FILE__)).gsub('/config/unicorn', '')
working_directory app_root
pid "#{ app_root }/tmp/pids/unicorn.pid"
worker_processes 4
timeout 30
listen 9030
preload_app true
@inferno
inferno / .gemrc
Created July 23, 2013 07:49
gem setup for perfomance
---
:update_sources: true
:sources:
- http://gems.rubyforge.org/
- http://gems.github.com
:benchmark: false
:bulk_threshold: 1000
:backtrace: false
:verbose: true
gem: --no-ri --no-rdoc
@inferno
inferno / _sprites.sass
Created August 6, 2013 17:26
Spriting technique for compass and auto width/height setup.
$parts: sprite-map("sprites/*.png", $layout: smart)
$parts_names: sprite_names($parts)
.sprite
+inline-block
background: $parts
background-repeat: no-repeat
@each $sprite in $parts_names
.sprite_#{$sprite}
@inferno
inferno / hlink.c
Created August 13, 2013 20:54
Create hard links for directory in OSX.
{
status: 'error'
errors: [
{
id: 1
priority: 1
message: 'Первое сообщение'
cfs: [{ cid: 1, value: 123}, {cid: 2, value: 123}]
}
{
namespace :unicorn do
set :unicorn_pid, "#{app_path}/tmp/pids/unicorn.pid"
desc "Restart unicorn"
task :restart => :environment do
queue %{
cd #{app_path}
test -s "#{unicorn_pid}" && kill -USR2 `cat "#{unicorn_pid}"` && echo "-----> Reload Ok" && exit 0
bundle exec unicorn -c #{app_path}/config/unicorn.rb -E #{rails_env} -D && echo "-----> Start Ok"
}
upstream budo {
server 127.0.0.1:5000;
}
server {
listen 80;
server_name budo.ru;
root /home/www/budo.bugz.ru/current/public;
try_files $uri @budo;
Я – Анастасия Волочкова,
Папа мой – Порфирий Волочков,
Жизнь моя сложилась бестолково:
Я влюбляюсь только в мудаков
Это – в смысле, я влюбляюсь телом.
Потому, что сердцем и душой
Я люблю своё по жизни дело,
В смысле, сцену и театр Большой
www@Ubuntu-1304-raring-64-minimal:~/rush$ ruby daemons/collector.rb
I, [2014-03-27T18:54:03.821568 #7141] INFO -- : running server on 0.0.0.0:3097
I, [2014-03-27T19:00:30.744193 #7141] INFO -- : new client [95.26.65.10:51732] connected
D, [2014-03-27T19:00:30.748926 #7141] DEBUG -- : > start/finish@Pong@$
D, [2014-03-27T19:00:30.749030 #7141] DEBUG -- : < Rush@[email protected]@$
{
:id => "start/finish",
:method => "Pong",
:values => [],
:message_number => 0