Skip to content

Instantly share code, notes, and snippets.

@scottraio
scottraio / gist:4416887
Created December 31, 2012 02:17
hogan templates compilation for snockets (connect-assets)
path = require('path')
assets = require('connect-assets')
hogan = require('hogan.js')
assets.jsCompilers.mustache =
namespace: "TEMPLATES"
match: /\.js$/
compileSync: (sourcePath, source) ->
assetName = path.basename(sourcePath, '.mustache')
compiled = hogan.compile(source, asString: true)
@scottraio
scottraio / deploy.rb
Created March 10, 2012 08:15 — forked from fuse/deploy.rb
Capistrano configuration
require "bundler/capistrano"
# allowing shell interactions
default_run_options[:pty] = true
# multistaging
set :stages, %w(staging production)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
@scottraio
scottraio / email_poll.rb
Created January 9, 2012 21:21
E-mail polling
require 'net/imap'
require 'net/http'
EMAIL = "support@workory.com"
NAME = "Workory Support"
class Gmail
def initialize(username,password)
@imap = Net::IMAP.new("imap.gmail.com", 993, true)
@scottraio
scottraio / quiet_assets.rb
Created December 12, 2011 23:11
Quiet down Rails 3.1 asset pipeline logging in development
Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
def before_dispatch_with_quiet_assets(env)
before_dispatch_without_quiet_assets(env) unless env['PATH_INFO'].index("/assets/") == 0
end
alias_method_chain :before_dispatch, :quiet_assets
end
@scottraio
scottraio / devise_handle_failure.rb
Created May 31, 2011 01:56
Devise undefined method gsub when failing out
module Devise
class FailureApp < ActionController::Metal
private
def redirect_url
if skip_format?
new_user_session_path
else