Skip to content

Instantly share code, notes, and snippets.

View crisgon's full-sized avatar
:octocat:
Work hard!

Cristiano Gonçalves crisgon

:octocat:
Work hard!
View GitHub Profile
export function creditCardMask(num: string) {
num = num.replace(/[^0-9]/g, "");
num = num.replace(/(\d{4})(\d)/, "$1 $2");
num = num.replace(/(\d{4})(\d)/, "$1 $2");
num = num.replace(/(\d{4})(\d)/, "$1 $2");
return num;
}
export function cpfMask(num: string) {
num = num.replace(/[^0-9]/g, "");
import React, { useState, useEffect, useMemo } from "react";
import { Link, useLocation } from "react-router-dom";
import cn from "classnames";
import { Icon } from "antd";
import { ArrowNav } from "../../NavSVGS";
import s from "./style.scss";
interface Props {
{
"html": [
{
"title": "Todas as tags",
"status": false
},
{
"title": "Semântica",
"status": false
},
function validateOfferMan(){
var bonusPL = document.getElementById("inputbonusPL").checked;
var bonusRescue = document.getElementById("inputbonusRescue").checked;
var bonusMonths = document.getElementById("inputbonusMonths").checked;
var offer10da = document.getElementById("inputOffer10da").checked;
var bonus1real = document.getElementById("inputBonus1real").checked;
var offerPoints = document.getElementById("inputofferPoints").checked;
var offers = bonusPL + bonusRescue + bonusMonths + offer10da + bonus1real + offerPoints;
function myFunction() {
let a = 2;
function otherFunction() {
console.log( a + b );
}
otherFunction();
}
let b = 3;
myFunction(); // 5
function myFunction() {
 let a = b;
 console.log(a); 
}
myFunction(); // Reference Error
function myFunction() {
 let a = 42;
}
myFunction();
console.log(a); // Reference Error
function myFunction() {
 a = 42;
 console.log(a); 
}
myFunction(); // 42
@crisgon
crisgon / wikipedia.js
Created March 27, 2018 01:51
Wikipedia FreeCodeCamp
(function(win, doc){
'use strict';
const $ = document.querySelector.bind(document);
const $url = "https://en.wikipedia.org/w/api.php?&origin=*&action=opensearch&namespace=0&limit=50&search=";
const $input_search = $('.input-search');
const $button_search = $('.button-search');
const $result_list = $('.results');
let results = [];
@crisgon
crisgon / challenge-28.js
Created March 14, 2018 18:18
Usando uma API de Ceps
(function(win, doc){
'use strict';
let formAdress = {
cep: doc.querySelector('[data-js="cep"]'),
state: doc.querySelector('[data-js="state"]'),
city: doc.querySelector('[data-js="city"]'),
street: doc.querySelector('[data-js="street"]'),
district: doc.querySelector('[data-js="district"]')
}