Skip to content

Instantly share code, notes, and snippets.

View zakmandhro's full-sized avatar
💻
Building Pullflow (pullflow.com)

Zak Mandhro zakmandhro

💻
Building Pullflow (pullflow.com)
  • San Francisco, CA
View GitHub Profile
@zakmandhro
zakmandhro / nn.zsh
Last active September 26, 2024 23:42
Run appropriate package manager (`yarn`, `npm`, or `pnpm`) with single `nn` command
# run the appropriate package manager
npm-etc() {
if [[ -f package-lock.json ]]; then
npm run "$@"
elif [[ -f yarn.lock ]]; then
yarn "$@"
elif [[ -f pnpm-lock.yaml ]]; then
pnpm "$@"
else
echo "Error: Could not detect package manager."
@zakmandhro
zakmandhro / const_module_arrow_vs_function.ts
Last active January 17, 2022 16:45
Show the difference in methods use to namespace functions in const
const WithFunc = {
description: "Hello",
classicFunction() {
console.log(this.description, "description") // works but can lead to 'this' confusion
return "classicFunction"
}
}
const WithConst = {
description: "Hello",
@zakmandhro
zakmandhro / inline_block.scss
Created May 18, 2011 18:35
Cross-browser inline block (SASS mixin)
@mixin inline-block {
display: -moz-inline-stack; // ff 2
display: inline-block;
zoom:1; *display: inline; _height: 15px; // ie 6-7
}