Skip to content

Instantly share code, notes, and snippets.

View keul's full-sized avatar
🏠
Working from home

Luca Fabbri keul

🏠
Working from home
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
const {isArray} = Array;
const sync = async values => {
for (let {length} = values, i = 0; i < length; i++) {
const value = await values[i];
values[i] = isArray(value) ? await sync(value) : value;
}
return values;
};
@thet
thet / memoize.py
Created November 30, 2020 10:36
plone.memoize helpers with support for plone.subrequest
# -*- coding: utf-8 -*-
# memoize support for plone.subrequest subrequests.
# usage:
# >>> import ./memoize
# >>> from ./memoize import instance_memoize
# >>> @memoize.parent_request_memoize
# >>> def _results(self):
# >>> return "expensive calculation"
# >>>
function CopyButton({ value }) {
let [copied, setCopied] = React.useState();
let hydrated = usePageIsHydrated();
React.useEffect(() => {
let id = setTimeout(() => setCopied(false), 2000);
return () => clearTimeout(id);
}, [copied]);
return (
<button
@WebReflection
WebReflection / uce-vs-lit-element.md
Last active January 8, 2024 07:16
A very simple comparison table between uce and lit-element.

A very simple comparison table between these two libraries.

uce lit-element
version 1.11.9 2.4.0
license ISC (simplified MIT) BSD-3-Clause License
language JS w/ TS definition TS w/ JS transpilation
size ( brotli ) 9437b ES5 / 6811b ES2015+ 8634b ES5 / 6708b ES2015+
@wesbos
wesbos / fake.js
Created September 16, 2020 15:26
fake-your-git-history.js
let currentColor = '#ebedf0';
let clicking = false;
const boxes = document.querySelectorAll('.js-calendar-graph-svg rect');
const graph = document.querySelector('.js-calendar-graph-svg');
// code for switching the current color
function handleColorChange(e) {
const el = e.currentTarget;
currentColor = el.style['background-color'];
console.log(currentColor)
@Phaiax
Phaiax / example_dgram.py
Last active January 5, 2024 08:29
Python AF_UNIX socket / socketserver example (datagram and streaming mode)
"""
LICENSE: MIT
Example of using unix socket in SOCK_DGRAM mode.
"""
import socket
import socketserver
import time
@WebReflection
WebReflection / dom-libraries.md
Last active February 6, 2024 15:50
A recap of my FE / DOM related libraries

My FE/DOM Libraries

a gist to recap the current status, also available as library picker!

Minimalistic Libraries

do one thing only and do it well

  • µhtml (HTML/SVG auto-keyed and manual keyed render)
  • augmentor (hooks for anything)
  • wickedElements (custom elements without custom elements ... wait, what?)
@thet
thet / earchwallpaper.sh
Created November 9, 2018 08:13
World Sunlight Map Wallpaper
#!/bin/bash
#
# Changes the wallpaper hourly and displays a projection of the earth with
# a semi-realistic rendered sunglight mapping.
#
# This script will download hourly the "World Sunlight Map" by die.net.
# You can choose the world_sunlight_wallpaper.jpg picture as background image for your Desktop.
# Gnome recognizes file changes and updates the background accordingly.
#
# See:
@leophys
leophys / git-merge-pick
Last active June 28, 2018 14:46
An extension for git to git-merge a single specified file from another revision
#!/usr/bin/env bash
usage () {
cat << EOH
git merge-pick [flags] <tree-ish> path/to/file
being <tree-ish> a commit-like object (a commit sha1,
a branch name or a tag).
[flags]