Form Utils
Moved to its own repo:
https://github.com/jrobinsonc/form-utils
| 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 | |
| { |