Skip to content

Instantly share code, notes, and snippets.

James Brooks kerspoon

Block or report user

Report or block kerspoon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kerspoon
kerspoon / singlequote.js
Created Apr 8, 2015
convert a javascript file to only contain singlequotes.
View singlequote.js
'use strict';
/*eslint-env node */
var fs = require('fs'),
esprima = require('esprima');
var input = process.argv[2],
output = input,
offset = 0,
content = fs.readFileSync(input, 'utf-8'),
@kerspoon
kerspoon / parsefile.py
Created Nov 3, 2009
Plaintext table parser
View parsefile.py
#! /usr/local/bin/python
from pyparsing import *
import StringIO
from decimal import Decimal
import string
import logging
logger = logging.getLogger(__name__)
@kerspoon
kerspoon / pymisc.py
Created Nov 16, 2009
Python Utilities - replaced by `defaultdict` and `join`
View pymisc.py
#! /usr/bin/env python
# Python Utilities - replaced by `defaultdict` and `join`
import csv
import sys
from itertools import islice
# ---------------------------------------------------------------------------- #
# countedadd :: {set(T)=int}, set(T) -> {set(T)=int}
def countedadd(database,sample):
@kerspoon
kerspoon / template.py
Created Nov 17, 2009
template for python programs
View template.py
#! /usr/local/bin/python
# template for python programs
#------------------------------------------------------------------------------
# Copyright (C) 2009 James Brooks (kerspoon)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 dated June, 1991.
#
View simple perlin noise
#! /usr/local/bin/python
# simple perlin noise
#------------------------------------------------------------------------------
# Copyright (C) 2009 James Brooks (kerspoon)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 dated June, 1991.
#
@kerspoon
kerspoon / escape_as_javascript_string_literal.py
Created Aug 16, 2011
Escape the required characters and surround with double quotes to produce a valid ECMAScript string literal from any normal string.
View escape_as_javascript_string_literal.py
def escape_as_javascript_string_literal(text):
"""
Escape the required characters and surround with double quotes to produce a
valid ECMAScript string literal from any normal string.
----
ECMA-262 -> 7.8.4 String Literals
A string literal is zero or more characters enclosed in single or
View browse-apropos-url.el
;; http://www.emacswiki.org/emacs/BrowseAproposURL
(require 'browse-url)
(setq apropos-url-alist
'(
("^g:? +\\(.*\\)" . ;; Google Web
"http://www.google.com/search?q=\\1")
("^g?w:? +\\(.*\\)" . ;; Google Wikipedia
@kerspoon
kerspoon / globals.js
Created May 15, 2012
Find Added Globals
View globals.js
var GLOBAL_Env = [];
for (var x in window) {
if (window.hasOwnProperty(x)) {
GLOBAL_Env.push(x);
}
}
function GLOBAL_FindAdded() {
var newVars = [];
You can’t perform that action at this time.