Skip to content

Instantly share code, notes, and snippets.

View elhu's full-sized avatar

Vincent Boisard elhu

View GitHub Profile
@elhu
elhu / gist:3973143
Created October 29, 2012 11:50
Method missing with module
def method_missing(method, *args, &block)
begin
super
rescue NoMethodError => e
warn("Warning: Unknown field or method #{method} for object #{self.inspect}\nBacktrace:\n#{e.backtrace.join("\n")}")
end
end
@elhu
elhu / gist:3208072
Created July 30, 2012 16:09
em-http-request HTTP Digest Auth middleware
module EventMachine
module Middleware
require 'digest'
require 'securerandom'
require 'cgi'
class DigestAuth
def initialize(opts = {})
@nonce_count = -1
@opts = {}
@elhu
elhu / gist:1136890
Created August 10, 2011 14:19
jquery events
$(document).ready(function() {
console.log("document loaded.");
$(document).ajaxStart(function() {
console.log(".ajaxStart fired!");
});
$(document).ajaxComplete(function() {
console.log(".ajaxComplete fired!");
});
});