Skip to content

Instantly share code, notes, and snippets.

@MariaSolOs
MariaSolOs / builtin-compl.lua
Last active July 24, 2024 06:13
Built-in completion + snippet Neovim setup
---Utility for keymap creation.
---@param lhs string
---@param rhs string|function
---@param opts string|table
---@param mode? string|string[]
local function keymap(lhs, rhs, opts, mode)
opts = type(opts) == 'string' and { desc = opts }
or vim.tbl_extend('error', opts --[[@as table]], { buffer = bufnr })
mode = mode or 'n'
vim.keymap.set(mode, lhs, rhs, opts)

This gist is a simple no-brainer description of the 3 ways (actually 2.5) the Web handle events.

<tag onclick />

The declarative inline HTML event listener is mostly an indirection of DOM Level 0 events, meaning this simply uses the equivalent of tag.onclick = listener behind the scene.

Example

click me
@WebReflection
WebReflection / my-libraries-in-bytes.md
Last active September 24, 2021 22:03
My libraries in bytes

Toward better libraries

I am recently re-branding my libraries as µ (micro), refactoring these when necessary, dropping IE < 11 support, improving the logic where possible, or providing a better, more robust, or faster, API.

In few words, on the right there is the modern version of libraries I've used for the last ~5 years in production or for side projects, and I suggest anyone having one of the earlier dependencies, to have a look at their modern, micro, counterpart.

How to read these tables

All sizes are minified, brotli compressed, and representing these two files, when possible:

@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+
@katef
katef / !knightmare.dot
Last active August 19, 2020 19:06
The Knightmare Challenge (Choose your own adventure), in Graphviz
/*
* The Knightmare Challenge (Choose your own adventure)
* ISBN 0-552-52540-5
*
* Transcribed to graphviz by Kate. I had originally used record
* nodes with ports describing each choice, but the result was
* illegible. What a way to spend an evening.
*/
digraph Knightmare {
#!/usr/bin/awk -f
# This program is a copy of guff, a plot device. https://github.com/silentbicycle/guff
# My copy here is written in awk instead of C, has no compelling benefit.
# Public domain. @thingskatedid
# Run as awk -v x=xyz ... or env variables for stuff?
# Assumptions: the data is evenly spaced along the x-axis
# TODO: moving average
@seunggabi
seunggabi / semantic-branch-names.md
Last active July 9, 2024 03:22
Semantic Branch Names

Semantic Branch Names

See how a minor change to your branch name style can make you a better programmer.

Format: <type>/#<issueNumber>-<alias>

Example

@mikegrima
mikegrima / edit_brave_dictionary.md
Last active June 24, 2024 14:04
Edit Brave Browser Dictionary

Fix Brave Browser Dictionary

If you have ever mistakenly added a word to the Brave browser dictionary, you need to manually edit the Custom Dictionary.txt file.

As of March 2020, the Brave UI lacks a feature to do this.

Where is the file?

This will depend on your OS. Google for where this is on your OS.

The file on macOS is at: ~/Library/Application\ Support/BraveSoftware/Brave-Browser/Default/Custom\ Dictionary.txt.

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