Running example:
https://codesandbox.io/s/testing-react-context-46hbn
Original idea taken from:
https://kentcdodds.com/blog/how-to-use-react-context-effectively
Running example:
https://codesandbox.io/s/testing-react-context-46hbn
Original idea taken from:
https://kentcdodds.com/blog/how-to-use-react-context-effectively
Pattern for | Link |
---|---|
Phone numbers | https://regex101.com/r/AyWVis/3 |
function number_format(amount, decimals) { | |
amount += ''; // por si pasan un numero en vez de un string | |
amount = parseFloat(amount.replace(/[^0-9\.]/g, '')); // elimino cualquier cosa que no sea numero o punto | |
decimals = decimals || 0; // por si la variable no fue fue pasada | |
// si no es un numero o es igual a cero retorno el mismo cero | |
if (isNaN(amount) || amount === 0) | |
return parseFloat(0).toFixed(decimals); |
const parseArgs = (slice = 0) => { | |
return process.argv.slice(slice).reduce((map, item, index) => { | |
let match = null; | |
switch (true) { | |
case (match = item.match(/^(?:\-\-([a-z]+)|\-([a-z]))(?:=(.+))?$/)) !== null: | |
const [, longName, shortName, value] = match; | |
const parsedValue = typeof value === 'undefined' ? true : value; | |
const parsedName = typeof longName === 'undefined' ? shortName : longName; | |
; | |
(function ($, undefined) { | |
$.fn.handleScroll = (upHandler, downHandler, userOptions) => { | |
const options = $.extend({}, { | |
debug: false | |
}, userOptions); | |
/** | |
* Window object. | |
*/ |
/** | |
* BASIC Authentication | |
* | |
* Simple authentication script intended to be run by Amazon Lambda to | |
* provide Basic HTTP Authentication for a static website hosted in an | |
* Amazon S3 bucket through Couldfront. | |
* | |
* https://hackernoon.com/serverless-password-protecting-a-static-website-in-an-aws-s3-bucket-bfaaa01b8666 | |
*/ |
<?php | |
/** | |
* Set body as HTML. | |
*/ | |
function set_html_content_type() | |
{ | |
return 'text/html'; | |
} |