Skip to content

Instantly share code, notes, and snippets.

View franklinjavier's full-sized avatar

Frank franklinjavier

View GitHub Profile
@franklinjavier
franklinjavier / envision.ts
Created April 11, 2024 20:22
envision theme
import twColors from 'tailwindcss/colors'
const colors = {
'brand-50': 'hsl(189 17% 92%)',
'brand-100': 'hsl(188 19% 84%)',
'brand-200': 'hsl(190 18% 68%)',
'brand-300': 'hsl(188 18% 52%)',
'brand-400': 'hsl(189 30% 37%)',
'brand-500': 'hsl(189 68% 21%)',
'brand-600': 'hsl(189 67% 17%)',
https://checkout.belezanaweb.com.br
https://checkout.ckamura.com.br
https://checkout.studiow.com.br
https://checkout.inoar.com.br
https://checkout.oceane.com.br
https://checkout.smashboxatbeleza.com.br
https://checkout.phytoparis.com.br
https://checkout.allthingshair.com
https://checkout.makeupforever.com
https://checkout.nars.com.br
@franklinjavier
franklinjavier / cloudinary.js
Created December 27, 2018 11:39
Regex to get cloudinary transformation from URL
const url = 'https://res.cloudinary.com/beleza-na-web/image/upload/w_1500,f_auto,fl_progressive,q_auto:eco,w_1800,c_limit/e_trim/v1/imagens/5/good-girl-carolina-herrera-eau-de-parfum-perfume-feminino-80ml-38271-1371676352244596349.jpg'
const transformationRE = /(\/(upload|fetch)\/)(.+?)(\/v\d+)/g
const [,,, transformation] = transformationRE.exec(url)
console.log(transformation)
@franklinjavier
franklinjavier / gist:ab06e97e4fb0b1a2b56cbed077ba8028
Created August 24, 2018 17:14
função para validar cartão de crédito
//campo para validação da bandeira de cartão
function getCreditCardLabel(c){
// SOMENTE NÚMEROS
let re = new RegExp("^\d+$");
if (c.match(re) != null)
return false;
let brands = {};
brands["elo"] = {
regexpBin: /^401178|^401179|^431274|^438935|^451416|^457393|^457631|^457632|^504175|^627780|^636297|^636368|^(506699|5067[0-6]\d|50677[0-8])|^(50900\d|5090[1-9]\d|509[1-9]\d{2})|^65003[1-3]|^(65003[5-9]|65004\d|65005[0-1])|^(65040[5-9]|6504[1-3]\d)|^(65048[5-9]|65049\d|6505[0-2]\d|65053 [0-8])|^(65054[1-9]|6505[5-8]\d|65059[0-8])|^(65070\d|65071[0-8])|^65072[0-7]|^(65090[1-9]|65091\d|650920)|^(65165[2-9]|6516[6-7]\d)|^(65500\d|65501\d)|^(65502[1-9]|6550[3-4]\d|65505[0-8])/,
regexpFull: /^(401178|401179|431274|438935|451416|457393|457631|457632|504175|627780|636297|636368|(506699|5067[0-6]\d|50677[0-8])|(50900\d|5090[1-9]\d|509[1-9]\d{2})|65003[1-3]|(65003[5-9]|65004\d|65005[0-1])|(65040[5-9]|6504[1-3]\d)|(65048[5-9]|65049\d|6505[0-2]\d|65053[0-8])|(65054[1-9]| 6505[5-8]\d|65059[0-8])|(65070\d|65071[0-8])|65072[0-7]|(65090[1-9]|65091\d|650920)|(65165[2-9]|6516[6-7]\d)|(65500\d|65501\d)|(65502[1-9]|6550[3-4]\d|65505[0-8]))[0-9]{10,12}/,
regexpCvv: /^\d{3}$/,
};
export default {
elo: ['401178', '401179', '431274', '438935', '451416', '457393', '457631', '457632', '498405', '498410', '498411', '498412', '498418', '498419', '498420', '498421', '498422', '498427', '498428', '498429', '498432', '498433', '498472', '498473', '498487', '498493', '498494', '498497', '498498', '504175', '506699', '506700', '506701', '506702', '506703', '506704', '506705', '506706', '506707', '506708', '506709', '506710', '506711', '506712', '506713', '506714', '506715', '506716', '506717', '506718', '506719', '506720', '506721', '506722', '506723', '506724', '506725', '506726', '506727', '506728', '506729', '506730', '506731', '506732', '506733', '506734', '506735', '506736', '506737', '506738', '506739', '506740', '506741', '506742', '506743', '506744', '506745', '506746', '506747', '506748', '506749', '506750', '506751', '506752', '506753', '506754', '506755', '506756', '506757', '506758', '506759', '506760', '506761', '506762', '506763', '506764', '506765', '506766', '506767', '506768',
@franklinjavier
franklinjavier / api.js
Created March 8, 2018 05:03
api abstraction with axios
import axios from 'axios'
import { shim } from 'promise.prototype.finally'
import locale from 'constants/locale'
import { is } from 'utils'
import { slugify } from 'utils/string'
import { translateNotification } from 'utils/response'
shim()
const axiosInstance = axios.create({
  • cmd+k z -> zen mode
  • cmd+\ -> side-by-side
  • cmd+b -> toggle sidebar
  • cmd+shift+m -> problems panel
  • ctrl+j -> join line
// Errado
// Não queria criar uma tag span desnecessariamente
<ProductName>
<a href={`${baseUrl}/${product.slugName}`} >
<strong dangerouslySetInnerHTML={{__html: product.brand.name}} />{' '}
<span dangerouslySetInnerHTML={{__html: product.name}} />
</a>
</ProductName>
@franklinjavier
franklinjavier / redux-fetch-interceptors.js
Created September 9, 2017 00:56 — forked from jaysoo/redux-fetch-interceptors.js
Redux + fetch interceptors
/*
* WARNING: Mutates the fetchContext argument (by default the window or global context).
*
* A crude way to intercept fetch responses, and dispatch actions as needed. Using this
* for more global app concerns, where I may want to dispatch actions depending on the response
* status or body. e.g. When seeing a 401, dispatch a logout action.
*
* In most cases, I'd recommend using a middlware as shown in redux's real-world example.
* (https://github.com/reactjs/redux/blob/master/examples/real-world/middleware/api.js)
*