Skip to content

Instantly share code, notes, and snippets.

View lisovskyvlad's full-sized avatar

Lisovskii Vladislav lisovskyvlad

View GitHub Profile
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
# Put this to ~/.irbrc (no extension)
require "rubygems"
require 'irb/completion'
ARGV.concat [ "--readline", "--prompt-mode", "simple" ]
# IRB & Readline hostory
module Readline
module History
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@rmanalan
rmanalan / gitdeploy.md
Created December 9, 2010 20:13
My Git Deploy Workflow

My Git Deploy Workflow

I use this for static and simple [Sinatra][1] based sites -- great for prototyping simple apps. Credit goes to http://toroid.org/ams/git-website-howto for the original idea.

If you don't know what this is, here's an example of how I deploy my website/app to a server:

# create/update/delete files in my site
git add .
git commit -m "description of the changes I made"

git push

@knzconnor
knzconnor / 1_intro_to_subject.rb
Created February 8, 2011 07:45
A pattern for testing class methods in ruby with rspec explicit subjects
# RSpec's subject method, both implicitly and explicitly set, is useful for
# declaratively setting up the context of the object under test. If you provide a
# class for your describe block, subject will implicitly be set to a new instance
# of this class (with no arguments passed to the constructor). If you want
# something more complex done, such as setting arguments, you can use the
# explicit subject setter, which takes a block.
describe Person do
context "born 19 years ago" do
subject { Person.new(:birthdate => 19.years.ago }
it { should be_eligible_to_vote }
@chrisjacob
chrisjacob / README.md
Created February 18, 2011 03:44
Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").

Intro

Description: Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").

Author: Chris Jacob @_chrisjacob

Tutorial (Gist): https://gist.github.com/833223

The Result

@Evangenieur
Evangenieur / Readme.md
Created March 27, 2011 23:30 — forked from grosser/Readme.md
Ruby Server / Node.js Benchmark

Sinatra

ruby 1.9.2 + async_sinatra + thin thin start

ab -n 10000 -c 100 http://localhost:3000/
-> 49ms / request

Node

node server.js
@erichurst
erichurst / database.yml.example mysql2
Created May 9, 2011 02:58
Rails 3 database.yml examples
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
@amardaxini
amardaxini / add.js.erb
Created August 17, 2011 08:56
redis i18n
<tr>
<td><%=@key.split(".").drop(1) %></td>
<td><%= @value%></td>
</tr>