Skip to content

Instantly share code, notes, and snippets.

View onildoaguiar's full-sized avatar
🎯
Focusing

Onildo Aguiar onildoaguiar

🎯
Focusing
View GitHub Profile
@tsabat
tsabat / zsh.md
Last active October 16, 2024 14:43
Getting oh-my-zsh to work in Ubuntu
@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
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
@lucasvcardoso
lucasvcardoso / How to recover unsaved tabs that were closed in Notepad++.md
Last active December 6, 2021 15:47
How to recover unsaved tabs that were closed in Notepad++

Recover unsaved tabs in Notepad++

ATENTION:

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.

On Windows:

  • Go to console %APPDATA%\Notepad++\backups

Notes:

@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 / 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)}`);
};
const Card = (props) => {
return (
<div>
<img width="100" src={props.avatar_url} />
<div>{props.name}</div>
<div>{props.company}</div>
</div>
);
};
@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)
@seckBalla
seckBalla / ascendingSort.js
Created November 2, 2018 14:23
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);