Skip to content

Instantly share code, notes, and snippets.

@AshCoolman
AshCoolman / setup-github-ssh.sh
Created November 5, 2025 09:09
Setup github SSH
#!/usr/bin/env bash
# setup-github-ssh.sh — macOS/Ubuntu. Creates (if needed) an ed25519 key, loads it, and registers it with GitHub via gh (if available).
set -euo pipefail
KEY="${HOME}/.ssh/id_ed25519"
PUB="${KEY}.pub"
EMAIL="${GIT_EMAIL:-}" # optional: export GIT_EMAIL="you@example.com" to tag the key comment
TITLE="${HOSTNAME:-$(hostname)} $(date +%Y-%m-%d)"
OS="$(uname -s || true)"
@AshCoolman
AshCoolman / dp-and-rn.md
Created August 21, 2018 10:50
Device-independent pixels and React Native

Introduction

React Native dimensions are unitless & represent density-independent pixels (abstract pixels, representing a physical distance on the device)

Density-independent pixel (dp)

WARNING: DP (or DiP) not DPI

DP units keep _things roughly the same physical size

@AshCoolman
AshCoolman / yarn-doctor-command-not-found.sh
Created November 6, 2023 11:09
Diagnose why yarn installed package returns "command not found" on CLI
#!/bin/bash
if [ ! -f "package.json" ]; then
echo "No package.json. Run this at your project root."
exit 1
fi
echo -n "Command not found: "
read command
@AshCoolman
AshCoolman / ui-browser.applescript
Created May 25, 2016 18:00
UI Browser.applescript
-- http://hints.macworld.com/article.php?story=20111208191312748
set appname to "1Password" -------------------------- Set this to the App you want to look at
set winstuff to "defaultval"
set menustuff to "defaultval"
tell application appname
activate
end tell
@AshCoolman
AshCoolman / naming-things-is-hard.md
Last active October 21, 2020 05:44
Naming things is hard

Always beware that in English, the use of a past participle as an adjective is ambiguous between transitive and intransitive verbs (and perhaps between active and passive voice). isRecovered might mean that the object has been recovered by something else, or it might mean that the object has recovered. If your object represents a patient at a hospital, does "isRecovered" mean that the patient is fit and well, or that someone has fetched the patient back from the X-ray department? wasRecovered might therefore be better for the latter.

https://stackoverflow.com/questions/3669433/do-you-use-tense-when-naming-methods-of-boolean-return-type

Like this but with attributes/adjectives https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/

If the property/method is a boolean, use isVal() or hasVal().

Language basics

let is just an expression and akin to a function!

let greeting = hello
let greeting = "hi"; /* shadowed */
let scoped = {
@AshCoolman
AshCoolman / Styled utility functions package.md
Last active February 16, 2019 12:27
Styled utility functions package

Styled utility functions package

I try and resist putting stuff in this package. But its just for overflow when theme/markup doesn't cut it, and if I CONTINUALLY reuse some styles.

Package structure

.
├── defaultTheme
│   └── index.js
├── index.js
@AshCoolman
AshCoolman / New Mac installation guide.md
Last active July 25, 2018 06:24 — forked from DenisIzmaylov/INSTALLATION.md
Fresh OSX install guide for Node development (El Capitan version)
@AshCoolman
AshCoolman / Snippets.md
Last active March 28, 2018 10:57
Snippets

Glob

python << EOF
import glob
for name in glob.glob('/*'):
  print(name)
EOF