const Moment = require('moment')
const array = [{date:"2018-05-11"},{date:"2018-05-12"},{date:"2018-05-10"}]
const sortedArray = array.sort((a,b) => new Moment(a.date).format('YYYYMMDD') - new Moment(b.date).format('YYYYMMDD'))
console.log(sortedArray)
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 persons = [ | |
{ 'name':'luke', 'age':10}, | |
{ 'name':'leia', 'age':10}, | |
{ 'name':'vader', 'age':40} | |
]; | |
const ascending = x => y => x > y; | |
const ageSort = (x, y) => ascending(x.age)(y.age); |
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 Card = (props) => { | |
return ( | |
<div> | |
<img width="100" src={props.avatar_url} /> | |
<div>{props.name}</div> | |
<div>{props.company}</div> | |
</div> | |
); | |
}; |
'use strict';
const callMock = (object) => new Promise((resolve) => setTimeout(() => resolve(object), 500));
const print = (method, petOne, petTwo) => {
console.log(`Method: ${method}`);
console.log(`PetOne: ${JSON.stringify(petOne)}`);
console.log(`PetTwo: ${JSON.stringify(petTwo)}`);
};
Notepad++ saves these temporary files for only a certain amount of time, so there's no guarantee that you will be able to recover your lost tab, specially if it was closed too long before. But it's still worth a shot to avoid losing work.
- Go to
console %APPDATA%\Notepad++\backups
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 Joi = require('joi') | |
// @see https://github.com/hapijs/joi/blob/v13.0.2/API.md#extendextension | |
const customJoi = Joi.extend((joi) => ({ | |
base: joi.number(), | |
name: 'number', | |
language: { stringify: 'parse number to string' }, | |
pre(value, state, options) { | |
if (this._flags.stringify) return value.toString() | |
return value |
Prereq:
apt-get install zsh
apt-get install git-core
Getting zsh to work in ubuntu is weird, since sh
does not understand the source
command. So, you do this to install zsh
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh