Skip to content

Instantly share code, notes, and snippets.

View thibaultboursier's full-sized avatar
💻

Thibault thibaultboursier

💻
View GitHub Profile
https://stackblitz.com/edit/typescript-taopb3?file=stories%2Findex.ts
Good resource : https://codepen.io/philipp-spiess/pen/WpQpGr
https://codesandbox.io/s/wml6yXZ2z
https://github.com/konvajs/react-konva/issues/118
@thibaultboursier
thibaultboursier / gist:509bddde6df39142a1febd16f20f8a98
Created July 5, 2017 15:37
Sort object collection by property's value
arr.reduce((previous, current, index) => {
var obj = previous;
var currentValue = current.label.charCodeAt(0);
if (obj.lastValue && obj.lastValue > currentValue) {
obj.sort.splice(index - 1, 0, current);
} else {
obj.sort.push(current);
}
/^[a-z0-9._]+@[a-z0-9._]+\.[a-z]{2,6}$/.test("foo@bar.com");
[{
"name": "Pierre",
"age": 46
}, {
"name": "Laurent",
"age": 18
}, {
"name": "Stéphanie",
"age": "57"
}]