Skip to content

Instantly share code, notes, and snippets.

James Padolsey padolsey

Block or report user

Report or block padolsey

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
View ArrayMemberAccessFilter.js
* I reckon computed member access in JS, i.e. ...[...],
* could be a tonne more powerful. This is an example of that.
* ===========================================================
* This is a filthy hack. Probably don't use it...
* ===========================================================
* It sets up a proxy that'll catch member access to arrays.
* Upon member-access, toString will be natively called and
* intercepted; the intercepted value will be used within our
* proxy to return a filtered version of the array.
View number_proxy_range.js = function*(n) {
let finish = n.valueOf();
let start = this.valueOf();
let finishLessThan = start >= finish;
for (
let i = start;
finishLessThan ? i >= finish: i <= finish;
i += finishLessThan ? -1 : +1
) yield i;

Keybase proof

I hereby claim:

  • I am padolsey on github.
  • I am padolsey ( on keybase.
  • I have a public key whose fingerprint is F256 45CF 1A20 5360 6A46 A9AD 599B 1D48 053D 0BD2

To claim this, I am signing this object:

View duino-lcd-play.js
'use strict'
const five = require('johnny-five');
const board = new five.Board();
board.on('ready', () => {
let lcd = new five.LCD({
View assertions.js
var uk = createFuzzyScorer('United Kingdom');
var us = createFuzzyScorer('United States');
uk('United') > uk('uk'),
uk('nited') > uk('ingdom'),
uk('united kingdom') > uk('united kingdo'),
uk('united dom') < uk('united kin'),
uk('knited k') > uk('dom'),
uk('_united_') < uk('united'),
View fuzzysearch.js
// context:
function fuzzysearch(query, text) {
// Build a regex, then test text against it:
return RegExp(
// Escape any special regex characters:
.replace(/[.*+?^${}()|[\]\/\\]/g, '\\$&')
// Any escaped or non-escaped character can be followed by
// any number of other characters (.*):
View TheThing.js
function TheThing() {
TheThing.prototype = { /* ... */ };
View yql_grab.js
// Scrape/Grab page using YQL via JSONP
function grab(url, cb) {
var fn = '__grabber' + +new Date;
var query = 'select * from html where url="{URL}" and xpath="*"';
var yurl = 'http' + (/^https/.test(location.protocol)?'s':'') + '://';
yurl += [
'callback=' + fn,
'q=' + encodeURIComponent(query.replace('{URL}', url))
function git_likely_authority() {
# Outputs a ranked list of likely author(itie)s regarding tracked files matching *${1}*
# (Makes it easier to discover who likely knows most about the matched files)
# (Note: Not always indicative if large refactors/renamings have occurred)
# E.g. `git_likely_authority some_pattern_that_matches_a_path`
git ls-files "*${1}*" |
grep -v -E 'node_modules|vendor' | # edit to avoid certain files/dirs
xargs -n1 git blame --line-porcelain |
sed -n 's/^author //p' |
sort -f |
View english.js
describe(' a tribute ')
.to(' the syntactical hubris of attempting ')
.to(' present logic flows as grammatically coherent ')
it(' is a foolish attempt ')
.for(' it aids aesthetically but limits functionally ')
.truly(' misidentifies ')
.a(' difficulty in the understanding of code ')
.foolishly(' attributing understandability of it to its ')
You can’t perform that action at this time.