Skip to content

Instantly share code, notes, and snippets.

ActiveRecord::Base.include_root_in_json = false
[{
"roles": [{
"name": "Admin"
}],
"city": "Boulder",
"employers": [{
"title": "Quick Left"
}],
"state": "CO",
"full_name": "Collin Schaafsma"
def edge_case
render :json => @users.as_json(:only => [:first_name, :state])
end
class User < ActiveRecord::Base
has_and_belongs_to_many :employers
has_and_belongs_to_many :roles
end
@collinschaafsma
collinschaafsma / vim.rb
Created August 26, 2011 21:33 — forked from uasi/vim.rb
Vim formula for Homebrew
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.206'
def features; %w(tiny small normal big huge) end
@collinschaafsma
collinschaafsma / Resources for talk
Created February 28, 2012 18:24
Talk resources for: Stop putting every class in the models directory.
Example Rails app
https://github.com/collinschaafsma/loyd
Example Sinatra app
https://github.com/collinschaafsma/slimfit
Awesome talk by Uncle Bob.
http://confreaks.com/videos/759-rubymidwest2011-keynote-architecture-the-lost-years
Clean Code Book
@collinschaafsma
collinschaafsma / gist:2270221
Created April 1, 2012 01:03
Red5 init.d script
#!/bin/sh
#
# /etc/init.d/red5 -- startup script for the red5 server
#
# Based on the tomcat6 init script.
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
# Modified for Ubuntu red5 by Fred Dixon <ffdixon@bigbluebutton.org>
# Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>.
# Modified for Tomcat by Stefan Gybas <sgybas@debian.org>.
# Modified for Tomcat6 by Thierry Carrez <thierry.carrez@ubuntu.com>.
@collinschaafsma
collinschaafsma / gist:2270250
Created April 1, 2012 01:09
Red5 Ubunut 10.04 LTS Setup
sudo vim /etc/apt/sources.list
#add the following
deb http://us.archive.ubuntu.com/ubuntu/ lucid multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ lucid multiverse
deb http://us.archive.ubuntu.com/ubuntu/ lucid-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates multiverse
deb http://archive.canonical.com/ lucid partner
sudo apt-get update
sudo apt-get install java-package
@collinschaafsma
collinschaafsma / gist:2279511
Last active October 2, 2015 16:49
Capistrano user setup for an EC2 ami
# On server
addgroup admin
adduser deployer --ingroup admin
# Locally
cat ~/.ssh/id_dsa.pub | ssh deployer@ec2-something.compute-1.amazonaws.com 'mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys'
@collinschaafsma
collinschaafsma / gist:2308101
Created April 5, 2012 04:59
FFMPEG Setup
# Add speex, for Red5
brew edit ffmpeg
args << "--enable-libspeex" if Formula.factory('speex').installed?
brew install --use-gcc ffmpeg
# H.264 / ACC
ffmpeg -i video.flv -acodec libfaac -ab 19k -ar 16000 -vsync 1 -async 1 -r 25.0 -b 193k -vcodec libx264 -s 420x340 video.mp4
# VP8 / Vorbis