Skip to content

Instantly share code, notes, and snippets.

View pablen's full-sized avatar

Pablo Enrici pablen

View GitHub Profile
@pablen
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..."
},
@pablen
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
pablen / TP-Link_TD-W8960N_Reboot.sh
Last active January 11, 2019 01:17 — forked from sn1p3r46/TP-Link_TD-W8960N_Reboot.sh
This bash script reboots TP-Link routers
@pablen
pablen / .gitconfig
Last active February 4, 2019 20:25
Globally set git to sign commits. These lines must be present in your ~/.gitconfig
[user]
signingkey = YOUR_HEX_SIGNING_KEY
[commit]
gpgsign = true
[gpg]
program = /Applications/SourceTree.app/Contents/Resources/bin/stgpg.sh
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 https://3Box.io/
@pablen
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 (https://developer.mozilla.org/es/docs/Web/API/MutationObserver).
-- 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"
@pablen
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: !state.show }))}>
{this.state.show ? 'Hide panel' : 'Show panel'}