Skip to content

Instantly share code, notes, and snippets.

View juanmaguitar's full-sized avatar

JuanMa juanmaguitar

View GitHub Profile
@juanmaguitar
juanmaguitar / index.js
Created August 7, 2024 06:19
MIddleware to log actions gutenberg stores - packages/data/src/redux-store/index.js
// #region loggerMiddleware
const loggerMiddleware = ( optionsLogger ) => ( store ) => ( next ) => {
const actions = [];
return ( action ) => {
const { whatToLog, storeName, storesToLog } = optionsLogger;
if ( storesToLog.includes( storeName ) ) {
if ( whatToLog.includes( 'action' ) ) {
console.log( { storeName, ...action } );
}
if ( whatToLog.includes( 'prevState' ) ) {
<?php
/**
* Plugin Name: Beginner Friendly Playground
* Description: Disables everything that's not really valuable for a first time explorer.
* Version: 0.1.0
* Requires at least: 6.5
*/
defined( 'ABSPATH' ) || exit;
@juanmaguitar
juanmaguitar / __experimental-block-json,txt
Last active April 28, 2023 20:40
use of __experimental in Gutenberg
⬢ gutenberg  trunk ⦾ grep -Rinw . -e '__experimental.*' --include=\block.json
./packages/block-library/src/read-more/block.json:28: "__experimentalFontFamily": true,
./packages/block-library/src/read-more/block.json:29: "__experimentalFontWeight": true,
./packages/block-library/src/read-more/block.json:30: "__experimentalFontStyle": true,
./packages/block-library/src/read-more/block.json:31: "__experimentalTextTransform": true,
./packages/block-library/src/read-more/block.json:32: "__experimentalLetterSpacing": true,
./packages/block-library/src/read-more/block.json:33: "__experimentalTextDecoration": true,
./packages/block-library/src/read-more/block.json:34: "__experimentalDefaultControls": {
./packages/block-library/src/read-more/block.json:42: "__experimentalDefaultControls": {
./packages/block-library/src/read-more/block.json:46: "__experimentalBorder": {
⬢ gutenberg trunk ⦾ grep -Rinw . -e 'new CLIError' --exclude=\*.test.js --exclude=\*npm.js --exclude=\*.json
./packages/create-block/lib/templates.js:106: throw new CLIError( 'Template found but invalid definition provided.' );
./packages/create-block/lib/templates.js:132: throw new CLIError(
./packages/create-block/lib/templates.js:139: throw new CLIError(
./packages/create-block/lib/templates.js:170: throw new CLIError(
const app = require('express')()
app.get('/', (req, res) => res.set('Access-Control-Allow-Origin', '*').status(400).send('ok'))
app.options('/', (req, res) => res.set('Access-Control-Allow-Origin', '*').set('Access-Control-Allow-Headers', 'Authorization').send())
app.listen(8080, () => console.log('server up'))
const assert = require('assert');
/**
* flattenArray
* Flatten an array of arbitrarily nested arrays of integers
* into a flat array of integers
* e.g. [[1,2,[3]],4] -> [1,2,3,4].
*
* @param {array} arrayNested Array to be flattened
*
@juanmaguitar
juanmaguitar / cloudSettings
Created April 4, 2019 21:40
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-04-04T21:40:22.473Z","extensionVersion":"v3.2.7"}

options space=20 font-style=italic font-face=times font-size=10

tabstave notation=true key=B tablature=false notes B/3-C-D-E/4 | notes F-G-A-B/4

options space=20

tabstave notation=true key=B tablature=false

import { lifecycle } from "recompose";
const getPendingMessages = () => {
const randomNumber = Math.ceil(Math.random() * 10);
return new Promise(resolve => {
setTimeout(() => resolve(randomNumber), randomNumber * 1000);
});
};
const withDidMountStateMessages = lifecycle({
import React from "react";
import { compose, setDisplayName } from "recompose";
const withDisplayMessages = WrappedComponent => props => {
const { children, messages, loading, ..._props } = props;
return (
<WrappedComponent {..._props}>
{children}
{loading ? (
<span className="fas fa-spinner fa-pulse"> </span>