Skip to content

Instantly share code, notes, and snippets.

View makevoid's full-sized avatar

Francesco 'makevoid' Canessa makevoid

View GitHub Profile
@makevoid
makevoid / gist:127643
Created June 11, 2009 01:34
Jquery ping
/**
* ping for jQuery
*
* @auth Jessica
* @link http://www.skiyo.cn/demo/jquery.ping/
*
*/
(function($) {
$.fn.ping = function(options) {
var opts = $.extend({}, $.fn.ping.defaults, options);
require 'net/http'
require 'uri'
# /api/v1/:format/new
# /api/v1/:format/gists/:user
# /api/v1/:format/:gist_id
res = Net::HTTP.post_form(URI.parse('http://gist.github.com/api/v1/xml/new'),
{ 'files[file1.ab]' => 'CONTNETS',
'files[file2.ab]' => 'contents' })
@makevoid
makevoid / gist:113028
Created May 17, 2009 15:05
contstants and inheritance
class Account
def initialize
@host = self.class::HOST
end
end
class A < Account
HOST = "host A"
end
@makevoid
makevoid / gist:112726
Created May 16, 2009 16:17
exception.info
class StandardError
def info
"#{self.class}: #{message}#$/#{backtrace.join($/)}"
end
end
begin
raise "Kaboom!"
rescue RuntimeError => e
puts e.info