Skip to content

Instantly share code, notes, and snippets.

View pablen's full-sized avatar

Pablo Enrici pablen

View GitHub Profile
pablen / PubSub.js
Created January 13, 2018 21:16
React PubSub pattern
import React, { Component } from 'react';
import PubSub from 'pubsub-js';
class App extends Component {
state = { show: true };
render() {
return (
<div className="App">
<button onClick={() => this.setState(state => ({ show: ! }))}>
{ ? 'Hide panel' : 'Show panel'}
pablen / Main.elm
Last active March 26, 2022 22:00
DOM mutation observer helper that will run a hook when a DOM node matching a selector is mounted or unmounted. This pattern is particularly useful for working with external JS libraries in your Elm apps, using minimal amount of code. The helper leverages the MutationObserver API (
-- Somewhere in you Elm app you can add editor by adding an empty node with the correct attributes.
-- The JS library will be initialized and destroyed automatically!
view : Model -> Html Msg
view model =
div []
[ div
[ attribute "data-ace" ""
, attribute "data-ace-theme" "monokai"
, attribute "data-ace-mode" "javascript"
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:3:bafyreifhs74s7tknjlurpyjg3vexbq5ksb3v2tijfyiipljhwzfdzupjfi ✅
Create your profile today to start building social connection and trust online at
pablen / .gitconfig
Last active February 4, 2019 20:25
Globally set git to sign commits. These lines must be present in your ~/.gitconfig
gpgsign = true
program = /Applications/
pablen /
Last active January 11, 2019 01:17 — forked from sn1p3r46/
This bash script reboots TP-Link routers
pablen / day4.elm
Created December 4, 2017 12:39
Advent of Code. Day 4. Part 2.
module Main exposing (..)
import Html exposing (text)
import Set
input : String
input =
"""pphsv ojtou brvhsj cer ntfhlra udeh ccgtyzc zoyzmh jum lugbnk
{-- more lines... --}
pablen / AsyncContent.js
Last active September 24, 2015 20:11
Carga de contenido adicional asincrónica y condicional en base al ancho del viewport.
(function(window, document, undefined){
"use strict";
var config = {
selector : "[data-asynccontent-url]",
urlAttr : "data-asynccontent-url",
thrAttr : "data-asynccontent-threshold",
loadTxtAttr : "data-asynccontent-loadtxt",
defaultLoadTxt : "Obteniendo contenido..."