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 / shake.js
Created August 29, 2013 22:24
shake?
var shakeThis = function(elem) {
// console.log('left');
$(elem).animate({
left: "-5px"
}, 70, function() {
// console.log('right');
$(elem).animate({
left: "+5px"
}, 70, function() {
// console.log('left');
var Test = Marrow( function Test ( options ) {
this.options = options;
},{
trigger: function ( ) {
this.emit( 'testEvent' );
}
}),
Listener = Marrow( function Listener ( ) { } ),
listener = new Listener( );
@jcblw
jcblw / nvm.sh
Created August 31, 2013 20:41
nvm
# Make zsh glob matching behave same as bash
# This fixes the "zsh: no matches found" errors
if [ ! -z "$(which unsetopt 2>/dev/null)" ]; then
unsetopt nomatch 2>/dev/null
fi
function nvm_set_nullglob {
if type setopt > /dev/null 2>&1; then
# Zsh
setopt NULL_GLOB
@jcblw
jcblw / fileReaderSvg.html
Created September 1, 2013 18:50
loading in a file from filereader into paper js
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Inkscape</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript" src="../../dist/paper.js"></script>
</head>
<body>
<canvas id="canvas" width="400" height="400"></canvas>
@jcblw
jcblw / reply.js
Last active December 22, 2015 06:38
reply functions on event emitters jacoblwe20/marrow
// when attaching to events of a seperate objects, or constructors
// attach a reply function to the end of arguments passes to the handle function
foo.on( bar, 'qux', function ( payload, reply ) {
// i see your payload...
if ( payload ) {
reply( 'Looks good' );
}
});
@jcblw
jcblw / navigate.js
Created September 5, 2013 16:35
navigate in controller
_this.app.router.navigate("/500", {
replace: true,
trigger: true
});
@jcblw
jcblw / index.js
Created December 18, 2013 21:07
commonjs module patterns
var _modules = require('./modules'),
Counter = _modules.Counter,
Entity = _modules.Entity,
app = {};
require( './routes' )( app, function ( err ) {
console.log( typeof app.routes );
} );
@jcblw
jcblw / gettersetter.js
Created December 28, 2013 06:00
Small getter setter pattern
var obj = {
get x() {
return this.value || 5;
},
set x(y) {
this.value = 2 * y
}
};
@jcblw
jcblw / notes.md
Last active January 3, 2016 13:28
git workshop notes

Git Init "Workshop"

initializing git

git is a great tool to keep track of code, and sharing it remotly to others in your team. to start go to your app repo cd ~/effingcoolapp and the run git init what this will do is start up a embedded git database inside of the directory. This directory is now considered to be a git repositiory ( a collection of data versioned by git ). If you look you can see the database/directory created.. use ls -a.

working remote

use the command git remote add name https://repo.example.com to add a remote to you repo so now you have easy push and pull access to a remote repo, also in inverse you can do git remote rm name to remove a branch,

@jcblw
jcblw / matching.js
Created January 19, 2014 01:42
Pattern Matching Pressed Keys
var INPUTS = [0,0,0,0,0];
function loop ( ) {
var pressed = [],
released = [],
keys;
for ( var i = 0; i < INPUTS.length; i += 1 ) {
// parsey stuff