Skip to content

Instantly share code, notes, and snippets.

# Run as root
# $ bash <(curl -s
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential git-core curl \
libssl-dev \
fermion / bootstrap_pagination_helper.rb
Created Nov 5, 2012 — forked from oparrish/bootstrap_pagination_helper.rb
Link renderer to be used with will_paginate to render links to work with Twitter Bootstrap
View bootstrap_pagination_helper.rb
module BootstrapPaginationHelper
class LinkRenderer < WillPaginate::ActionView::LinkRenderer
def page_number(page)
unless page == current_page
link(page, page, :rel => rel_value(page))
link(page, "#", :class => 'active')
fermion / example.rb
Created Oct 26, 2012 — forked from erikeldridge/example.rb
A utility for signing an url using OAuth in a way that's convenient for debugging
View example.rb
require 'oauth_util.rb'
require 'net/http'
o =
o.consumer_key = '<smugmug key>';
o.consumer_secret = '<smugmug secret>';
url = '';
fermion /
Created Oct 24, 2012 — forked from gf3/
Backbone Model Instance Sharing
@instance_store = {}
class App.Model extends Backbone.Model
cache_enabled: false
cache_key: "id"
constructor: (attr) ->
@on "destroy", @_removeFromStore
View reports_controller.rb
class ReportsController < ApplicationController
def index
# get all daily feeds
@feeds = Feed.where(:feed_type => 'daily')
@late_daily_feeds = []
@feeds.each do |d|
daily_state = FeedStatus.where({:feed_id =>, :target_date =>}).exists? ? "green" : "red"
daily_time = FeedStatus.where({:feed_id =>}).order("updated_at").last
@late_daily_feeds << {:feed_name => d.feed_name, :state => daily_state, :received => daily_time }
View hacky.rb
# Hacky random image thumbnailer.
# by Peter Sobot, April 21, 2012
# Based heavily on code by Michael Macias
# (
require 'rmagick'
images = Dir.glob(ARGV[0] ? ARGV[0]
: '-default-input-paths-')
output_dir = (ARGV[1] ? ARGV[1]
fermion / Gemfile
Created Apr 4, 2012 — forked from ylluminate/Gemfile
Example BrowserCMS Gemfile for Heroku
View Gemfile
source ''
gem 'rails', '3.0.9'
gem 'heroku'#, "~> 2.20" # shouldn't need this, but I've had to force Heroku version before.
gem 'rubyzip'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://'
gem 'thin', '1.3.1' # Heroku Cedar has added this as a requirement, otherwise it WILL use webrick & of course we don't want that.
fermion / apns.rb
Created Mar 2, 2012 — forked from scotttam/apns.rb
Sends an Apple Push Notification with Ruby
View apns.rb
require "rubygems"
require "yajl"
require "openssl"
require "socket"
# device_token = '39cac56f 986a0e66 3c4fd4f4 68df5598 024d2ca3 8b9f307c 741c180e 9fc30c62'
# device_token = device_token.gsub(" ", "")
# the_byte_token = [device_token].pack("H*")
the_byte_token = "\xBA\xFE\xD9\v \xD9\xC5\xAE\xCED\xD0-\xF2\x87\xAA\bkn\x9F\xC4aY\xD1v_|6\x97\xF8g\xAB\x17"
fermion /
Created Mar 2, 2012 — forked from scotttam/
Sends an Apple Push Notification with Python
import socket, ssl, json, struct
import binascii
# device token returned when the iPhone application
# registers to receive alerts
deviceToken = '39cac56f 986a0e66 3c4fd4f4 68df5598 024d2ca3 8b9f307c 741c180e 9fc30c62'
thePayLoad = {
'aps': {
'alert':'Oh no! Server\'s Down!',
fermion /
Created Nov 21, 2011 — forked from netzpirat/
Continuous CoffeeScript testing with Guard and Jasmine

Continuous CoffeeScript testing with Guard and Jasmine

This Gist shows how to set up a Rails project to practice BDD with CoffeeScript, Guard and Jasmine. You can see this setup in action on Vimeo

  • Install Gems with Bundler with bundle install
  • Define your guards with mate Guardfile
  • Initialize Jasmine with bundle exec jasmine init
  • Configure Jasmine with mate spec/support/yasmine.ym
  • Start Guard with bundle exec guard