Skip to content

Instantly share code, notes, and snippets.

@wzdf1982
wzdf1982 / config.go
Created December 16, 2013 09:55
libwebsocketd
// Copyright 2013 Joe Walnes and the websocketd team.
// All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package libwebsocketd
import (
"time"
)
@wzdf1982
wzdf1982 / spec_helper.rb
Created May 8, 2013 06:16
Rails: spec_helper.rb require support ruby file
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
@wzdf1982
wzdf1982 / rspec-syntax-cheat-sheet.rb
Created December 10, 2012 07:58 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@wzdf1982
wzdf1982 / rails31init.md
Created December 10, 2012 07:57 — forked from jraines/rails31init.md
Rails 3.1 with Rspec, Cucumber, Factory Girl, Haml, and Simple Form

Install Rails 3.1 RC

gem install rails --pre

generate new app, skipping Test::Unit file generation

rails new my_app -T

Set up Gemfile

@wzdf1982
wzdf1982 / rails engine setup
Created June 24, 2012 05:19
Rails: Engine setup
generate
rails plugin new importable --dummy-path=spec/dummy --full --mountable -T
add to gemspec
s.add_dependency 'jquery-rails'
s.add_dependency 'sass-rails'
s.add_dependency 'bootstrap-sass', '~> 2.0.3'
@wzdf1982
wzdf1982 / gist:2437803
Created April 21, 2012 15:39 — forked from bonyiii/gist:1103689
capistrano recipe
# https://rvm.beginrescueend.com/integration/capistrano/
# sudo and scons must be installed even though i don't want to use sudo at all. And i don't change user.
# also for git clone to work i have to set up ssh key in .ssh
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
require "rvm/capistrano" # Load RVM's capistrano plugin.
set :rvm_ruby_string, 'ruby-1.9.2@rails31' # Or whatever env you want it to run in.
set :rvm_type, :user # Copy the exact line. I really mean :user here
#http://blog.josephholsten.com/2010/09/deploying-with-bundler-and-capistrano/
require 'bundler/capistrano'
@wzdf1982
wzdf1982 / gist:2437767
Created April 21, 2012 15:36 — forked from jrochkind/gist:2161449
A Capistrano Rails Guide

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

@wzdf1982
wzdf1982 / Step_1.rb
Created December 30, 2011 02:17
Setting up a Rails Test Suite
# Step 1. Update your "Gemfile"
gem 'haml'
gem 'haml-rails', :group => :development
group :assets do
gem 'twitter-bootstrap-rails'
gem 'coffee-rails'
gem 'compass-rails'
gem 'jquery-rails'
gem 'sass-rails'
@wzdf1982
wzdf1982 / README.md
Created October 26, 2011 11:50 — forked from napcs/README.md
Deploying Rails to Linode

Deploying Rails to Linode

Installing Ruby Enterprise Edition, Apache, MySQL, and Passenger for deploying Rails 3.0 applications.

Get a Linode, and set it up with Ubuntu 10.04 LTS so that you have till April 2013 to get updates. Once the Linode is formatted, boot it and continue on.

Set up an 'A' record in your DNS, pointing to the IP of your Linode. I'm using demo.napcs.com here.

Initial setup