Skip to content

Instantly share code, notes, and snippets.

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

Antério Vieira anteriovieira

🏠
Working from home
View GitHub Profile
@anteriovieira
anteriovieira / capitalize.js
Created September 21, 2021 12:32 — forked from xiCO2k/capitalize.js
Capitalize Helper
const capitalize = str => str.replace(/^\w|\s\w/g, char => char.toUpperCase());
@anteriovieira
anteriovieira / format-object.js
Created January 14, 2021 01:05 — forked from Akryum/format-object.js
Format a JS object or array to JavaScript source code string
const KEY_ESCAPE_REG = /[\s-.:|#@$£*%]/
const MAX_SINGLE_LINE_ARRAY_LENGTH = 3
export function formatObjectToSource (obj) {
return printLines(Array.isArray(obj) ? arrayToSourceLines(obj) : objectToSourceLines(obj))
}
function objectToSourceLines (object, indentCount = 0) {
return createLines(indentCount, lines => {
lines.push('{')
@anteriovieira
anteriovieira / aegon.js
Created December 2, 2020 18:05
Aegon Script
function AEGON(market, attribute, option, refresh_cell) {
// Sanitize input
var market = (market+"") || "";
var attribute = (attribute+"") || "";
var option = (option+"") || "";
// Get user anonymous token (https://developers.google.com/apps-script/reference/base/session#getTemporaryActiveUserKey())
// Mandatory to authenticate request origin
var GSUUID = encodeURIComponent(Session.getTemporaryActiveUserKey());
@anteriovieira
anteriovieira / gist:5aba12a3425f2d1737302df1f978e9aa
Created November 27, 2020 20:44 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
{
"data": [
{
"id": "1",
"first_name": "John",
"last_name": "Doe",
"avatar_url": "https://i.pravatar.cc/400?u=johondoe",
"handle": "jhon_doe",
"metrics": {
"overall_score": 0,
const equals = (a, b) => {
if (a === b) return true;
if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();
if (!a || !b || (typeof a !== 'object' && typeof b !== 'object')) return a === b;
if (a === null || a === undefined || b === null || b === undefined) return false;
if (a.prototype !== b.prototype) return false;
let keys = Object.keys(a);
if (keys.length !== Object.keys(b).length) return false;
return keys.every(k => equals(a[k], b[k]));
};
@anteriovieira
anteriovieira / Create.js
Last active February 4, 2018 22:30
Files
console.clear()
const {lstatSync, readdirSync, writeFileSync, unlinkSync} = require('fs')
const glob = require('glob')
const {join} = require('path')
const isDirectory = source => lstatSync(source).isDirectory
const getDirectories = source =>
readdirSync(source).map(name => join(source, name)).filter(isDirectory)
const directories = getDirectories('./')
@anteriovieira
anteriovieira / profile.js
Created November 28, 2017 22:18 — forked from ericelliott/profile.js
A good enough profile script to compare two versions of a fibonacci generator.
import iterativefib from 'iterativefib';
import memofib from 'memofib';
import range from 'test/helpers/range';
const nsTime = (hrtime) => hrtime[0] * 1e9 + hrtime[1];
const profile = () => {
const numbers = 79;
const msg = `Profile with ${ numbers } numbers`;
@anteriovieira
anteriovieira / profile.js
Created November 28, 2017 22:18 — forked from ericelliott/profile.js
A good enough profile script to compare two versions of a fibonacci generator.
import iterativefib from 'iterativefib';
import memofib from 'memofib';
import range from 'test/helpers/range';
const nsTime = (hrtime) => hrtime[0] * 1e9 + hrtime[1];
const profile = () => {
const numbers = 79;
const msg = `Profile with ${ numbers } numbers`;
@anteriovieira
anteriovieira / .bashrc.sh
Last active October 12, 2017 16:09
Prompt
# Show git branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\[\033[00m\]\[\033[01;34m\]\w\[\033[01;32m\]$(parse_git_branch)\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi