Skip to content

Instantly share code, notes, and snippets.

View JamieMason's full-sized avatar
💤
On a break from OSS for a couple of weeks

Jamie Mason JamieMason

💤
On a break from OSS for a couple of weeks
View GitHub Profile
@JamieMason
JamieMason / unfollow.js.md
Last active April 24, 2024 08:13
Unfollow everyone on twitter.com

Unfollow everyone on twitter.com

  1. Go to https://twitter.com/YOUR_USER_NAME/following
  2. Open the Developer Console. (COMMAND+ALT+I on Mac)
  3. Paste this into the Developer Console and run it
// Unfollow everyone on twitter.com, by Jamie Mason (https://twitter.com/fold_left)
// https://gist.github.com/JamieMason/7580315
//
@JamieMason
JamieMason / html-languages.txt
Created September 19, 2012 08:50
HTML lang attribute / ISO language code reference / Culture names
CULTURE SPEC.CULTURE ENGLISH NAME
--------------------------------------------------------------
Invariant Language (Invariant Country)
af af-ZA Afrikaans
af-ZA af-ZA Afrikaans (South Africa)
ar ar-SA Arabic
ar-AE ar-AE Arabic (U.A.E.)
ar-BH ar-BH Arabic (Bahrain)
ar-DZ ar-DZ Arabic (Algeria)
ar-EG ar-EG Arabic (Egypt)
@JamieMason
JamieMason / is_installed.sh
Last active February 17, 2024 10:12
Check if a program exists from a bash script.Thanks to twitter.com/joshnesbitt and twitter.com/mheap for the help with detecting npm packages.
#!/bin/bash
# Functions ==============================================
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
function program_is_installed {
# set to 1 initially
local return_=1
@JamieMason
JamieMason / download-opensans.sh
Created April 28, 2016 11:08
Download all OpenSans fonts from Google Fonts
#!/usr/bin/env bash
wget -O src/assets/web-fonts/opensans/opensans-light_cyrillic-ext_normal_300 https://fonts.gstatic.com/s/opensans/v13/DXI1ORHCpsQm3Vp6mXoaTQ7aC6SjiAOpAWOKfJDfVRY.woff2
wget -O src/assets/web-fonts/opensans/opensans-light_cyrillic_normal_300 https://fonts.gstatic.com/s/opensans/v13/DXI1ORHCpsQm3Vp6mXoaTRdwxCXfZpKo5kWAx_74bHs.woff2
wget -O src/assets/web-fonts/opensans/opensans-light_greek-ext_normal_300 https://fonts.gstatic.com/s/opensans/v13/DXI1ORHCpsQm3Vp6mXoaTZ6vnaPZw6nYDxM4SVEMFKg.woff2
wget -O src/assets/web-fonts/opensans/opensans-light_greek_normal_300 https://fonts.gstatic.com/s/opensans/v13/DXI1ORHCpsQm3Vp6mXoaTfy1_HTwRwgtl1cPga3Fy3Y.woff2
wget -O src/assets/web-fonts/opensans/opensans-light_vietnamese_normal_300 https://fonts.gstatic.com/s/opensans/v13/DXI1ORHCpsQm3Vp6mXoaTfgrLsWo7Jk1KvZser0olKY.woff2
wget -O src/assets/web-fonts/opensans/opensans-light_latin-ext_normal_300 https://fonts.gstatic.com/s/opensans/v13/DXI1ORHCpsQm3Vp6mXoaTYjoYw3YTyktCCer_ilOlhE.woff2
wget -O src/as
@JamieMason
JamieMason / group-objects-by-property.md
Created September 14, 2018 07:38
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;
@JamieMason
JamieMason / delete-whatsapp-messages.js
Last active January 10, 2024 21:15
Bulk Delete every WhatsApp Chat Message
// Delete every Chat in WhatsApp, by Jamie Mason (https://twitter.com/fold_left)
// https://gist.github.com/JamieMason/f8992ebf95423244b730b2c393c321ef
//
// 1. Go to https://web.whatsapp.com/ and sign in.
// 2. Archive any messages you don't want deleting, you can unarchive them after.
// 3. Open the Developer Console. (COMMAND+ALT+I on Mac)
// 4. Paste this into the Developer Console and run it.
// 5. If it gets stuck, scroll up and down in the list of chats.
// 6. Refresh the page and run again if you have any problems.
// 7. This Script does not Exit Groups or clear messages in them.
@JamieMason
JamieMason / try-rescript.res
Created December 18, 2023 22:04
Try ReScript
// looking at an alternative to ReScript's Option
// which exists at runtime when compiled to JS
type maybe<'a> = {
_tag: [#Some],
value: 'a,
}
let createMaybe = (value: 'a): maybe<'a> => {
{
@JamieMason
JamieMason / to-oxford-comma.md
Last active December 18, 2023 12:33
Format JavaScript Array of Strings to Oxford Comma.

Format JavaScript Array of Strings to Oxford Comma

const toOxfordComma = (array) =>
  array.length === 2
    ? array.join(' and ')
    : array.length > 2
    ? array
        .slice(0, array.length - 1)
 .concat(`and ${array.slice(-1)}`)
@JamieMason
JamieMason / next.config.js.md
Last active November 18, 2023 14:40
Next.js chrome devtools coverage settings

Next.js chrome devtools coverage settings

I found these settings really useful when using the Chrome Devtools Coverage Inspector to look for unused JavaScript in a Next.js App.

Build the app for production with these settings and the output will be easier to debug.

// next.config.js
module.exports = {
 webpack(config) {
@JamieMason
JamieMason / syncpack-dependents.json
Created September 26, 2023 10:02
Projects depending on https://github.com/JamieMason/syncpack, sorted by most stars
[
{ "org": "@pnpm", "repo": "pnpm/pnpm", "stars": 25486, "forks": 790 },
{ "org": "@mantinedev", "repo": "mantinedev/mantine", "stars": 21487, "forks": 1513 },
{ "org": "@BuilderIO", "repo": "BuilderIO/qwik", "stars": 18903, "forks": 1076 },
{ "org": "@microsoft", "repo": "microsoft/fluentui", "stars": 16391, "forks": 2540 },
{ "org": "@microsoft", "repo": "microsoft/pyright", "stars": 10898, "forks": 1172 },
{ "org": "@callstack", "repo": "callstack/linaria", "stars": 10805, "forks": 430 },
{ "org": "@woocommerce", "repo": "woocommerce/woocommerce", "stars": 8728, "forks": 10800 },
{ "org": "@electron", "repo": "electron/forge", "stars": 5816, "forks": 472 },
{ "org": "@altair-graphql", "repo": "altair-graphql/altair", "stars": 4828, "forks": 272 },