Skip to content

Instantly share code, notes, and snippets.

View gnarf's full-sized avatar

Mx Corey Frang gnarf

View GitHub Profile
exports.up = function (knex) {
return knex.schema.createTable('list', function (t) {
t.increments('id');
t.integer('owner_id').notNullable();
t.text('name').notNullable();
t.timestamp('last_modified');
});
};
exports.down = function (knex) {
@gnarf
gnarf / 1-file.txt
Last active August 29, 2015 14:11 — forked from cowboy/1-file.txt
foo bar
baz
qux
last line (there may or may not be a trailing newline after this line)
@gnarf
gnarf / err.js
Last active August 29, 2015 14:15
var clone = require("./").Clone.clone;
function errorLog(err) {
console.error(err);
}
// Look up this known commit.
function getCommit(repo) {
// Use a known commit sha from this repository.
return repo.getCommit("59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5");
sh: napa: command not found
npm ERR! Darwin 14.1.0
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.12.0
npm ERR! npm v2.7.3
npm ERR! code ELIFECYCLE
npm ERR! ember-templates-loader@1.3.0 install: `napa`
npm ERR! Exit status 127
npm ERR!
@gnarf
gnarf / test.js
Last active September 19, 2015 16:01 — forked from tbranyen/test.js
WebComponent Backbone-events like
class CustomElement extends HTMLElement {
constructor() {
super();
}
attachedCallback() {
this.bindEvents();
}
detachedCallback() {
@gnarf
gnarf / gist:842425
Created February 24, 2011 16:46 — forked from dtolj/gist:842417
$(document).ready(function(){
function rem(e){
alert("asdfasdf");
};
$("#remove").click(rem);
});
@gnarf
gnarf / gist:951480
Created May 2, 2011 11:37
widget show/hide function
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
options = options || {};
var hasOptions = !$.isEmptyObject( options ),
effectName = options.effect || defaultEffect;
options.complete = callback;
if (options.delay) {
element.delay( options.delay );
}
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
@gnarf
gnarf / gist:952142
Created May 2, 2011 19:00
fn.promise() the way I saw it
// Get a promise resolved when the currently queued functions complete
promise: function( type ) {
type = type || "fx";
var defer = jQuery.Deferred(),
elements = this,
count = elements.length;
function resolve( next ) {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
@gnarf
gnarf / gist:960850
Created May 7, 2011 21:16
Unit test for bug #9074
test( "animate properties missing px w/ opacity as last (#9074)", 2, function() {
expect( 6 );
stop();
var div = jQuery( "<div style='position: absolute; margin-left: 0; left: 0px;'></div>" )
.appendTo( "#qunit-fixture" );
function cssInt( prop ) {
return parseInt( div.css( prop ), 10 );
}
equal( cssInt( "marginLeft" ), 0, "Margin left is 0" );
equal( cssInt( "left" ), 0, "Left is 0" );
function present( value, array, message ) {
QUnit.push( jQuery.inArray( value, array ) !== -1 , value, array, message );
}
function notPresent( value, array, message ) {
QUnit.push( jQuery.inArray( value, array ) === -1 , value, array, message );
}