A Pen by Jason Miller on CodePen.
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
/** 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
(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 = [ |
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
/** | |
* Our component structure will look like the following: | |
* - WikiBox | |
* -- AutoCompleteBox | |
* --- AutoComplete | |
*/ | |
/** Renders a single entity coming from wikipedia */ | |
class AutoComplete extends React.Component { | |
render() { |
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 React from 'react'; | |
export class Component extends React.Component { | |
constructor(...args) { | |
super(...args); | |
this.generateBindings(); | |
if (typeof this.init==='function') { | |
this.init(); | |
} | |
} |
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 jpr = new JSONPRequest(); | |
* jpr.onload = (...data) => { | |
* console.log(data); | |
* }; | |
* jpr.open('GET', 'some-url?callback={{callback}}'); | |
* jpr.send(); | |
*/ |
OlderNewer