Skip to content

Instantly share code, notes, and snippets.

View angelxmoreno's full-sized avatar

Angel S. Moreno angelxmoreno

View GitHub Profile
@angelxmoreno
angelxmoreno / Configuring-JavaScript-Tools-ESLint-Prettier-Husky-CommitLint-LintStaged.md
Created January 25, 2024 04:48
ESlint, Prettier, Husky, CommitLint and LintStaged
  1. Install deps
npx husky-init && yarn add -D eslint prettier eslint-config-universe lint-staged @commitlint/cli @commitlint/config-conventional eslint-plugin-md 
  1. Add config rules to your package.json file:
"eslintConfig": {
      "root": true,
      "ignorePatterns": [
@angelxmoreno
angelxmoreno / exchange_token.ts
Created December 13, 2023 22:50
exchange_token
function _encode(obj: object) {
let string = "";
for (const [key, value] of Object.entries(obj)) {
if (!value) continue;
string += `&${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
}
return string.substring(1);
<?php
declare(strict_types=1);
namespace SeoBakery\Test\TestCase\Core;
use Cake\ORM\Table;
use Cake\ORM\TableRegistry;
use Cake\TestSuite\TestCase;
use SeoBakery\Test\SeoObjects\Product;
import {
BeforeCreate,
BeforeUpdate,
Collection,
Entity,
EntityManager,
EntityRepositoryType,
ManyToOne,
OneToMany,
Property,
@angelxmoreno
angelxmoreno / ApiAppController.php
Last active June 18, 2021 02:45
CRUD Not Validating
<?php
namespace App\Controller\Api;
use App\Controller\AppController;
use Crud\Controller\Component\CrudComponent;
use Crud\Controller\ControllerTrait;
use Exception;
/**
* ApiApp Controller
import React from 'react';
import {useField} from 'formik';
import {FormFeedback, FormGroup, Input, Label} from 'reactstrap';
export const InputText = ({label, ...props}) => {
props.type = props.type || 'text';
const [field, meta, helpers] = useField(props);
const id = `${field.name}Input`;
const isInvalid = !!(meta.touched && meta.error);
const errorMsg = meta.error || ' ';
<?php
namespace App\Authentication\Authenticator;
use ArrayAccess;
use Authentication\Authenticator\FormAuthenticator;
use Authentication\Authenticator\Result;
use Authentication\Identifier\IdentifierInterface;
use Cake\Utility\Security;
use Firebase\JWT\JWT;
<?php
namespace App\Authentication\Authenticator;
use Authentication\Authenticator\FormAuthenticator;
use Psr\Http\Message\ServerRequestInterface;
/**
* Class ApiAuthenticator
* @package App\Authentication\Authenticator
<?php
public function getAuthenticationService(ServerRequestInterface $request, ResponseInterface $response)
{
$service = new AuthenticationService();
$fields = [
'username' => 'email',
'password' => 'password'
];
@angelxmoreno
angelxmoreno / linked-entities-composer.json
Created August 31, 2018 20:36
LinkedEntities composer.json
{
"name": "angelxmoreno/cakephp-linked-entities",
"description": "LinkedEntities plugin for CakePHP 3.x",
"homepage": "https://github.com/angelxmoreno/cakephp-linked-entities",
"support": {
"issues": "https://github.com/angelxmoreno/cakephp-linked-entities/issues"
},
"type": "cakephp-plugin",