Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Jose Robinson jrobinsonc

🎯
Focusing
View GitHub Profile
@jrobinsonc
jrobinsonc / wp-clean.sh
Last active Oct 29, 2021
Clean installation of WordPress using WP CLI
View wp-clean.sh
# Delete all comments
wp comment delete $(wp comment list --format=ids)
# Delete posts revisions
wp post delete --force $(wp post list --post_type='revision' --format=ids)
View README.md

Form Utils

Generic utilities to work with forms. Intended for my own usage but free for anyone who need it.

License

Released under the MIT license.

@jrobinsonc
jrobinsonc / vscode-phpstan-task.md
Last active Sep 18, 2021
VSCode task problemMatcher for PHPStan
View vscode-phpstan-task.md

Use PHPStan to check your PHP files in VSCode

First, install the composer package: composer require --dev phpstan/phpstan.

Then, add this code to your .vscode/tasks.json:

{
  "label": "PhpStan",
 "detail": "Run PhpStan",
@jrobinsonc
jrobinsonc / vscode-psalm-task.md
Last active Sep 18, 2021
VSCode task problemMatcher for Psalm
View vscode-psalm-task.md

Use Psalm to check your PHP files in VSCode

First, install the composer package: composer require --dev vimeo/psalm.

Then, add this code to your .vscode/tasks.json:

{
      "label": "Psalm",
 "detail": "Run Psalm",
@jrobinsonc
jrobinsonc / README.md
Last active Oct 22, 2021
Use React Context effectively
View README.md
View parse-args.js
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;
View jquery.handle-scroll.js
;
(function ($, undefined) {
$.fn.handleScroll = (upHandler, downHandler, userOptions) => {
const options = $.extend({}, {
debug: false
}, userOptions);
/**
* Window object.
*/
@jrobinsonc
jrobinsonc / auth.js
Created Jun 24, 2021
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.
View auth.js
/**
* 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
*/
@jrobinsonc
jrobinsonc / updateEnumField.php
Last active Jan 5, 2021
Simplifies the job of changing the values of a ENUM field. #laravel
View updateEnumField.php
<?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
*/