Bin e padrões para validação de cartão de crédito.
Bandeira | Começa com | Máximo de número | Máximo de número cvc |
---|---|---|---|
Visa | 4 | 13,16 | 3 |
Mastercard | 5 | 16 | 3 |
function createWorkerPool(max) { | |
let current = 0 | |
let queue = [] | |
async function run() { | |
if(current >= max || queue.length === 0) return | |
current++ | |
let action = queue.shift() | |
import React, { useEffect, useState, useCallback } from 'react' | |
function App() { | |
const [user, setUser] = useState(false) | |
const [count, setCount] = useState(0) | |
const valid = useCallback(() => { | |
console.log(count) | |
if(count === 12) { | |
alert("12") |
import Document, { Head, Main, NextScript } from 'next/document'; | |
// Import styled components ServerStyleSheet | |
import { ServerStyleSheet } from 'styled-components'; | |
export default class MyDocument extends Document { | |
static getInitialProps({ renderPage, req }) { | |
// Step 1: Create an instance of ServerStyleSheet | |
const sheet = new ServerStyleSheet(); |
import { Text } from 'react-native' | |
let oldText = Text.render; | |
Text.render = function (...args) { | |
let origin = oldText.call(this, ...args); | |
return React.cloneElement(origin, { | |
style: [{fontFamily: 'Open Sans'}, origin.props.style] | |
}); | |
}; |
import React, { useState } from 'react' | |
function AppHooks() { | |
const [list, setList] = useState([]) | |
function run() { | |
setInterval(() => { | |
list.push(Math.random()) |
import Button from './Button' | |
<Button>Default</Button> | |
<Button inline>Inline</Button> | |
<Button inline primary>Primary</Button> | |
<Button | |
inline |
import bodyParser from 'body-parser'; | |
import compression from 'compression'; | |
import express from 'express'; | |
import cookieParser from 'cookie-parser'; | |
import Loadable from 'react-loadable'; | |
import render from './render'; | |
const app = express(); | |
const PORT = process.env.PORT || 3000; |
#!/bin/bash | |
git add -A | |
git commit -m "$0" | |
git pull | |
git push |