Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Working hard

Franklin Javier franklinjavier

🚀
Working hard
View GitHub Profile
View gist:f04ae13e85ecadcd7e977b4d73fee993
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 Dec 27, 2018
Regex to get cloudinary transformation from URL
View cloudinary.js
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 Aug 24, 2018
função para validar cartão de crédito
View gist:ab06e97e4fb0b1a2b56cbed077ba8028
//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;
View getCardBrand.js
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}$/,
};
View bins.js
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 Mar 8, 2018
api abstraction with axios
View api.js
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({
View _shortcuts.md
  • cmd+k z -> zen mode
  • cmd+\ -> side-by-side
  • cmd+b -> toggle sidebar
  • cmd+shift+m -> problems panel
  • ctrl+j -> join line
View escape.jsx
// 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>
View redux-fetch-interceptors.js
/*
* 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)
*
View Preferences.sublime-settings
{
"always_show_minimap_viewport": false,
"bold_folder_labels": false,
"color_scheme": "Packages/User/SublimeLinter/Material-Theme-Darker-OceanicNext (SL).tmTheme",
"ensure_newline_at_eof_on_save": true,
"extra_file_exclude_patterns":
[
"*.pyc",
"*.pyo",
"*.exe",