Skip to content

Instantly share code, notes, and snippets.

View codephi's full-sized avatar

Philippe Assis codephi

View GitHub Profile
@codephi
codephi / Nodejs: Teste de loop e callback's
Last active May 16, 2017 14:42
O resultado final deve ser 550, independente o index da iteração. Online test: https://runkit.com/philippeassis/591b0f3ae1482900125159b9
var Promise = require("promise-with-queue"),
val = 0, position = 0;
var loop = (index, callback) => {
setTimeout(() => {
val += index * 10;
console.log("loop | index:", index, "val:", val)
++position;
callback(val)
}, Math.floor(Math.random() * (500 - 2000) + 500))
@codephi
codephi / getAllRoutesPHPSlim
Last active March 16, 2018 17:37
Lista todas as rotas slim php a partir de um diretório
#!/usr/bin/python3
'''
Author: assis@pagzoop.com
Usage: getAllRoutes.py [options] path
Options:
-h, --help show this help message and exit
--quote=QUOTE Quotation marks
'''
import os, sys
import re
{
//O client e env ID é para saber sobre que marketplace o ec será cadastrado.
client_id: client_id,
env_id: env_id,
email: email do usuario,
password: senha,
name: Nome Completo,
ein: CPF do Usuário,
cellphone: Numero de telefone da empresa ou pessoa fisica,
@codephi
codephi / usePromise.js
Created December 6, 2019 06:51
usePromise is a React hook. It ensures that you will not experience memory leak after unmont component. See it working at: https://codesandbox.io/embed/youthful-wilbur-eu9bb?expanddevtools=1&fontsize=14&hidenavigation=1&theme=dark
import { useCallback, useRef, useEffect } from 'react'
export function usePromise (promiseFn) {
const mountedRef = useRef(false)
const isMounted = useCallback(() => mountedRef.current, [])
useEffect(() => {
mountedRef.current = true
return () => {
@codephi
codephi / background.css
Created March 14, 2024 16:56
Background
html {
font: 5vmin/1.3 Serif;
overflow: hidden;
background: #123; }
body, head {
display: block;
font-size: 52px;
color: transparent; }