Skip to content

Instantly share code, notes, and snippets.

View gf3's full-sized avatar
🍊
workin' goodly

Gianni Chiappetta gf3

🍊
workin' goodly
View GitHub Profile
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@gf3
gf3 / LOLheritence.js
Created September 29, 2010 03:46
Executable child instances
/* ------------------------------ Main Class ------------------------------ */
// Returns "instances" of itself which are actually functions.
function Ben ( greeting ) { var Parent, scope
function Scope () {
// Here is where you put your normal constructor junk
this.greeting = greeting
this.colours = [ 'yellow', 0xFFFFFF ]
}
// Magic
@rjungemann
rjungemann / Rakefile
Created July 27, 2010 18:38
Install Boehm GC on OS X
# how to install boehm gc on OS X
task :clean do
sh "rm -rf gc" if File.exists?("gc")
end
task :checkout do
#sh "curl -O http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-7.2alpha4.tar.gz"
#sh "tar zxf gc-*.tar.gz && rm gc-*.tar.gz"
#sh "mv gc-* gc"
@gf3
gf3 / gist:328089
Created March 10, 2010 17:06
iTerm Colours
Black: 0, 0, 0
Red: 229, 34, 34
Green: 166, 227, 45
Yellow: 252, 149, 30
Blue: 196, 141, 255
Magenta: 250, 37, 115
Cyan: 103, 217, 240
White: 242, 242, 242
@rjungemann
rjungemann / dispatcher.rb
Created February 26, 2010 03:19
Simple Ruby event dispatcher
# simple event dispatcher implementation
module Evented
class Dispatcher < Array
def call *args; self.each do |e|; e.call *args end end
end
class Dispatchers < Hash
def call name, *args; self[name].call(*args) if self[name] end
end