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
/** | |
* p is pointer | |
* o is object | |
* returns value pointed at by p or undefined | |
*/ | |
(p,o) => p.split("/").slice(1).map(s => s.replace(/~1/g,'/').replace(/~0/g,'~')).reduce((o,k) => o&&o[k], o) | |
( https://twitter.com/hn3000/status/744970555883925504 ) |
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
#!/usr/bin/env node | |
var { Buffer } = require('buffer'); | |
var zlib = require('zlib'); | |
var param = process.argv[2]; | |
var raw = Buffer.from(decodeURIComponent(param), 'base64'); | |
var decoded = zlib.inflateRawSync(raw); | |
console.log(decoded.toString()); |
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
# List of state management libraries | |
https://github.com/mobxjs/mobx | |
https://github.com/mobxjs/mobx-react | |
https://github.com/reflux/refluxjs | |
https://github.com/mattdennewitz/universal-redux-boilerplate | |
https://github.com/olegakbarov/react-redux-starter-kit |
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
1) add the resource into a folder of the wiki repository | |
1a) clone the wiki repo, it's git url can be found on the right hand side of wiki pages | |
1b) create folder, add resource, push to repo | |
2a) add link to resource: [link to pdf](../assets/Filename.pdf) | |
2b) image link: [[assets/image.png]] |
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
// make sure literal conforms to type | |
let var: Type = { | |
prop, | |
prop2: 123, | |
extra: 'value' // will give an error for extra properties | |
}; | |
// make sure properties from type are spelled correctly |
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 aggregate<I, V>( | |
items: I[], | |
valueFun: (i: I) => V, | |
groupingFun: (i: I) => string, | |
combineFun: (v1: V, v2: V) => V | |
): ({ [g:string]: V }) { | |
return items.reduce( | |
(r: { [g: string]: V }, i: I) => { |
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> | |
<title>Numbers ordered by width in Helvetica</title> | |
<style> | |
body { font: 13px Helvetica; } | |
</style> | |
</head> | |
<body> | |
<h1>Sort numbers by Width</h1> |
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 roundToDigits(x,n) { | |
let digits = Math.ceil(Math.log(x) / Math.log(10)); | |
let scale = Math.pow(10, n - digits); | |
return Math.round(x * scale)/scale; | |
} |
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 shallowMerge(a:any, b:any):any { | |
let result:any = {}; | |
let tmp:any = {}; | |
Object.keys(a).forEach((x) => tmp[x]=x); | |
Object.keys(b).forEach((x) => tmp[x]=x); | |
let keys = Object.keys(tmp); | |
for (var k of keys) { | |
result[k] = null != b[k] ? b[k] : a[k]; | |
} |
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
$ code-insiders --list-extensions | |
GregorBiswanger.json2ts | |
Pivotal.vscode-boot-properties | |
abotteram.typescript-react-snippets | |
alefragnani.project-manager | |
alexcvzz.vscode-sqlite | |
Arjun.swagger-viewer | |
bajdzis.vscode-database | |
chrmarti.regex | |
cssho.vscode-svgviewer |
OlderNewer