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 { getRandomWordSync, getRandomWord } = require("word-maker"); | |
const fs = require("fs"); | |
console.log("It works!"); | |
// YOUR CODE HERE | |
//Additional functions | |
//asynchronous in loop |
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 compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args))) | |
// Usage : compose functions right to left | |
// compose(minus8, add10, multiply10)(4) === 42 | |
// | |
// The resulting function can accept as many arguments as the first function does | |
// compose(add2, multiply)(4, 10) === 42 |
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="https://unpkg.com/[email protected]/lib/mobx.umd.js"></script> | |
<script> | |
var MobxDemo = Object.create(HTMLElement.prototype); | |
MobxDemo.attachedCallback = function() { | |
var state = mobx.observable({ | |
counter : parseInt(this.getAttribute("counter")) | |
}) |
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
// Storage decorator base class | |
function StorageDecorator(storage) { | |
this._storage = storage; | |
} | |
StorageDecorator.prototype.getItem = function(key) { | |
return this._storage.getItem(key); | |
} | |
StorageDecorator.prototype.setItem = function(key, value) { | |
return this._storage.setItem(key, value); |
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 Q = require("q"); | |
var HTTP = require("q-http"); | |
function httpReadRetry(url, timeout, times) { | |
return HTTP.read(url) | |
.then(function (content) { | |
return content; | |
}, function (error) { | |
if (times == 0) | |
throw new Error("Can't read " + JSON.stringify(url)); |