Skip to content

Instantly share code, notes, and snippets.

View boof's full-sized avatar

Florian Aßmann boof

  • YNI
  • Hamburg, Germany
View GitHub Profile
// to save bytes...
var T = true;
/* TLDs as of Jan 2013
* For faster lookup we store TLDs as properties of an object.
*
* Source: http://data.iana.org/TLD/tlds-alpha-by-domain.txt
*/
var topLevelDomains = {
'ac':T,'ad':T,'ae':T,'aero':T,'af':T,'ag':T,'ai':T,'al':T,'am':T,'an':T,'ao':T,'aq':T,'ar':T,'arpa':T,'as':T,'asia':T,'at':T,'au':T,'aw':T,'ax':T,'az':T,
@boof
boof / gist:64634
Created February 15, 2009 07:20 — forked from kiko/gist:63801
require 'rubygems'
require 'not_naughty'
# Load the validations you want to use.
NotNaughty::Validation.load 'length', 'presence'
Person = Struct.new(:name) do
extend NotNaughty
validates(:name) { presence and length :minimum => 4 }
end