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 / angularjs-providers-explained.md
Created May 12, 2017 00:34 — forked from demisx/angularjs-providers-explained.md
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@anteriovieira
anteriovieira / DeleteFiles.vbs
Last active July 18, 2017 02:59
Scripts VBS
' Remove arquivos de logs antigos
On Error Resume Next
Set aArgs = WScript.Arguments
Set oFileSys = WScript.CreateObject("Scripting.FileSystemObject")
today = Date
' Informe a extensão dos arquivos que deseja
' remover separados por virgula.
<template>
<div></div>
</template>
<script>
import {kebabCase} from 'lodash';
export default {
bindings: {type: '<'},
controller: class ComponentCtrl {
@anteriovieira
anteriovieira / SetAccessToken
Last active September 25, 2017 12:30
Postman
var teste_token = false;
if (responseCode.code === 200) {
var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable("access_token", jsonData["access_token"]);
teste_token = true;
}
@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
@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 / 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('./')
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]));
};
{
"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,