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 string_to_slug (str) { | |
str = str.replace(/^\s+|\s+$/g, ''); // trim | |
str = str.toLowerCase(); | |
// remove accents, swap ñ for n, etc | |
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;"; | |
var to = "aaaaeeeeiiiioooouuuunc------"; | |
for (var i=0, l=from.length ; i<l ; i++) { | |
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i)); | |
} |
## This is a directory/file filter for WinMerge | |
## This filter is a helper for compare 2 laravel proyects in Windows | |
name: Exclude Laravel useless | |
desc: Exclude additional data from Laravel Proyects | |
## This is an inclusive (loose) filter | |
## (it lets through everything not specified) | |
def: include | |
## Filters for filenames begin with f: |
import React, {Component} from 'react'; | |
import {TextInput, View, Keyboard} from 'react-native'; | |
import {Constants, Notifications, Permissions} from 'expo'; | |
export default class Timer extends Component { | |
onSubmit(e) { | |
Keyboard.dismiss(); | |
const localNotification = { | |
title: 'done', |
/****************************************************************************** | |
* Implementation of `Nonempty` validator which checks that the provided type | |
* has at least one defined property, excluding `{}`. | |
******************************************************************************/ | |
type Nonempty<T extends { [key: string]: any }> = { [P in keyof T]: T }[keyof T]; | |
declare function wantsNonempty<T extends { [key: string]: any }>(x: Nonempty<T>): true; | |
wantsNonempty({ x: 1 }); | |
wantsNonempty({}); // error expected |
import * as FormData from "form-data"; | |
base64: string, // it should start with "iVBORw0KGgoA...." instead of "data:image/png;base64," | |
fileName: string // it should include file name and extension, like "saype.jpg" instead of "saype" | |
var formdata = new FormData(); | |
// base64 to buffer, https://stackoverflow.com/questions/37608249/convert-base64-image-to-a-file-in-node-js | |
let bf = Buffer.from(base64, "base64"); |