Skip to content

Instantly share code, notes, and snippets.

View vladvinnikov's full-sized avatar

Vladimir Vinnikov vladvinnikov

View GitHub Profile
@vladvinnikov
vladvinnikov / gist:1675048
Created January 25, 2012 06:18 — forked from ambar/gist:1534274
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@vladvinnikov
vladvinnikov / gist:1659093
Created January 22, 2012 22:10
Authlogic rspec webrat
require "authlogic/test_case"
def execute_login
activate_authlogic
@user = Factory.create(:user, :confirmation_ok => true)
@user_session = UserSession.create(@user)
end
before(:all) do
09.
@vladvinnikov
vladvinnikov / gist:1643794
Created January 19, 2012 23:46
line counter
find . -name '*.rb' | xargs wc -l
@vladvinnikov
vladvinnikov / gist:1593243
Created January 11, 2012 05:40
Factory girl has_many sample
http://robots.thoughtbot.com/post/254496652/aint-no-calla-back-girl
@vladvinnikov
vladvinnikov / gist:1593219
Created January 11, 2012 05:33
Factory example

Here's a sample test/factories.rb:

# Factories
Factory.define :article do |t|
	t.association :section # An article belongs to a section
	t.title {|x| "#{x.section.name}Article#{Factory.next(:count)}" }  # Use brackets when you're calling a sequence
	t.author "Author Bob"
    # Assuming you have put "require 'forgery' " in the correct place.  It could just be in your seeds.rb file.
	t.body Forgery::LoremIpsum.paragraphs(5)
@vladvinnikov
vladvinnikov / gist:1518611
Created December 25, 2011 01:49
Passenger + Nginx + RVM
http://thekindofme.wordpress.com/2010/10/24/rails-3-on-ubuntu-10-10-with-rvm-passenger-and-nginx/
rvmsudo passenger-install-nginx-module
server {
listen 80; #the server will be running on this port
server_name www.yourhost.com;
root /home/deployer/your_rails_project/public; # <--- be sure to point to 'public'!
passenger_enabled on;
}
@vladvinnikov
vladvinnikov / Get repo
Created December 24, 2011 23:57
New bare git repo
http://scottr.org/presentations/git-in-5-minutes/
git remote add origin git@server_name.ru:foo_site.git
set master track to origin
@vladvinnikov
vladvinnikov / gist:1512379
Created December 22, 2011 23:52
Rails generators config
config.generators do |g|
g.test_framework :rspec, :views => false, :fixture => true
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
g.form_builder :simple_form
g.template_engine :haml
end
@vladvinnikov
vladvinnikov / .profile
Created August 31, 2011 18:09
.profile
export PATH="/usr/local/bin:/usr/local/git/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
alias vim='/Applications/MacVim.app/Contents/MacOS/Vim'