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
@willurd
willurd / web-servers.md
Last active June 29, 2024 17:26
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
anonymous
anonymous / top-level-domains.js
Created January 29, 2013 11:48
Validate TLDs in JavaScript / Jan 29th, 2013
// 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,
@robertsosinski
robertsosinski / gist:2691813
Created May 14, 2012 04:37
Testing Postgres Listen/Notify using EventMachine
require 'rubygems'
require 'pg'
require 'eventmachine'
module Subscriber
def initialize(pg)
@pg = pg
end
def notify_readable
@boof
boof / traversal.js
Created July 19, 2011 17:09
[WIP] Pure JavaScript implementation of "Document Object Model Traversal".
(function(window, document) {
if ( !window.NodeFilter ) {
var NodeFilter = function() {};
NodeFilter.FILTER_ACCEPT = 1;
NodeFilter.FILTER_REJECT = 2;
NodeFilter.FILTER_SKIP = 3;
NodeFilter.SHOW_ALL = 0xFFFFFFFF;