Skip to content

Instantly share code, notes, and snippets.

View luisherranz's full-sized avatar

Luis Herranz luisherranz

View GitHub Profile
@luisherranz
luisherranz / Proposal.md
Last active June 24, 2019 02:13
Proposal for a redux-like API on top of Mobx
View Proposal.md

I'd got rid of action types and I'd have only actions (action creators). No strings, the function (reference) is used later for comparisons.

export const addTodo = (id, title) => ({ id, title });
export const removeTodo = id => ({ id });
actions({ addTodo, removeTodo }); // Connect it to actions.addTodo & actions.removeTodo.

That's it. They define what your app can do.

View keybase.md

Keybase proof

I hereby claim:

  • I am luisherranz on github.
  • I am luisherranz (https://keybase.io/luisherranz) on keybase.
  • I have a public key whose fingerprint is 4E60 7D36 842D 08BF C759 32D2 74E4 ECA8 7A7D 3D5F

To claim this, I am signing this object:

View attachment-url-to-id.php
<?php
$query = new WP_Query(array(
'post_type' => 'attachment',
'post_status' => 'inherit',
'fields' => 'ids',
'meta_query' => array(
array(
'value' => $file,
'compare' => 'LIKE',
@luisherranz
luisherranz / wordpress
Created September 18, 2018 15:10
Nginx conf file for WordPress + KeyCDN
View wordpress
server {
listen 80;
listen [::]:80;
root /var/www/html;
index index.php index.html index.htm;
server_name www.domain.io origin.www.domain.io;
set $cache_path $request_uri;
client_max_body_size 100M;
@luisherranz
luisherranz / frontity-vip.js
Created December 30, 2019 09:53
Frontity server on VIP Go
View frontity-vip.js
const { server } = require( '@automattic/vip-go' );
const frontity = require( './build/server' );
const myServer = server( frontity );
myServer.listen()
@luisherranz
luisherranz / preact-deep-signal.js
Last active January 5, 2023 17:42
Preact Deep Signals
View preact-deep-signal.js
import { signal } from '@preact/signals';
const proxyToSignals = new WeakMap();
const objToProxy = new WeakMap();
export const deepSignal = (obj) => new Proxy(obj, handlers);
export const options = { returnSignal: /^\$/ };
const handlers = {
get(target, prop, receiver) {