Skip to content

Instantly share code, notes, and snippets.

gregory tomlinson gtzilla

View GitHub Profile
@gtzilla
gtzilla / module_initialized.commander.js
Last active Dec 2, 2018
Parse alternate to `process.argv`. IF/ELSE loads from CLI and loads from inclusion in another script
View module_initialized.commander.js
/*
initialize from alternate in CLI commander.js script
Included as a module in nodejs
instead of process.argv
https://github.com/tj/commander.js/
*/
if (require.main === module) {
@gtzilla
gtzilla / helpers.js
Last active May 2, 2016
JavaScript closure state manager for a single argument, with support for default state initialization value. A JavaScript private variables method.
View helpers.js
;(function(window) {
'use strict';
/**
filename: helpers.js
author: gregory tomlinson
license: MIT
Be a "utility" helper method
file that is namespaced to 'helpers'
@ColinEberhardt
ColinEberhardt / .block
Last active Aug 23, 2018
d3fc-label-layout map example
View .block
license: mit
@malarkey
malarkey / Contract Killer 3.md
Last active Apr 21, 2019
The latest version of my ‘killer contract’ for web designers and developers
View Contract Killer 3.md

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

View gist:1345636
# FIXME This is a **terrible** hack. This logic should really be
# in the model. It's very difficult to put it there because we
# can only perform index updates here, in the API layer, because
# of the way we mix sync/async code. You should be shaking your
# head in disgust the entire time you read this code and be
# thinking, "What kind of fucking muppet would even think this is
# a good idea?! ZOMG!!"
@gtzilla
gtzilla / regex_compile_test2.js
Created Oct 26, 2011
Regex Test, consistent fail on every other when matching - or !
View regex_compile_test2.js
var raw_str_regex = "-([a-zA-Z0-9_]+)$";
var regex = new RegExp(raw_str_regex, "gm");
var lst = [
"this is -not",
"this is -not",
"this is -not",
"this is -not",
"this is -not",
"this is -not"
View twittercompress.py
""" A script to attempt the compression of written english
to the chinese character set """
import os
from collections import OrderedDict
from math import log
import itertools
from collections import Counter
View monad.py
"""Monads in Python, as close as I can get them to
Haskell
"""
class Monad(object):
def return_(self, value):
raise NotImplementedError()
def __ge__(self, mf):
raise NotImplementedError()
View p.py
def charorquoted(strn):
c = anychar(strn)
if c[0] == '"':
return None
elif c[0] == '\\':
c2 = anychar(c[1])
if c2[0] in ('\\', '"'):
return (c[0] + c2[0], c2[1])
else:
return c
@jsocol
jsocol / php-serve.py
Created Feb 14, 2011
A local dev server for PHP.
View php-serve.py
#!/usr/bin/env python
"""
Add php-serve.py to your PATH, then, from whatever directory is the root
of your PHP application, just run:
$ php-serve.py
You can optionally specify a port number as an argument. By default,
port 8000 is used:
You can’t perform that action at this time.