Skip to content

Instantly share code, notes, and snippets.

View jcblw's full-sized avatar
💤
Don't wake me, my computer is sleeping in.

Jacob Lowe jcblw

💤
Don't wake me, my computer is sleeping in.
View GitHub Profile
@jcblw
jcblw / partial.js
Created February 4, 2014 21:21
using partial functions with .bind
function handle ( err, res ) {
if ( err ) return console.warn( err );
// do stuff
}
$.ajax({
url : '/someurl.json',
// partial ftw - context first argument
// V V
success: handle.bind( null, null ),
@jcblw
jcblw / riversideio.geojson
Last active August 29, 2015 13:57
Riverside.io
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
var MongoClient = require( 'mongodb' ).MongoClient
module.exports = function( url ) {
var db;
MongoClient.connect( url, function(err, db) {
if(err) throw err;
db = db
});
@jcblw
jcblw / getactivity
Last active August 29, 2015 14:06
to get a repos activity for yourself in a certain repo
npm install git-activity stream-json-clipboard -g && echo '\r\n# Jacob is awesome \r\n\r\n alias copy-whatididtoday="git-activity --json --me | stream-json-clipboard -k message --humanize -p \'- \'"' >> ~/.bash_profile
@jcblw
jcblw / Dockerfile
Created September 23, 2014 21:38
Ubuntu 14.04 Nodejs 0.10.32
FROM ubuntu:14.04
# updating and upgrading ---------------------------------------------
RUN apt-get update
# Installs deps ------------------------------------------------------
RUN apt-get install -y build-essential openssl libssl-dev pkg-config monit wget libbz2-dev
# Install Python 2 ---------------------------------------------------
RUN wget http://python.org/ftp/python/2.7.5/Python-2.7.5.tgz
where:(properties["quizId"] == "544ad7a55b824b035018935e") and ((properties["questionId"] == "544ad7acbd58027a597b7870")or not defined (properties["questionId"]))
@jcblw
jcblw / tracking.js
Last active August 29, 2015 14:10
link exit tracking.
window.addEventListener( 'click', function( e ) {
var href = e.target.href;
// this makes the xhr call
trackEvent( 'link exit', e, function( err, res ) {
window.location = href;
} );
} );
@jcblw
jcblw / tracking.js
Last active August 29, 2015 14:10
better link exit tracking
window.addEventListener( 'click', function( e ) {
if ( e.tracked ) return;
var mockEvent = new e.constructor( e.type, e );
mockEvent.tracked = true;
trackEvent( 'link exit', e, function( err, res ) {
e.target.dispatchEvent( mockEvent );
} );
@jcblw
jcblw / full-tracking.js
Last active August 29, 2015 14:10
Link tracking full
window.addEventListener( 'click', function( e ) {
// this means the click has already been canceled
if (e.defaultPrevented) return;
// ensure link
var el = e.target,
origin,
mockEvent,
dispathed;
@jcblw
jcblw / index.js
Created December 13, 2014 00:31
requirebin sketch
var raf = require('raf') // requestAnimationFrame polyfill
var Isomer = require('isomer') // 3ds
var ease = require('ease-component') // easing
// duration of loop / speed of animation
var duration = 2000
// create a canvas element and add it to the page
var canvas = document.createElement('canvas')
var ctx = canvas.getContext('2d')