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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script> | |
<script type='text/javascript'> | |
/** Get the element with the given id */ | |
function el(id) { return document.getElementById(id); } | |
window.onload = function() { | |
var geocoder = new google.maps.Geocoder(), |
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
/** Returns a simple relative time string | |
* @example | |
* nicetime(new Date()-1e4) == 'Just now' // within the last minute | |
* nicetime(Date.now()-1e6) == '16m' // within the last hour | |
* nicetime(Date.now()-1e7) == '2h' // within the last hour | |
* nicetime('Dec 31, 2014') == '4d' // within the last 7 days | |
* nicetime('Dec 25, 2014') == 'Dec 25' // over 7 days ago gives a simple date | |
* nicetime('July 4, 2014') == 'Jul 4, 2014' // over half a year ago adds the year | |
*/ | |
function nicetime(text) { |
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
template=function(l){var q={},r={_default:function(b){return this[b.value&&b.value.splice?"each":"if"](b)},each:function(b){var h="",a,f=b.value;for(a in f)f.hasOwnProperty(a)&&(h+=l(b.content,f[a],void 0));return h},"if":function(b){return b.value?l(b.content,b.fields,b.overrides):""},"else":function(b){return b.value?"":l(b.content,b.fields,b.overrides)},unless:function(b){return this["else"](b)}};return l=function(b,h,a){var f=/\{\{\{?([#\/\:]?)([^ \{\}\|]+)(?: ([^\{\}\|]*?))?(?:\|([^\{\}]*?))?\}?\}\}/g, | |
g="",c,d,e,m,k=[];a={fields:h||{},overrides:a||q};a.path=(a.overrides.__path__?a.overrides.__path__+".":"")+a.overrides.__key__;for(f.lastIndex=0;d=f.exec(b);){0===k.length&&(g+=b.substring(c||0,f.lastIndex-d[0].length));c=d[1];if(!c||"#"!==c&&":"!==c&&"/"!==c){if(c=d[2],0===k.length)if(e=a.overrides[c]||h[c],null==e)g+=d[0];else{c="{"!==d[0].charAt(2);if(d[4])for(m=d[4].split("|"),d=0;d<m.length;d++)if(helpers.hasOwnProperty(m[d])){"html"===m[d]&&(c=!1);var n=m[d].split(":"),p=helpers[n[0]];"string"=== | |
ty |
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
<input tpl="url" placeholder="http://"> | |
<script src="placeholder.js"></script> | |
<script>[].map.call(document.querySelectorAll('[placeholder]'), placeholder);</script> |
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
// Node style module writ in ES6 syntax: | |
export default foo = () => console.log(‘hi’) | |
// Unfortunately “literally” transpiles to this: | |
exports.default = function foo() { | |
return console.log(‘hi’) | |
} | |
// Which means this will fail: | |
var foo = require(‘./foo’) |
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
/** Slay and pillage an unprotected network! ...oh, we can't do that? | |
* Ok, let's publish an event instead, to a backdrop of flashing lights | |
* and clashing of metal on metal. | |
*/ | |
void vanquishOpenNetwork() { | |
if (!openNetworkCount || !strongest.rssi) { | |
return; | |
} | |
// allow the system to control the LED so we can see cloud connection progress |
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
atom-text-editor::shadow, | |
.tree-view-resizer { | |
::-webkit-scrollbar { | |
width: 2px; | |
height: 2px; | |
} | |
::-webkit-scrollbar-track { | |
background: #1a2127; | |
} | |
::-webkit-scrollbar-thumb { |
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
import mongooseResource from '../lib/mongoose-resource'; | |
import Foo from '../models/foo'; // a mongoose Model | |
export default mongooseResource('foo', Foo); |
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() { | |
var elements = {}; | |
function scan() { | |
[].forEach.call( | |
document.querySelectorAll('template[element]'), | |
function(el) { | |
var name = el.getAttribute('element'), | |
script = el.content.querySelector('script'), | |
js = script.innerHTML; |
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 setImmediate = (function(f, q, p, reg) { | |
q = []; | |
f = document.createElement('iframe'); | |
f.style.cssText = 'position:absolute;top:-999em;left:0;width:1px;height:1px;'; | |
document.body.appendChild(f); | |
function done() { | |
for (var i=0; i<q.length; i++) q[i](); | |
q.length = 0; | |
} | |
p = [ |
OlderNewer