Skip to content

Instantly share code, notes, and snippets.

View jrobinsonc's full-sized avatar
🎯
Focusing

Jose Robinson jrobinsonc

🎯
Focusing
View GitHub Profile
@jrobinsonc
jrobinsonc / README.md
Last active October 22, 2021 21:40
Use React Context effectively
@jrobinsonc
jrobinsonc / vscode-psalm-task.md
Last active September 18, 2021 18:39
VSCode task problemMatcher for Psalm

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 / vscode-phpstan-task.md
Last active September 18, 2021 18:39
VSCode task problemMatcher for PHPStan

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 / regex-patterns.md
Last active September 18, 2021 14:53
Regex patterns
@jrobinsonc
jrobinsonc / number-format.js
Last active July 23, 2021 22:09
Funcion para darle formato a un número. #javascript #numbers
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.
*/
@jrobinsonc
jrobinsonc / auth.js
Created June 24, 2021 02:28
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.
/**
* 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 / enable-html.php
Last active May 11, 2021 18:00
WordPress: SMTP configuration
<?php
/**
* Set body as HTML.
*/
function set_html_content_type()
{
return 'text/html';
}
@jrobinsonc
jrobinsonc / README.md
Last active February 8, 2021 15:27
Run PHP and NGROK.

Run PHP and NGROK

Documentation soon.