Skip to content

Instantly share code, notes, and snippets.

188 cd
189 sudo apt-get remove ffmpeg x264 libx264-dev yasm
190 sudo apt-get update
191 sudo apt-get install build-essential git-core checkinstall texi2html libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libvorbis-dev libx11-dev libxfixes-dev zlib1g-dev
192 cd
193 wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
194 tar xzvf yasm-1.2.0.tar.gz
195 cd yasm-1.2.0
196 ./configure
197 make
@collinschaafsma
collinschaafsma / gist:2323523
Created April 6, 2012 22:22
Autoload an .env file in your zshell
# Put this in ~/.zshrc
chpwd() {
if [ -f ".env" ]; then source .env; fi
}
# Then make .env files in your project directories that look like this.
export S3_SECRET="<s3_secret>"
export S3_KEY="<s3_key>"
# Then add .env to ~/.gitignore
@collinschaafsma
collinschaafsma / gist:2324360
Created April 7, 2012 01:11
Adding middleware with Railtie
module Foo
class Railtie < Rails::Railtie
initializer "foo.insert_middleware" do |app|
app.config.middleware.use "Foo::Middleware"
end
end
end
require "foo/railtie" if defined? Rails
@collinschaafsma
collinschaafsma / rails-grunt.js
Created April 10, 2012 03:43
Grunt config for Rails
// This is the main application configuration file. It is a Grunt
// configuration file, which you can learn more about here:
// https://github.com/cowboy/grunt/blob/master/docs/configuring.md
//
module.exports = function(grunt) {
grunt.initConfig({
// The clean task ensures all files are removed from the dist/ directory so
// that no files linger from previous builds.
@collinschaafsma
collinschaafsma / gist:2637446
Created May 8, 2012 17:10
farmhand structure
├── Gemfile
├── Thorfile
├── client
│   ├── app
│   │   ├── config.js
│   │   ├── farmhand.js
│   │   ├── main.js
│   │   ├── modules
│   │   │   └── crop.js
│   │   └── templates
// Fast
var http = require('http');
http.Server(function(req, res) {
res.writeHead(200);
res.end("hello world\n");
}).listen(8000);
// Faster
var cluster = require('cluster');
@collinschaafsma
collinschaafsma / gist:2662997
Created May 11, 2012 23:09
handlebars.rb segfault
/Users/collin/dev/farmhand_dev/vendor/bundle/gems/therubyracer-0.10.1/lib/v8/context.rb:100: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0]
-- Control frame information -----------------------------------------------
c:0037 p:---- s:0146 b:0146 l:000145 d:000145 CFUNC :Enter
c:0036 p:0043 s:0143 b:0143 l:000142 d:000142 METHOD /Users/collin/dev/farmhand_dev/vendor/bundle/gems/therubyracer-0.10.1/lib/v8/context.rb:100
c:0035 p:0165 s:0140 b:0140 l:000130 d:000139 BLOCK /Users/collin/dev/farmhand_dev/vendor/bundle/gems/therubyracer-0.10.1/lib/v8/context.rb:21
c:0034 p:0028 s:0135 b:0135 l:000134 d:000134 METHOD /Users/collin/dev/farmhand_dev/vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal.rb:16
c:0033 p:0057 s:0131 b:0131 l:000130 d:000130 METHOD /Users/collin/dev/farmhand_dev/vendor/bundle/gems/therubyracer-0.10.1/lib/v8/context.rb:10
c:0032 p:---- s:0127 b:0127 l:000126 d:000126 FINISH
@collinschaafsma
collinschaafsma / gist:3786008
Created September 26, 2012 04:19
Bicycle example for bdw / intro to programming class week 3, basics of methods.
# Bicycle example for bdw / intro to programming class week 3, basics of methods.
# I'm a method without variables
def ride
"OK, we're rolling..."
end
# I'm a method with variables
def gear_ratio(gearing)
(gearing[:front_chainring_gear].to_f / gearing[:rear_chainring_gear].to_f).round(2)
@collinschaafsma
collinschaafsma / bike.rb
Created November 14, 2012 21:01
bdw OO
# OO for the win!
# Bike class
# Classes in Ruby are Capitalized and are defined like so...
class Bike
# Accessors are handy, this is the equivalant of
#
# def state
# @state
class Hood
attr_accessor :houses
def initialize(houses)
@houses = houses
end
def house_count
@houses.count
end