Skip to content

Instantly share code, notes, and snippets.

#
# Run as root
# $ bash <(curl -s https://gist.github.com/4567317)
#
# 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
fermion / bootstrap_pagination_helper.rb
Created November 5, 2012 12:53 — forked from oparrish/bootstrap_pagination_helper.rb
Link renderer to be used with will_paginate to render links to work with Twitter Bootstrap
module BootstrapPaginationHelper
class LinkRenderer < WillPaginate::ActionView::LinkRenderer
protected
def page_number(page)
unless page == current_page
link(page, page, :rel => rel_value(page))
else
link(page, "#", :class => 'active')
end
@fermion
fermion / example.rb
Created October 26, 2012 11:38 — forked from erikeldridge/example.rb
A utility for signing an url using OAuth in a way that's convenient for debugging
require 'oauth_util.rb'
require 'net/http'
o = OauthUtil.new
o.consumer_key = '<smugmug key>';
o.consumer_secret = '<smugmug secret>';
url = 'http://api.smugmug.com/services/oauth/getRequestToken.mg';
@fermion
fermion / model.js.coffee
Created October 24, 2012 19:10 — forked from gf3/model.js.coffee
Backbone Model Instance Sharing
@instance_store = {}
class App.Model extends Backbone.Model
cache_enabled: false
cache_key: "id"
constructor: (attr) ->
@on "destroy", @_removeFromStore
@fermion
fermion / reports_controller.rb
Created October 10, 2012 18:19 — forked from anonymous/ReportsController
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 => d.id, :target_date => Date.today.to_s}).exists? ? "green" : "red"
daily_time = FeedStatus.where({:feed_id => d.id}).order("updated_at").last
@late_daily_feeds << {:feed_name => d.feed_name, :state => daily_state, :received => daily_time }
end
@fermion
fermion / Gemfile
Created April 4, 2012 10:36 — forked from ylluminate/Gemfile
Example BrowserCMS Gemfile for Heroku
source 'http://rubygems.org'
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://github.com/rails/rails.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
fermion / apns.rb
Created March 2, 2012 12:35 — forked from scotttam/apns.rb
Sends an Apple Push Notification with Ruby
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
fermion / apns.py
Created March 2, 2012 12:35 — forked from scotttam/apns.py
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
fermion / 0_README.md
Created November 21, 2011 19:45 — forked from netzpirat/0_README.md
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
def layouts
PageTemplate::LAYOUTS.inject({}) do |hash, layout|
hash.merge(layout.to_s.sub('_', ' ').capitalize] = layout)
end
end