Skip to content

Instantly share code, notes, and snippets.

View zeorin's full-sized avatar
🫖
418 I'm a teapot

Xandor Schiefer zeorin

🫖
418 I'm a teapot
  • Pixel Theory
  • Johannesburg, South Africa
  • 15:00 (UTC +02:00)
  • X @zeorin
View GitHub Profile
@WebReflection
WebReflection / esx.md
Last active April 22, 2024 14:12
Proposal: an ESX for JS implementation
@sindresorhus
sindresorhus / esm-package.md
Last active April 30, 2024 04:47
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@r-k-b
r-k-b / _use nixpkgs cypress binary before npms broken copy.md
Last active February 4, 2023 17:11
how to use NixOS's Cypress instead of npm's Cypress

Should help with avoiding errors like:

No version of Cypress is installed in: /home/rkb/.cache/Cypress/6.2.1/Cypress

Please reinstall Cypress by running: cypress install

----------

Cypress executable not found at: /home/rkb/.cache/Cypress/6.2.1/Cypress/Cypress
(defun vulpea-project-p ()
"Return non-nil if current buffer has any todo entry.
TODO entries marked as done are ignored, meaning the this
function returns nil if current buffer contains only completed
tasks."
(seq-find ; (3)
(lambda (type)
(eq type 'todo))
(org-element-map ; (2)
@lucasg
lucasg / dash-doggybag.py
Last active March 3, 2024 20:03
Bulk downloader for dash docsets (official and user contributed)
#!/usr/bin/env python3
import sys
import json
import os
import os.path
import shutil
import logging
import tempfile
import glob
import argparse
@rjw57
rjw57 / pmdown.py
Last active October 23, 2023 02:00
#!/usr/bin/env python3
#
# THIS SCRIPT REQUIRES PYTHON 3
#
# Install requirements via:
# pip3 install docopt pillow reportlab
#
# Dedicated to the public domain where possible.
# See: https://creativecommons.org/publicdomain/zero/1.0/
"""
@paulirish
paulirish / what-forces-layout.md
Last active April 29, 2024 16:45
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@travisbhartwell
travisbhartwell / nix-shell-shebang.md
Last active March 29, 2024 19:55
nix-shell and Shebang Lines

NOTE: a more up-to-date version of this can be found on my blog

nix-shell and Shebang Lines

A few days ago, version 1.9 of the Nix package manager was released. From the release notes:

nix-shell can now be used as a #!-interpreter. This allows you to write scripts that dynamically fetch their own dependencies.

@pstoica
pstoica / OnBlurComponent.jsx
Last active August 1, 2023 21:00
onBlur for entire react element
function OnBlurComponent({ onBlur }) {
const handleBlur = (e) => {
const currentTarget = e.currentTarget;
// Check the newly focused element in the next tick of the event loop
setTimeout(() => {
// Check if the new activeElement is a child of the original container
if (!currentTarget.contains(document.activeElement)) {
// You can invoke a callback or add custom logic here
onBlur();
@staltz
staltz / introrx.md
Last active April 29, 2024 09:25
The introduction to Reactive Programming you've been missing