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.prototype.bind=(function(){}).bind||function(b){if(typeof this!=="function"){throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");}function c(){}var a=[].slice,f=a.call(arguments,1),e=this,d=function(){return e.apply(this instanceof c?this:b||window,f.concat(a.call(arguments)));};c.prototype=this.prototype;d.prototype=new c();return d;}; |
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
if (!document.querySelectorAll) { | |
document.querySelector = function(selector) { | |
return document.querySelectorAll(selector)[0]; | |
} | |
document.querySelectorAll = function(selector) { | |
if (document.__querySelectorAllStylesheet === undefined) { | |
document.__querySelectorAllStylesheet = document.createStyleSheet(); | |
} |
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
// This is the API for constructing a Glimmer.js application with | |
// precompiled binary bytecode templates and using an async renderer | |
// (via requestAnimationFrame, requestIdleCallback, etc). | |
import Application, { DOMBuilder, AsyncRenderer, BytecodeLoader } from '@glimmer/application'; | |
import data from './__compiled__/data'; | |
let bytecode = fetch('./__compiled__/templates.gbx') | |
.then(req => req.arrayBuffer()); |
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 router = module.exports = require('express').Router(); | |
const items = [] // in-memory 'dummy data source' | |
// Standard CRUD routes: | |
router.get('/', getAll) | |
router.get('/:id', getOne) | |
router.post('/', create) | |
router.put('/:id', update) | |
router.delete('/:id', remove) |
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
@namespace | |
class Math { | |
static abs(x: Number): Number; // Types optional; provide cast on input and assertion on ouptut | |
@nonwritable | |
static LOG10E: Number; | |
// ... | |
} |
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
# Save the built CONTAINER (named myapp), stream via ssh | |
docker save myapp | bzip2 | pv | ssh root@vhost2 'bunzip2 | docker load' | |
# Clone a running INSTANCE, stream via ssh | |
docker export web0 | bzip2 | pv | ssh root@vhost2 'bunzip2 | docker import web0' |
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
// TODO: INSTALL PRE-REQS: `npm install express cors body-parser morgan monk` | |
const http = require('http') | |
const express = require('express') | |
const bodyParser = require('body-parser') | |
const morgan = require('morgan') | |
const cors = require('cors') | |
const app = module.exports = express() | |
const server = http.createServer(app) | |
const port = parseInt(process.env.PORT || 3000) |
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
// Challenge: Refactor the `render()` method with declare all variables at top | |
render() { | |
return ( | |
<li> | |
<div className="profile-card"> | |
<header className="profile-header" onClick={this.toggleClass}> | |
<img src={this.props.profile.image} alt={this.props.profile.name} /> | |
<h2>{this.props.profile.name}</h2> | |
</header> |
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
// @param {function} f The function to execute when DOM is ready | |
function a(f,o,m){o=document,m='addEventListener';o[m]?o[m]('DOMContentLoaded',f):(o=window,o.attachEvent('onload',f));} |
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
module.exports = { createCachedPromise, cacheifyAll }; | |
// TODO: Add Map/WeakMap cache isolation for arguments passed into cacheifyAll's methods | |
/** | |
* Extends all functions on an Object or Class with 'Cached' suffixed methods. | |
* Methods must return promises when called! Won't break existing functions/usage. | |
* | |
* ----- | |
* |