Skip to content

Instantly share code, notes, and snippets.

View hemju's full-sized avatar
😃
Work Work

Helmut M Juskewycz hemju

😃
Work Work
View GitHub Profile
#!upstart
description "redis"
start on runlevel [23]
script
export HOME="/home/redis"
exec sudo -u redis /home/redis/redis-2.0.0-rc2/redis-server /home/redis/redis-2.0.0-rc2/redis.conf
end script
# IRBRC file by Iain Hecker, http://iain.nl
# put all this in your ~/.irbrc
require 'rubygems'
require 'yaml'
alias q exit
class Object
def local_methods
(methods - Object.instance_methods).sort
/Users/heli/.rvm/gems/ruby-1.9.2-p0/gems/json-1.4.6/lib/json/common.rb:71: warning: already initialized constant State
/Users/heli/.rvm/gems/ruby-1.9.2-p0/gems/json-1.4.6/lib/json/common.rb:72: warning: already initialized constant SAFE_STATE_PROTOTYPE
/Users/heli/.rvm/gems/ruby-1.9.2-p0/gems/json-1.4.6/lib/json/common.rb:73: warning: already initialized constant FAST_STATE_PROTOTYPE
/Users/heli/.rvm/gems/ruby-1.9.2-p0/gems/json-1.4.6/lib/json/common.rb:80: warning: already initialized constant PRETTY_STATE_PROTOTYPE
/Users/heli/.rvm/gems/ruby-1.9.2-p0/gems/json-1.4.6/lib/json/pure.rb:76: warning: already initialized constant JSON_LOADED
class Book < ActiveRecord::Base
belongs_to :auther
searchable do
text :title, :default_boost => 2
text :description
time :updated_at # for sorting by recent
integer :auther_id, :multi => true do
authers.map {|auther| auther.auther_id}
end
boolean :published, :using => :published?
@hemju
hemju / gist:1115340
Created July 30, 2011 08:48 — forked from sfilatov/gist:1109269
Migrate from Hoptoad to Airbrake
# Rails 2.3.5 - 2.3.11 environment settings (config/environment.rb)
config.gem 'airbrake', :version => '2.4.11', :require => "hoptoad_notifier"
# Rails 3 - bundler Gemfile(config/Gemfile)
gem 'airbrake', '2.4.11', :require => "hoptoad_notifier"
# In Hoptoad initializer (config/hoptoad.rb)
HoptoadNotifier.configure do |config|
config.api_key = '<api key>'
config.host = 'airbrakeapp.com'
@hemju
hemju / gist:1115341
Created July 30, 2011 08:48 — forked from sfilatov/gist:1109269
Migrate from Hoptoad to Airbrake
# Rails 2.3.5 - 2.3.11 environment settings (config/environment.rb)
config.gem 'airbrake', :version => '2.4.11', :require => "hoptoad_notifier"
# Rails 3 - bundler Gemfile(config/Gemfile)
gem 'airbrake', '2.4.11', require => "hoptoad_notifier"
# In Hoptoad initializer (config/hoptoad.rb)
HoptoadNotifier.configure do |config|
config.api_key = '<api key>'
config.host = 'airbrakeapp.com'
user deployer deployer;
worker_processes 1;
pid /var/run/nginx.pid;
worker_rlimit_nofile 30000;
events {
worker_connections 2048;
accept_mutex off; # "on" if nginx worker_processes > 1
# multi_accept on;
use epoll; # enable for Linux 2.6+
location ~ \.php {
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
location = /robots.txt { access_log off; log_not_found off; }
location = /favicon.ico { access_log off; log_not_found off; }
location ~ /\. { access_log off; log_not_found off; deny all; }
location ~ ~$ { access_log off; log_not_found off; deny all; }
# as we’re going to use Unicorn as the application server
# we’re not going to use common sockets
# but Unix sockets for faster communication
upstream linguist {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response (in case the Unicorn master nukes a
# single worker for timing out).
# for UNIX domain socket setups:
server unix:/tmp/.sock fail_timeout=0;