Skip to content

Instantly share code, notes, and snippets.

View onildoaguiar's full-sized avatar
:octocat:
building...

Onildo Aguiar onildoaguiar

:octocat:
building...
View GitHub Profile
@onildoaguiar
onildoaguiar / ascendingSort.js
Created November 2, 2018 14:33 — forked from seckBalla/ascendingSort.js
Example of functional sorting an object array by name and age
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);
@onildoaguiar
onildoaguiar / sorting-an-array-by-date-with-moment-js.md
Last active May 21, 2024 15:15
Sorting an array by date with Moment.js
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)
@onildoaguiar
onildoaguiar / promise-all-with-destructuring.md
Created February 27, 2018 20:22
Example of Promise.all with destructuring
'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)}`);
};
@onildoaguiar
onildoaguiar / delete-local-branches-that-do-not-exist-remotely.md
Last active December 27, 2022 17:22
Delete local branches that do not exist remotely

About

Delete local branches that do not exist remotely.

$ git fetch --all --prune; git branch --verbose | grep ": gone]" | awk '{ print $1 }' | xargs --no-tags 1 git branch --delete --force
@onildoaguiar
onildoaguiar / bullet-train-for-oh-my-zsh-on-ubuntu.md
Last active June 18, 2019 16:55
Bullet Train for oh-my-zsh on Ubuntu

About

How to install Bullet Train for oh-my-zsh on Ubuntu.

Install zsh

$ sudo apt-get install zsh
$ sudo apt-get install git-core