Skip to content

Instantly share code, notes, and snippets.

View DerekNonGeneric's full-sized avatar

Derek Lewis DerekNonGeneric

View GitHub Profile
@DerekNonGeneric
DerekNonGeneric / index.html
Created July 18, 2023 10:15
The Life and Times of a Node.js Release
<!DOCTYPE html>
<html ⚡>
<head>
<meta charset="utf-8" />
<title>The Life and Times of a Node.js Release</title>
<link rel="canonical" href="https://slides.com/danielleadams/nodejs-release-nodeconf-eu-2022" />
<meta name="viewport" content="width=device-width" />
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:
@DerekNonGeneric
DerekNonGeneric / normalizeString-jest-tests.md
Created May 5, 2023 03:15
Jest unit tests in Node.js JavaScript to prove the normalizeString() function's effects

Here are Jest unit tests in Node.js JavaScript to prove the normalizeString() function's effects:

const normalizeString = (str) => str.split('').join('|').replaceAll('|', '');

test('Handles unicode joiner characters', () => {
  const str = 'hello' + '\u00A0' + 'world'; // non-breaking space
  const result = normalizeString(str);
  expect(result).toBe('helloworld'); // Space possibly disturbed

Here are a couple niche cases where the normalizeString() function could have an effect due to re-tokenizing the string:

  1. Unicode joiner/non-breaking space characters: These "invisible" characters are meant to join or provide spaces between characters without breaking lines or strings. Re-splitting and re-joining a string containing them could disrupt their spacing effect. For example:

@DerekNonGeneric
DerekNonGeneric / Correct_GnuPG_Permission.sh
Created November 3, 2022 06:27 — forked from oseme-techguy/Correct_GnuPG_Permission.sh
This fixes the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error while using Gnupg .
#!/usr/bin/env bash
# To fix the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error
# Make sure that the .gnupg directory and its contents is accessibile by your user.
chown -R $(whoami) ~/.gnupg/
# Also correct the permissions and access rights on the directory
chmod 600 ~/.gnupg/*
chmod 700 ~/.gnupg
@DerekNonGeneric
DerekNonGeneric / README.md
Created October 15, 2022 07:20 — forked from dogancelik/README.md
Download all tarballs of an NPM package #npm

Download all tarballs of an NPM package

I will list the methods you can download npm tarballs.

curl + jq + wget

curl -s https://registry.npmjs.org/del | jq -r .versions[].dist.tarball | wget -i -
@DerekNonGeneric
DerekNonGeneric / admonitions-lite.md
Created May 23, 2022 21:09
Legend of HTML entities and Unicode symbols (rendered as text) used for the 3 fundamental callouts

From a Web Performance perspective, I would probably suggest simply using the Unicode symbols for these:

rendered keyword HTML entity
note &#x24D8;
⚠︎ warning &#x26A0;&#xFE0E;[^1]
danger / error &#x24E7;
@DerekNonGeneric
DerekNonGeneric / bash-colors.md
Created February 9, 2022 03:54 — forked from AHaymond/bash-colors.md
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
/* style-darkmode */
@media (prefers-color-scheme: dark) {
:root {
--text: #ddd;
--bg: black;
--unofficial-watermark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cg fill='%23100808' transform='translate(200 200) rotate(-45) translate(-200 -200)' stroke='%23100808' stroke-width='3'%3E%3Ctext x='50%25' y='220' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EUNOFFICIAL%3C/text%3E%3Ctext x='50%25' y='305' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EDRAFT%3C/text%3E%3C/g%3E%3C/svg%3E");
--logo-bg: #1a5e9a;
@DerekNonGeneric
DerekNonGeneric / gap.fish
Created December 28, 2020 19:27
Apply a patch from GitHub URL
#!/usr/bin/fish
#/gap.fish
# Apply a patch from GitHub URL.
# usage: gap <url>
# https://twitter.com/targos89/status/1258779153052184579
function gap
curl -L "$argv[1].patch" | git am -3
end
Logical Physical
Relation (Entity) Table
Unique identifier Primary key
Attribute Column
Tuple Row