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
# vim:ft=zsh ts=2 sw=2 sts=2 | |
# | |
# agnoster's Theme - https://gist.github.com/3712874 | |
# A Powerline-inspired theme for ZSH | |
# | |
# # README | |
# | |
# In order for this theme to render correctly, you will need a | |
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts). | |
# Make sure you have a recent version: the code points that Powerline |
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
class Timer { | |
constructor(duration) { | |
const initDuration = (duration || 1) * 60; | |
this.initDuration = initDuration; | |
this.duration = initDuration; | |
this.intervalId = -1; | |
this.interval = 1000; | |
this.displayDuration = `${duration}:00`; | |
} |
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
class Foo { | |
async getData() { | |
try { | |
const f1 = await this.fakeAsyncCall(); | |
const f2 = await this.fakeAsyncCall(); | |
const f3 = await this.fakeAsyncCall(); | |
const f4 = await this.fakeAsyncCall(); | |
console.log(f1, f2, f3, f4); // 'foo data' x 4 |
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
// Variable assignment | |
const getData = async () => { | |
try { | |
const data = await fakeAsyncCall(); | |
console.log(data); // foo data | |
} catch (error) { | |
console.error(`Uh oh: ${error}`); | |
} | |
} |
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
// Variable Assignment | |
const getData = async function () { | |
try { | |
const data = await fakeAsyncCall(); | |
console.log(data); // foo data | |
} catch (error) { | |
console.error(`Uh oh: ${error}`); | |
} | |
}; |
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
async function getData() { | |
try { | |
const data = await fakeAsyncCall(); | |
console.log(data); // foo data | |
} catch (error) { | |
console.error(`Uh oh: ${error}`); | |
} | |
} |
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 fakeAsyncCall(resultText = 'foo data') { | |
return new Promise((resolve, reject) => { | |
if (typeof resultText !== 'string') { | |
return reject('result text should equal string'); | |
} | |
setTimeout(() => { resolve(resultText) }, 1000); | |
}); | |
} | |
async function getData() { |
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
async function getData() { | |
const f1 = await fakeAsyncCall(); | |
const f2 = await fakeAsyncCall(); | |
const f3 = await fakeAsyncCall(); | |
const f4 = await fakeAsyncCall(); | |
console.log(f1, f2, f3, f4); // 'foo data' x 4 | |
} |
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 fakeAsyncCall(resultText = 'foo data') { | |
return new Promise((resolve) => { | |
setTimeout(() => resolve(resultText), 1000); | |
}); | |
} | |
function getData() { | |
fakeAsyncCall() | |
.then(fakeAsyncCall) | |
.then(fakeAsyncCall) |
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 equal(objA, objB) { | |
const sObjA = JSON.stringify(objA); | |
const sObjB = JSON.stringify(objB); | |
return (sObjA === sObjB); | |
} | |
class AppState { | |
constructor(state = {}, components = []) { | |
this.state = state; | |
this.components = components; |
NewerOlder