Skip to content

Instantly share code, notes, and snippets.

Avatar
🦈

Ricardo Canelas ricardocanelas

🦈
View GitHub Profile
@ricardocanelas
ricardocanelas / regex.md
Last active Apr 23, 2021
Regex - Basic information
View regex.md

Reference

Meta Sequences:

  • . (a dot) It denotes “any character except a newline”

Quantifiers:

  • + to the match one character after another.
  • ? is a quantifier by itself (zero or one), but if added after another quantifier (or even itself) it gets another meaning – it switches the matching mode from greedy --> to --> lazy.
View draggable-v0.js
function draggable({ dragElem, zoneElemBefore }) {
const $dragElem = document.querySelector(dragElem)
const $zoneElem = $dragElem.closest(zoneElemBefore)
const margin = 10
$dragElem.onmousedown = function (event) {
if (event.target.tagName === "TEXTAREA") return;
event.preventDefault();
let shiftY = event.clientY - $dragElem.getBoundingClientRect().top;
@ricardocanelas
ricardocanelas / promiseMap.js
Last active Dec 22, 2019
JavaScript - Promise Map
View promiseMap.js
// https://codesandbox.io/s/promisemap-o7f7n
const getData = id =>
new Promise((res, rej) => {
setTimeout(() => {
const data = { id, uid: (Math.random() * 100).toFixed(2) };
console.log("data", data);
res(data);
}, 100);
});
View _vscode.json
// Place your settings in this file to overwrite the default settings
{
"workbench.colorTheme": "Visual Studio Light",
"editor.minimap.enabled": false,
"explorer.confirmDragAndDrop": false,
"files.autoSave": "off",
"window.zoomLevel": 0,
"files.encoding": "utf8",
"editor.tabSize": 2,
"files.trimTrailingWhitespace": true,
View _wordpress-helpers.md
  • getPrevNext();
  • register_post_type
View react-mock.md

package.json

"devDependencies": {
    "enzyme": "^3.3.0",
    "enzyme-adapter-react-16": "^1.1.1",
    "jest-fetch-mock": "^1.4.2",
    "sinon": "^4.4.2",
    "source-map-explorer": "^1.5.0"
@ricardocanelas
ricardocanelas / Kernel.php
Created Sep 3, 2018
Laravel / Locale (middleware)
View Kernel.php
<?php // app/Http/kernel.php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
//...
protected $middlewareGroups = [
View _React Notes.md
@ricardocanelas
ricardocanelas / webpack-3.md
Last active Oct 30, 2017
[NOTE] Webpack 3.0
View webpack-3.md

WEBPACK

SOLUTIONS

import .min files

LOADERS