This is a quick example of taking a config file (example.js), and running jscombine.js. It will bundle up regular scripts as well as templates (hard coded to use doT). Compiled templates are automatically added to a "templates" property on the given namespace (ns key in the example file), keyed by a slightly transformed version of their filename.
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
// JS Implementation of https://yave.handmade.network/blogs/p/2723-how_media_molecule_does_serialization | |
// We have to make several changes due to JS's dynamic nature, and lack of type | |
// information, outlined below. | |
// The rules: | |
// 1) Every class/valuetype needs a `serialize_TYPENAME(version, serializer, datum)` | |
// function. This gets around JS not having function overloading as well as the | |
// implicit type annotation that function overloading (in the original C example) |
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
function swiper (root, onUp, onRight, onDown, onLeft) { | |
const touches = []; | |
root.addEventListener('touchstart', stash, false); | |
root.addEventListener('touchmove', stash, false); | |
root.addEventListener('touchcancel', function () { touches.length = 0; }, false); | |
root.addEventListener('touchend', compute, false); | |
// same order at dots below | |
const cbs = [onUp, onRight, onDown, onLeft]; | |
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
/** | |
* A verlet integration circle, a simple physics entity. | |
*/ | |
function Boid(x, y, radius) { | |
this.cpos = { x: x, y: y } | |
this.ppos = { x: x, y: y } | |
this.acel = { x: 0, y: 0 } | |
this.radius = radius; | |
} |
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
flashAvail({ waitFor: 10000 }) | |
.done( function(result){ | |
if(result.flashBlocked === false){ | |
// do whatever you need flash for | |
} else { | |
// flash is installed but blocked. present messaging | |
alert('Oops!', | |
'It appears that Flash is being blocked. \ | |
Flash is required for Grill Circle and Facebook. \ | |
Please enable it and refresh the page.'); |
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
Copyright 2011 Kristopher Michael Kowal. All rights reserved. | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to | |
deal in the Software without restriction, including without limitation the | |
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
sell copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in | |
all copies or substantial portions of the Software. |
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
drew$ ssh -vvv HOSTNAME.COM | |
OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011 | |
debug1: Reading configuration data /Users/drew/.ssh/config | |
debug1: Applying options for *HOSTNAME.COM | |
debug1: Reading configuration data /etc/ssh_config | |
debug1: Applying options for * | |
debug2: ssh_connect: needpriv 0 | |
debug1: Connecting to HOSTNAME.COM [XXX.XXX.XXX.XXX] port 22. | |
debug1: Connection established. | |
debug3: Not a RSA1 key file /Users/drew/.ssh/id_rsa_bt. |
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
/*********** Resets */ | |
div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, | |
pre, form, fieldset, input, textarea, p, blockquote, th, td { margin: 0; padding: 0; } | |
fieldset, img { border: 0; } | |
table { border-collapse: collapse; border-spacing: 0; } | |
ol, ul { list-style: none; } | |
address, caption, cite, code, dfn, em, strong, th, var { font-weight: normal; font-style: normal; } | |
caption, th { text-align: left; } | |
h1, h2, h3, h4, h5, h6 { font-weight: normal; font-size: 100%;} | |
q:before, q:after { content: ''; } |
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
function swiper (root, | |
onUp, onRight, onDown, onLeft, | |
onTap, onHoldStart, onHoldEnd, | |
tapEpsilon | |
) { | |
tapEpsilon = tapEpsilon || 5; | |
let holdRef = null; | |
let hasFiredHold = false; |
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
var assert = require('assert'); | |
function update(root, path, value) { | |
//let id = 0; | |
// shallow clone the root because changing a child necessarily | |
// forces a new root copy? | |
let parent = Array.isArray(root) | |
? Array.from(root) | |
: Object.assign({}, root); |