This file contains hidden or 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
// @flow | |
type Action = | |
| { type: 'FOO' } | |
| { type: 'BAR' }; | |
type ActionKeys = $PropertyType<Action, 'type'>; | |
const fooType: ActionKeys = 'FOO'; | |
const barType: ActionKeys = 'BAR'; | |
const invalidType: ActionKeys = 'ffsdlkfjdaslfj'; // Error |
This file contains hidden or 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 { createSelector } = require('reselect'); | |
const ids = [1,2,3]; | |
const byIds = { | |
1: { | |
name: 'one' | |
}, | |
2: { | |
name: 'two' |
This file contains hidden or 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> | |
<title>Strepsirrhini</title> | |
<meta name="viewport" content="user-scalable=no" /> | |
<style> | |
body { | |
margin: 0; | |
font-size: 1em; |
This file contains hidden or 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> | |
<title></title> | |
<style> | |
body { | |
margin: 0; | |
} | |
.box { | |
display: block; |
This file contains hidden or 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 Tree { | |
constructor(name) { | |
this.name = name; | |
this.children = []; | |
} | |
append(item) { | |
this.children.push(item); | |
} | |
getDescendantNames() { |
This file contains hidden or 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
// StackOverFlow: http://stackoverflow.com/a/30823708/1248952 | |
function getTimer(name, timeout) { | |
return () => new Promise((resolve, reject) => { | |
setTimeout(() => { | |
console.log(name); | |
resolve(); | |
}, timeout); | |
}); | |
} |
This file contains hidden or 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> | |
<meta charset="utf-8"> | |
<title></title> | |
<style media="screen"> | |
#container { | |
position: absolute; | |
top: 0; |
This file contains hidden or 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> | |
<meta charset="utf-8"> | |
<title></title> | |
<style media="screen"> | |
html { | |
scroll-behavior: smooth; | |
min-height: 200%; | |
} |
This file contains hidden or 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
Promise.resolve(100).then(num => { | |
console.log('num: ', num); | |
return num + 100; | |
}).then(num => { | |
console.log('num2:', num); | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
console.log('timeout'); | |
resolve('World'); |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"log" | |
"time" | |
) | |
var ( | |
dateStart = "2016-05-02" |