Skip to content

Instantly share code, notes, and snippets.

View paulmelero's full-sized avatar
Creative developer

Paul Melero paulmelero

Creative developer
View GitHub Profile
@developit
developit / *state-machine-component.md
Last active February 6, 2021 00:44
265b lib for building pure functional state machine components. https://github.com/developit/state-machine-component

state-machine-component

A tiny (265 byte) utility to create state machine components using two pure functions.

🔥 JSFiddle Demo

Usage

The API is a single function that accepts 2 pure functions as arguments:

@denisoster
denisoster / nginx.conf
Last active April 13, 2024 12:20
Nginx+RoR(Puma)+Nuxt.js(node.js)+SSL+redirect
upstream icon {
server unix:/home/icon/web/site.ru/icon/shared/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name site.ru www.site.ru;
rewrite ^(.+)$ https://site.ru$uri permanent;
}
@paulmelero
paulmelero / _cols.scss
Last active March 27, 2018 08:15
Dynamic RWD cols
// collections
$CONTAINER-WIDTHS: (
5,
10,
20,
30,
40,
50,
60,
@bsolomon1124
bsolomon1124 / basic.py
Created July 11, 2018 15:49
Demonstrates different LogRecord attributes (formatters)
"""Demonstrates different LogRecord attributes (formatters).
https://docs.python.org/3/library/logging.html#logrecord-attributes
"""
import logging
# Notes
# -----
# pathname: this is relative!
# created: time in seconds since the epoch as a float
@paulmelero
paulmelero / README.md
Last active October 7, 2024 19:45
`copytoclipboard`: Alternative to clipboard.js: Async implementation of "Copy to clipboard" in plain JS. Works in Safari, Chrome, Firefox, Opera and Edge Canary. Less than 1kb minified.

copyToClipBoard.js

copytoclipboard: Alternative to clipboard.js: Async implementation of "Copy to clipboard" in plain JS. Works in Safari, Chrome, Firefox, Opera and Edge Canary. Less than 1kb minified.

copyToClipBoard accepts an html element and returns a Promise.

Copies the content of the html element with the format included and also as plain text (both options).

📦 Install

@jfet97
jfet97 / asyncAwaiterQueue.js
Last active November 9, 2022 11:19
A simple implementation of a promise queue that is temporal independent
class asyncAwaiterQueue {
constructor(...values) {
this.promise = new Promise(resolve => {
this.resolve = resolve;
});
values.forEach(v => this.put(v));
}
@paulmelero
paulmelero / README.md
Last active November 29, 2021 19:02
Simple Debounce Vue 2 Mixin: `simple-debounce-vue-mixin`

SimpleDebounce (Vue Mixin)

If you are listening to changes on an Event (DOM Events) to execute any side effects like performing network requests, you'd probably want to "debounce" your attached function executions.

This is an alternative to lodash.debounce but "vanilla js" packed as a Vue SFC to import it as a mixin.

var s;
function supportsModuleWorkers() {
if (s==null) {
s = false;
try {
new Worker('data:,', Object.defineProperty({}, 'type', {
get() { s = true; }
})).terminate();
} catch (e) {}
}
export const h=(t,p,...c)=>({t,p,c,k:p&&p.key})
export const render=(e,d,t=d.t||(d.t={}),p,r,c,m,y)=>
// arrays
e.map?e.map((e,p)=>render(e,d,t.o&&t.o[p])):
// components
e.t.call?(e.i=render((render.c=e).t(Object.assign({children:e.c},e.p),e.s=t.s||{},t=>
render(Object.assign(e.s,t)&&e,d,e)),t.i||d,t&&t.i||{}),d.t=t=e):(
// create notes
m=t.d||(e.t?document.createElement(e.t):new Text(e.p)),
// diff props