Skip to content

Instantly share code, notes, and snippets.

Timothy Kempf Fauntleroy

Block or report user

Report or block Fauntleroy

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
@Fauntleroy
Fauntleroy / index.js
Last active Jul 21, 2017
requirebin sketch
View index.js
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
const decomp = require('poly-decomp');
window.decomp = decomp;
const Matter = require('matter-js');
const { PI } = Math;
@Fauntleroy
Fauntleroy / download-mortys.js
Last active Sep 9, 2016
Quick script for downloading mortys from a popular Pocket Mortys website for emoji purposes.
View download-mortys.js
const fs = require('fs');
const _ = require('lodash');
const request = require('request');
const mortyData = require('./morty-data.js');
const MORTY_ICON_BASE_URL = 'https://pocketmortys.net/images/heads';
const downloadMorty = function (morty) {
@Fauntleroy
Fauntleroy / gist:014e94b74fd7d4d5d70c
Created Oct 26, 2014
Poopy asyncSeek method, because <video> doesn't have one by default.
View gist:014e94b74fd7d4d5d70c
var asyncSeek = function( video, time, callback ){
var doneSeeking = function(){
video.removeEventListener( 'seeked', doneSeeking );
if( callback ) callback();
};
video.addEventListener( 'seeked', doneSeeking );
video.currentTime = time;
};
module.exports = asyncSeek;
@Fauntleroy
Fauntleroy / notes.md
Last active Aug 29, 2015
How to find, make, and use GIFs in your daily life
View notes.md
@Fauntleroy
Fauntleroy / comment.js
Last active Jun 23, 2016
Get a random popular Dribbble comment.
View comment.js
var NO_OP = function(){};
// randomly choose one of dribbble's popular shots
// keep choosing until we get one with comments
var getRandomShotId = function( callback ){
var getRandomShot = function( shots ){
var random_index = Math.floor(Math.random()*shots.length);
var shot = shots[random_index];
if( shot.comments_count === 0 ){
return getRandomShot( shots );
@Fauntleroy
Fauntleroy / index.js
Last active Aug 29, 2015
Poopy lil' form value parser
View index.js
var dom = require('domquery');
var domready = require('domready');
var forEach = Array.prototype.forEach;
var getFormData = function( form ){
var form_data = {};
forEach.call( form.elements, function( el, i ){
switch( el.tagName ){
case 'INPUT':
case 'TEXTAREA':
View gist:9868613
Uncaught exception: Error: Firebase.child failed: First argument was an invalid path: "null". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"
Error thrown at line 3, column 2 in g(a) in https://cdn.firebase.com/v0/firebase.js:
throw a;
called from line 275, column 2 in Ia(a, b) in https://cdn.firebase.com/v0/firebase.js:
(!u(b) || 0 === b.length || ya.test(b)) && g(Error(A(a, 1, l) + 'was an invalid path: "' + b + '". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"'))
called from line 3844, column 4 in <anonymous function: H.prototype.F>(a) in https://cdn.firebase.com/v0/firebase.js:
Ia("Firebase.child", a);
called from line 106, column 2 in createUserNode(username) in https://dl.dropboxusercontent.com/u/1330446/geochat/js/scripts.js:
userRef = allUserRef.child(username);
View Tracker.js
// assume this is node.js/browserify land so this is actually private
var next_server_number = function( servers ){
var current_int = 1;
servers = servers.sort( function( a, b ){
return a - b;
});
for( var i = 0; i < servers.length; i++ ){
if( current_int === servers[i] ){
current_int++;
}
@Fauntleroy
Fauntleroy / client.js
Last active Aug 29, 2015
RPC + data stream
View client.js
var rpc = require('rpc-stream');
var engine = require('engine.io-stream');
var rpc_client = rpc();
var engine_stream = engine('/test');
remote = rpc_client.wrap(['addMessage']);
engine_stream
.pipe( rpc_client )
@Fauntleroy
Fauntleroy / Modular.js
Last active Aug 29, 2015
"Modular" self-rendering module example
View Modular.js
var NO_OP = function(){};
var domready = require('domready');
var sizzle = require('sizzle');
var elClass = require('element-class');
var jsonp = require('jsonp');
var xhr = require('xhr');
var Modular = function( config ){
this.url = config.url;
You can’t perform that action at this time.