Skip to content

Instantly share code, notes, and snippets.

View nmccready's full-sized avatar

nmccready nmccready

View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active December 9, 2023 13:46
Pure ESM package
View esm-package.md

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.
@wesbos
wesbos / download-shows.ts
Created November 11, 2020 02:07
deno syntax episode downloader
View download-shows.ts
// deno run --allow-net --allow-write download-shows.ts
import { download } from "https://deno.land/x/download/mod.ts";
const showList = 'https://syntax.fm/api/shows';
async function getShowList(): Promise<Show[]> {
const list = await (await fetch(showList)).json();
return list;
}
View directory_normalize.sh
MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$MY_DIR"
cd ../ # normalize to a known working directory could be ../../
@nmccready
nmccready / arguments.sh
Created April 23, 2019 20:16
argument collector
View arguments.sh
#!/bin/sh
set -e
set -o pipefail
# collect arguments to forward on
while [[ "$#" > 0 ]]; do case $1 in
# example to save value
# -v|--data-volume) shift; dataVolume=$1;; # --data-volume someval
*) args[${#args[@]}]=$1;;
esac; shift; done
@qoomon
qoomon / conventional_commit_messages.md
Last active December 8, 2023 16:27
Conventional Commit Messages
View conventional_commit_messages.md

Conventional Commit Messages

See how a minor change to your commit message style can make a difference. Examples

Have a look at CLI util git-conventional-commits to ensure this conventions and generate changelogs

Commit Formats

Default

@mafintosh
mafintosh / bitcoin-for-laypeople.md
Last active April 1, 2020 12:46
Blog post about how Bitcoin works in a way non computer people can understand it
View bitcoin-for-laypeople.md

Bitcoin for laypeople

(Chinese version available here, courtesy of @jiangplus

(This is an English translation of my Danish blog post, Bitcoin for voksne)

Bitcoin is a digital currency that has no central authority. It's a currency where you do not have to rely on anyone to know it's worth it. As a concept, it's similar to gold. Gold has a value in itself, as opposed to, say a $100 note that only has value if the U.S. government says it has value. Similarly, the idea of ​​Bitcoins is that they have value by themselves.

Let's try to understand how Bitcoin works.

@abbood
abbood / gist:cacd1fd8b485a8abc8c7d5d73f46e993
Created August 11, 2017 13:49
example of automating scripts on multiple tabs on iterm
View gist:cacd1fd8b485a8abc8c7d5d73f46e993
tell application "iTerm"
tell current window
-- create a tab for background db stuff
create tab with default profile
tell current session
write text "mongod &"
write text "redis-server &"
end tell
close current tab
View Process for setting up github pages with namecheap domain.
Process for setting up github pages with namecheap domain.
1. Go to namecheap.com, select and buy domain name.
2. Login to namecheap, go to username drop down and select dashboard.
3. Go to DomainList
4. Click manage button
5. Click Advanced DNS tab
6. Click add record and add three records:
Type: A Record | Host: @ | Value: 192.30.252.153 | TTL: Automatic
@ryu1kn
ryu1kn / Makefile
Last active March 19, 2023 13:02
Encrypt/decrypt with AWS KMS using AWS cli
View Makefile
# How to encrypt/decrypt your text/blob secret with AWS KMS with AWS cli
KEY_ID=alias/my-key
SECRET_BLOB_PATH=fileb://my-secret-blob
SECRET_TEXT="my secret text"
ENCRYPTED_SECRET_AS_BLOB=encrypted_secret_blob
DECRYPTED_SECRET_AS_BLOB=decrypted_secret_blob # Result of decrypt-blob target
encrypt-text:
View how-to-firebase-7-rules.bolt
function isUser (auth, userKey) {
return auth.uid == userKey;
}
function isAdmin (auth) {
return root.child('users').child(auth.uid).child('isAdmin').val() == true;
}
path /users/{uid} {
read() { isUser(auth, uid) || isAdmin(auth) }