Skip to content

Instantly share code, notes, and snippets.

View nolan's full-sized avatar

Nolan Meyers nolan

View GitHub Profile
@nolan
nolan / notifo.rb
Created January 26, 2011 19:17
Capistrano Notifo notification recipe w/ growlnotify fallback
# ~/.recipes/growl.rb
#
# Notifo setup in deploy scripts:
# set :notifo_service "NOTIFO_SERVICE_NAME" # Only if different from :application
# set :notifo_service_secret "NOTIFO_API_SECRET" # Only if different from application name
# set :notifo_subscriber_list "username1, username2" # Define default below to your username
# set :notifo_hostname 'example.com' # Defaults to :server_hostname. Set to empty string to use Notifo default
require 'notifo' rescue nil
@jamesbebbington
jamesbebbington / application_controller.rb
Created August 4, 2011 11:16 — forked from robertsosinski/caching_with_request_forgery_protection.rb
Rack middleware and form tag patch to insert csrf tokens into cached pages
class ApplicationController < ActionController::Base
TOKEN_PLACEHOLDER = "__CROSS_SITE_REQUEST_FORGERY_PROTECTION_TOKEN__"
after_filter :inject_csrf_token
private
def inject_csrf_token
if protect_against_forgery? && token = session['_csrf_token']
if body_with_token = response.body.gsub!(TOKEN_PLACEHOLDER, token)
@MischaTheEvil
MischaTheEvil / development_profiler.rb
Last active December 31, 2015 03:59 — forked from hiltmon/development_profiler.rb
A helper class to support easy ruby-prof profiling in Rails applications.
# encoding: utf-8
#
# Copyright (c) 2012 Hilton Lipschitz
# Copyright (c) 2013 Mischa The Evil
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to