Skip to content

Instantly share code, notes, and snippets.

@vwall
vwall / tpl-cukeapp.rb
Created May 17, 2011 03:30 — forked from paulmars/template.rb
Rails 3, RSpec, Cucumber, Factory_Girl, HAML, SASS, Devise, Formtastic Template
## Rails App Template
## Updated for Rails 3.0.7
## Created on 10/23/10
## Updated on 5/7/11
## Run using $ rails new [appname] -JT -m tpl-cukeapp.rb
## Gems
# Warden and Devise for security
gem 'warden', '1.0.4'
@vwall
vwall / USAGE.md
Created June 4, 2011 08:56 — forked from kossnocorp/USAGE.md
MacVim with Drawer compile manual

Clone & Build

curl https://gist.github.com/raw/970438/caff9a09ed2d223b1123a69ede17cb19ad352af9/build.sh | sh
@vwall
vwall / gist:1130130
Created August 7, 2011 06:31 — forked from dkubb/gist:1130086
case with predicates
require 'rubygems'
require 'backports' # aliases Proc#=== to Proc#call
rs = (0..10000).to_a.sample(30)
rs.each do |r|
case r
when lambda { |n| n.zero? } then puts "#{r} is zero"
when lambda { |n| (n % 5).zero? } then puts "#{r} is fiven"
when lambda { |n| (n % 4).zero? } then puts "#{r} is fourven"
@vwall
vwall / new.rb
Created August 14, 2011 04:18 — forked from jferris/new.rb
New FactoryGirl definition syntax
FactoryGirl.define do
sequence :email do |n|
"user#{n}@example.com"
end
factory :user do
email
password "test"
aliased_as :author
end
@vwall
vwall / gist:1144716
Created August 14, 2011 08:47 — forked from ZhangHanDong/gist:1033906
MongoId Counter Cahce
#
# lib/mongoid/counter_cache.rb
# ruby
#
# Created by Zhang Alex on 2011-06-17.
# Copyright 2011 __ZhangHanDong__. All rights reserved.
#
# ===================================
# class Forum
# references_many :topics
@vwall
vwall / tired.rb
Created September 24, 2011 17:48 — forked from karmi/tired.rb
Template for generating a no-frills Rails application with support for ElasticSearch full-text search via the Tire gem
# ===================================================================================================================
# Template for generating a no-frills Rails application with support for ElasticSearch full-text search via Tire
# ===================================================================================================================
#
# This file creates a basic, fully working Rails application with support for ElasticSearch full-text search
# via the Tire gem [http://github.com/karmi/tire].
#
# You DON'T NEED ELASTICSEARCH INSTALLED, it is installed and launched automatically by this script.
#
# Requirements
@vwall
vwall / bootstrap.sh
Created October 27, 2011 05:23 — forked from knzai/bootstrap.sh
An example bash bootstrap to get workstation set-up with chef - update YOUR_ORG below
#!/usr/bin/env sh
#After forking and editing YOUR_ORG to point at the right repo can be run via:
#bash <(curl -s https://raw.github.com/gist/THEIDOFYOURFORKEDGIST)
#if you use `curl xxx | sh` input will be messed up and there will be no pauses
#I keep XCode and gcc on a thumbdrive along with java, for speeding things up
#http://support.apple.com/downloads/DL1421/en_US/JavaForMacOSX10.7.dmg
read -p "Install XCode or gcc (http://github.com/kennethreitz/osx-gcc-installer)"
#setup your ssh keys for github
@vwall
vwall / index.js.erb
Created December 16, 2011 23:53 — forked from ryanb/index.js.erb
Infinite scrolling solution covered in revised episode #114: http://railscasts.com/episodes/114-endless-page-revised
$('#products').append('<%= j render(@products) %>');
<% if @products.next_page %>
$('.pagination').replaceWith('<%= j will_paginate(@products) %>');
<% else %>
$('.pagination').remove();
<% end %>
@vwall
vwall / gist:1572207
Created January 6, 2012 20:14 — forked from kagemusha/gist:1444076
Install Rails 3.1 Mongoid Mongo on Heroku
Tested on: Rails 3.1.x, Heroku Cedar stack
1. Generate/develop local Rails app, add mongoid gem, bundle install etc.
2. Git the App
3. Generate Heroku Cedar App:
heroku create --stack cedar
4. Rename app
heroku rename <newname>
5. Install heroku mongoHQ or mongolab:
heroku addons:add mongohq:free
#!/usr/bin/env bash
# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
environment_id="ruby-1.9.3-p0@railsapp"
#
# Uncomment following line if you want options to be set only for given project.