Skip to content

Instantly share code, notes, and snippets.

Drew Petersen kirbysayshi

View GitHub Profile
@kirbysayshi
kirbysayshi / _README.md
Last active Aug 26, 2015
imports vs require
View _README.md

import is hoisted, meaning transition to import from require can be non-trivial if relying on app-wide dependencies to be initialized before use.

$ npm run import

> import-test@0.0.0 import /Users/drewp/GIT/import-test-gist
> babel-node index-import.js

exec a
exec c
View gist:8960880
$ date && npm cache clean grunt-exec && npm info grunt-exec
Wed Feb 12 12:51:25 EST 2014
npm http GET https://registry.npmjs.org/grunt-exec
npm http 200 https://registry.npmjs.org/grunt-exec
{ name: 'grunt-exec',
description: 'Grunt task for executing shell commands.',
'dist-tags': { latest: '0.4.3' },
versions:
[ '0.1.0',
@kirbysayshi
kirbysayshi / 01-input.vash
Created Feb 19, 2014
future vash syntax tree
View 01-input.vash
@(what)
<img />
<!DOCTYPE html>
Hello, content.
<p @model.attr data-bind="and-how: @model.who <@(model.what)">
@model.things.forEach(function(thing) {
<span>@thing.name</span>
<@model.how>YEP</@model.how>
(function() {
<p></p>
@kirbysayshi
kirbysayshi / index.js
Created Mar 17, 2014
requirebin sketch
View index.js
var elements = require('elements');
var test = require('tape');
var tbc = require('tap-browser-color')();
test('removes duplicate classes', function(t) {
var orig = 'one two \n three \n three';
var node = document.createElement('div');
node.className = orig;
t.ok(node.className === orig, orig);
@kirbysayshi
kirbysayshi / index.js
Created Mar 18, 2014
requirebin sketch
View index.js
var vash = require('vash');
var test = require('tape');
var tbc = require('tap-browser-color')();
test('can handle windows CLRF', function(t) {
var orig = '<p>one two \r\n three \r\n @model.what</p>';
var tpl = vash.compile(orig);
var model = { what: 'what' };
t.equal(tpl(model), '<p>one two \n three \n what</p>');
@kirbysayshi
kirbysayshi / index.js
Created Mar 23, 2014
requirebin sketch
View index.js
var vash = require('vash');
Function.prototype.help = require('fnhelp');
document.body.innerHTML = '<pre>' + vash.loadFile.help() + '</pre>'
View bridgetest.js
var NodeCore = require('node-corejs').NodeCore;
var Spotify = require('node-corejs').Spotify;
var EventEmitter = require('spotify-eventemitter');
var username = process.env.SP_USERNAME;
var password = process.env.SP_PASSWORD;
//console.log(window);
//console.log(window.constructor.prototype.navigator)
View index.js
var bcsv = require('binary-csv')
var bxhr = require('binary-xhr')
var bops = require('bops')
var through = require('through')
var url = require('url')
var createTable = require('data-table')
var insertCSS = require('insert-css')
var concat = require('concat-stream')
insertCSS(createTable.css)
@kirbysayshi
kirbysayshi / index.js
Created Mar 30, 2014
requirebin sketch
View index.js
var bcsv = require('binary-csv')
var bxhr = require('binary-xhr')
var through = require('through')
var url = require('url')
var Buffer = require('buffer').Buffer;
var createTable = require('data-table')
var insertCSS = require('insert-css')
var concat = require('concat-stream')
insertCSS(createTable.css)
@kirbysayshi
kirbysayshi / index.js
Created Apr 15, 2014
requirebin sketch
View index.js
var test = require('tape');
var tbc = require('tap-browser-color')();
var EE = require('events');
/** Module begins here **/
/**
* Given an event emitter, such as a live('spotify:application'),
* listen for 'update' events that contain `arguments` in the emitted
* object. If those arguments match a route, call the route action.
You can’t perform that action at this time.