Skip to content

Instantly share code, notes, and snippets.

View hpieroni's full-sized avatar
🏠
Working from home

Hernan Pieroni hpieroni

🏠
Working from home
View GitHub Profile
@hpieroni
hpieroni / .gitconfig
Created November 20, 2020 02:55
.gitconfigs per directory or repo
# As of git version 2.13, git supports conditional configuration includes.
# In this example we clone Company A's repos in ~/company_a directory, and Company B's repos in ~/company_b.
[user]
name = John Smith
email = john.smith@example.com
# If the pattern ends with /, ** will be automatically added.
# For example, the pattern foo/ becomes foo/**. In other words, it matches "foo" and everything inside, recursively.
[includeIf "gitdir:~/company_a/"]
@hpieroni
hpieroni / random-between.js
Last active January 5, 2022 19:30
Returns an integer random number between min (included) and max (included):
function randomBetween(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
const { compose, map, partial } = require('ramda');
const resolveAll = Promise.all.bind(Promise);
const mapAsync = compose(resolveAll, map);
// const mapAsync = fn =>
// compose(
// resolveAll,
// map(fn)
// );
@hpieroni
hpieroni / api.js
Last active February 6, 2023 15:25
Fetch wrapper for json APIs
import { authService } from "../services";
import { fetchJSON } from "./fetch-json";
const BASE_URL = 'https://example.com';
function call(path, options = {}) {
const url = `${BASE_URL}/${path}`;
const token = authService.getToken();
if (token) {