Skip to content

Instantly share code, notes, and snippets.

View gsiener's full-sized avatar
🚴‍♂️
NYC

Graham Siener gsiener

🚴‍♂️
NYC
View GitHub Profile
@gsiener
gsiener / km.rb
Created August 25, 2011 13:58
A much simpler approach to using Kissmetrics instead of the provided gem. Requires delayed_job and httparty gems.
class KM
@id = nil
@key = nil
class << self
def init(key)
@key = key
end
@karmi
karmi / tired.rb
Created May 2, 2011 09:17
Template for generating a no-frills Rails application with support for ElasticSearch full-text search via the Tire gem
# ===================================================================================================================
# Template for generating a no-frills Rails application with support for ElasticSearch full-text search via Tire
# ===================================================================================================================
#
# This file creates a basic, fully working Rails application with support for ElasticSearch full-text search
# via the Tire gem [http://github.com/karmi/tire].
#
# You DON'T NEED ELASTICSEARCH INSTALLED, it is installed and launched automatically by this script.
#
# Requirements
@silviorelli
silviorelli / config.ru
Created April 8, 2011 10:30
config.ru for using POW Rack server with Rails 2
# Rails.root/config.ru
require "./config/environment"
run ActionController::Dispatcher.new
@rdetert
rdetert / application.html.erb
Created March 1, 2011 06:28
How to logout completely from Facebook using Ruby on Rails and Devise + Omniauth. I'm just modifying the Omniauth Railscast http://railscasts.com/episodes/236-omniauth-part-2
<div id="user_nav">
<% if user_signed_in? %>
<img src="<%= user_avatar %>" id="main_avatar"> Signed in as <%= current_user.email %>.<br />
Not you?
<% if session[:fb_token].nil? %>
<%= link_to "Sign out", destroy_user_session_path %>
<% else %>
<%= link_to "Sign out", facebook_logout_path %>
<% end %>
@dlo
dlo / config
Created February 17, 2011 20:39
A modified version of the scrobble.py included with pianobar.
# Move this file to ~/.config/pianobar/config
# User
user = PANDORA_USERNAME
password = PANDORA_PASSWORD
# Change this to where your scrobble.py file is
event_command = ~/.config/pianobar/scrobble.py
@zedtux
zedtux / postgresql.rb
Created February 17, 2011 14:47
Brew formula to install Postgresql 8.4.4 with working url
require 'formula'
require 'hardware'
class Postgresql <Formula
homepage 'http://www.postgresql.org/'
url 'http://ftp.riken.go.jp/pub/FreeBSD/distfiles/postgresql/postgresql-8.4.4.tar.bz2'
md5 '4bf2448ad965bca3940df648c02194df'
depends_on 'readline'
depends_on 'libxml2' if MACOS_VERSION < 10.6 # Leopard libxml is too old
@croaky
croaky / Gemfile
Created January 18, 2011 03:46
Getting a CouchDB app running on Rails 3 as of September, 2010
gem 'couchrest_extended_document'
@ahoward
ahoward / net-http-debug.rb
Created December 10, 2010 20:06
a simple way to debug tons of libs that use ruby's net/http
BEGIN {
require 'net/http'
Net::HTTP.module_eval do
alias_method '__initialize__', 'initialize'
def initialize(*args,&block)
__initialize__(*args, &block)
@trydionel
trydionel / backbone.rails.js
Created November 28, 2010 16:47
Makes Backbone.js play nicely with default Rails setup
//
// Backbone.Rails.js
//
// Makes Backbone.js play nicely with the default Rails setup, i.e.,
// no need to set
// ActiveRecord::Base.include_root_in_json = false
// and build all of your models directly from `params` rather than
// `params[:model]`.
//
// Load this file after backbone.js and before your application JS.
@dnagir
dnagir / rspec-syntax-cheat-sheet.rb
Created November 5, 2010 09:29
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")