Skip to content

Instantly share code, notes, and snippets.

@nichoth
nichoth / CYPHERLINK.md
Created March 15, 2024 22:40 — forked from dominictarr/CYPHERLINK.md
Cypherlinks
@nichoth
nichoth / README.md
Created March 15, 2024 17:25
Github markdown
@nichoth
nichoth / sleep.ts
Last active March 28, 2024 19:58
Async sleep — return a promise that waits for ms
/**
* Sleeps for `ms` milliseconds.
* @param {number} ms
* @return {Promise}
*/
async function sleep (ms:number) {
await new Promise((resolve) => {
if (!ms) {
process.nextTick(resolve)
} else {
@nichoth
nichoth / wrapper.css
Last active February 18, 2024 19:07
Sets a max width, adds a consistent gutter and horizontally centers the contents
/*
via https://piccalil.li/quick-tip/use-css-clamp-to-create-a-more-flexible-wrapper-utility/
*/
/**
* WRAPPER
* Sets a max width, adds a consistent gutter and horizontally
* centers the contents
*/
.wrapper {
@nichoth
nichoth / Weekly Summary.md
Last active February 4, 2024 22:35 — forked from paprikka/Weekly Summary.md
Weekly Summary Template (Obsidian)

Carried Over

  • share a new drawing this week

Main Focus

[!NOTE] Progress on work. Don't rush.

It's Friday. I have a rough timeline for my work with XXX and we're discussing the specifics. I'm feeling tired, but not burned out. I feel like I have balance. I published every day. I learned something new (a piece of tech/concept) and I wrote about it. We planned our trip to XXX. I've spoken with my brothers.

@nichoth
nichoth / deploy-succeeded.js
Created February 3, 2024 20:03 — forked from maxboeck/deploy-succeeded.js
publish notes via netlify deploy succeeded event
import fetch from 'node-fetch'
import dotenv from 'dotenv'
import Twitter from 'twitter'
import { decode } from 'html-entities'
dotenv.config()
// URL of notes JSON feed
const NOTES_URL = 'https://mxb.dev/notes.json'
@nichoth
nichoth / box-sizing.css
Last active February 2, 2024 19:25
CSS box sizing
*,
*::before,
*::after {
box-sizing: border-box;
}

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,

@nichoth
nichoth / .npmrc
Created December 20, 2023 20:57
.npmrc
package-lock=false
@ssc-half-light:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}
@nichoth
nichoth / dirname.js
Last active November 11, 2023 08:05
__dirname in module
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);