This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Execute a Backbone View method or function at next animation frame, while | |
* correctly handling multiple requests. | |
* | |
* Caveat: only one anonymous function can be used at a time. Use a named function or method name. | |
* | |
* @example (from a Backbone view): | |
* | |
* this.requestFrame('render') // execute method render of current object | |
* this.requestFrame(this.render) // same as above |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Mousetrap numbers plugin -- add support for 'number' and 'numbers' keywords | |
* | |
* Usage: | |
* | |
* Mousetrap.bind('number', callback) - handle any single number | |
* | |
* Mousetrap.bind('numbers', callback) - handle a sequence of 1+ numbers | |
* | |
* // pre sequence |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* add reset() to Backbone.Model. Note 'id' attribute is kept. | |
* | |
* Unlike Backbone.Collection's native reset, no 'reset' event is fired. | |
* | |
* @param attrs {object} - hash of any new attributes to set, otherwise set to defaults | |
* @param options {object} - options to pass to set() | |
*/ | |
Backbone.Model.prototype.reset = function(attrs, options) { | |
var opts = _.defaults(options || {}, {silent: true}), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// per https://docs.npmjs.com/misc/scripts, npm exposes a bunch of variables to | |
// the environment prefixed with npm_config_*, npm_package_* and npm_lifecycle_*. | |
// Here's a list of all variables exposed in my setup. | |
npm_config_access= | |
npm_config_allow_same_version= | |
npm_config_also= | |
npm_config_always_auth= | |
npm_config_argv='{"remain":[],"cooked":["run","foo"],"original":["run","foo"]}' | |
npm_config_auth_type=legacy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { build } = require('esbuild'); | |
const liveServer = require('live-server'); | |
var watch = require('node-watch'); | |
async function fullBuild() { | |
const builder = await build({ | |
color: true, | |
entryPoints: ['./src/index.js'], | |
outfile: './build/app.js', | |
minify: false, |