Skip to content

Instantly share code, notes, and snippets.

View IgorHalfeld's full-sized avatar
🍀
Making my own luck every day.

Igor Luiz Halfeld IgorHalfeld

🍀
Making my own luck every day.
View GitHub Profile
for line in (cat .env) do
export $line
done
-I
../include
-I
../vendor/include
-std=c++14
-stdlib=libc++
-fPIC
-isystem
/usr/local/include
export const abbreviationNumber = number => {
const qtdMulti = number / 1000;
if (qtdMulti >= 1 && qtdMulti < Math.pow(10, 3)) {
return number / Math.pow(10, 3) + 'K';
}
if (qtdMulti >= Math.pow(10, 3) && qtdMulti < Math.pow(10, 6)) {
return number / Math.pow(10, 6) + 'M';
}
if (qtdMulti >= Math.pow(10, 6) && qtdMulti < Math.pow(10, 9)) {
export function getDiffTimeBetweenCurrentDate (dateString = '', now = new Date()) {
const dayInMilliseconds = 86400000
if ([null, undefined, false, true].includes(dateString)) {
return dateString
}
const date = new Date(dateString)
const isInvalidDate = isNaN(date.getTime())
if (isInvalidDate) {
return dateString
function create () {
const events = {}
function off (n, callback) {
if (!events[n]) {
return
}
events[n] = events[n].filter(fn => fn !== callback)
}
export const kebabToCamel = obj => Object.keys(obj).reduce((acc, cur) => {
return {
...acc,
[camelize(cur)]: buildValue(obj[cur])
}
}, {})
function camelize (property) {
const s = property.split('_')
const capital = s.map((item, index) => {
@IgorHalfeld
IgorHalfeld / setup-vim.sh
Last active October 22, 2020 19:59
Minimum setup for vim on VM
syntax on
set tabstop=2
set shiftwidth=2
set expandtab
set ai
set number
set hlsearch
set ruler
highlight Comment ctermfg=green
const METHODS = ['get', 'post'];
export const createHTTPClient = baseURL => METHODS.reduce((acc, cur) => ({
...acc,
[cur]: async (path, options) => {
const res = await window.fetch(`${baseURL}${path}`, { method: cur.toLowerCase(), ...options });
const json = await res.json();
return json;
},
}), {});
#!/usr/bin/env bash
# gitignore generator
function gi() {
curl -L -s https://www.gitignore.io/api/$@ ;
}
(() => {
let count = 0;
function getAllButtons() {
return document.querySelectorAll('.full-width.artdeco-button.artdeco-button--2.artdeco-button--full.artdeco-button--secondary.ember-view') || [];
}
async function connect() {
const buttons = getAllButtons();