Pattern for | Link |
---|---|
Phone numbers | https://regex101.com/r/AyWVis/3 |
Running example:
https://codesandbox.io/s/testing-react-context-46hbn
Original idea taken from:
https://kentcdodds.com/blog/how-to-use-react-context-effectively
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; | |
(function ($, undefined) { | |
$.fn.handleScroll = (upHandler, downHandler, userOptions) => { | |
const options = $.extend({}, { | |
debug: false | |
}, userOptions); | |
/** | |
* Window object. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Update enum column | |
* | |
* @param string $tableName Table to update. | |
* @param string $columnName Column to update. | |
* @param array $values Values for ENUM column. | |
* @return void | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Helpers; | |
use App\Helpers\StorageHelper; | |
use RuntimeException; | |
use InvalidArgumentException; | |
class FileHelper | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Generate random password | |
* | |
* @see <https://gist.github.com/jrobinsonc/ef4245a6e915a038f108e12980ac24bc> | |
* @param int $len Number of characters the password should have. | |
* @param string $types Types of characters the password should have. | |
* Options are: l for lowercase, u for uppercase, d for digital, s for special. | |
* @return string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage | |
# ./slack <channel> <message> | |
# ./slack @jrobinson "Test message for a user" | |
# ./slack #general "Test message for a channel" | |
CHANNEL=$1 | |
MSG=$2 |