[ Launch: abpp ] 8464116 by jdelight
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 loadImage = (src) => { | |
return new Promise(function(resolve, reject) { | |
var proxyImage = new Image(); | |
proxyImage.onload = function(){ | |
console.log('resolving', src); | |
resolve(src); | |
}; | |
proxyImage.onerror = function(){ |
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
/* | |
Takes an array of items with each "," representing 100ms. | |
Subscribers can map or filter over the Observable. | |
Only when forEach is called do they start | |
getting data (with the transformations applied) over time. | |
Usage: | |
var subscriber = FakeObservable([10, , , 3, , , 8, , , , , 2, 18, 9]).subscribe(); | |
subscriber.filter(function (item) { |
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
// { days } creates the variable days from the default object {days: 7} | |
function get_date_range({ days } = {days: 7}) { | |
let end = Date.now(); | |
let period = days * 24 * 60 * 60 * 1000; | |
let start = end - period; | |
let start_date = new Date(start).toISOString(); // returns the date in ISO8601 format in UTC 0 | |
let end_date = new Date(end).toISOString(); | |
console.log(start_date, '-', end_date); | |
return [start_date, end_date]; |
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 o = {length: 12}; | |
var a = []; | |
var f = function(){}; | |
var b = true; | |
var r = /^abc/; | |
var n = 0; | |
var u = void 0; | |
var l = null; | |
console.log(toString.call(o)); // [object Object] |
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 prefix(initFn, mainFn) { | |
return function(){ | |
var func = initFn; | |
initFn = mainFn; | |
return func.apply(this, arguments); | |
} | |
} | |
function add(a, b){ | |
return a + b; |
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
define([ | |
'src/urls' | |
], function( | |
urls | |
) { | |
'use strict'; | |
var slice = Array.prototype.slice; | |
return function url(name) { |
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
/** | |
* Block iteration | |
* @description Repeat a block a given amount of times. | |
* @example | |
* {{#iterate 20}} | |
* <li>List Item {{@index}}</li> | |
* {{/iterate}} | |
*/ | |
Handlebars.registerHelper('iterate', function (n, block) { | |
var accum = '', data; |
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://code.jquery.com/jquery-2.1.1.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
.window { | |
height: 105px; | |
overflow-y: scroll; |