Skip to content

Instantly share code, notes, and snippets.

View paleite's full-sized avatar
:fishsticks:
TS ❤️

Patrick Eriksson paleite

:fishsticks:
TS ❤️
View GitHub Profile
@paleite
paleite / general-typography-cheatsheet.md
Created June 26, 2023 10:42
General Typograph Cheatsheet

General Typography Cheatsheet

Body Text (p tag, li tag)

  • Default style: Font size of 16px, font weight of 400 (normal), line height of 1.5, and a letter spacing of normal.

Subheadings (h2, h3 tag)

  • Default style: Font size of 24px for h2 and 20px for h3, font weight of 600 (semi-bold), line height of 1.4, and a letter spacing of normal.

Main Headings (<h1> tag)

  • Default style: Font size of 32px, font weight of 700 (bold), line height of 1.2, and a letter spacing of normal.
@paleite
paleite / prepare-commit-msg
Created April 15, 2021 00:12
Automatically prepend the JIRA issue-key to the commit message
#!/bin/sh
# Automatically prepend the JIRA issue-key to the commit message
readonly COMMIT_MESSAGE_PATH="$1"
readonly COMMIT_TYPE="$2"
readonly GIT_BRANCH=$(git branch --show-current)
# Pick the last issue key in a branch name or return empty result.
# - "feature/AB-123-is-not/the/AB-987-last" will yield "AB-987"
# - "main" will yield ""
readonly ISSUE_KEY=$(node -e 'console.log(process.argv.pop().split("/").reduce(((e,o)=>(o=/^[A-Z]{2,}-\d+/.exec(o)?.pop())?o:e),""))' "${GIT_BRANCH}")
@paleite
paleite / promise-all.js
Created June 11, 2020 16:33
Promise.all()-timing comparison
(async () => {
function sleep(ms, msg) {
console.log(`Executing '${msg}'`);
return new Promise((resolve) =>
setTimeout(() => {
console.log(`Resolving '${msg}'`);
resolve(msg);
}, ms)
);
}
@paleite
paleite / .gitignore
Created January 8, 2019 14:05
.gitkeep: Keep folder in repository without keeping files inside it. Use it for sensitive data, caches, etc.
/*
!/.gitkeep
@paleite
paleite / export-styles.md
Last active June 11, 2020 16:45
Export css / styles of HTML Element / Node
@paleite
paleite / download-files-with-range-and-zero-padding.sh
Created May 2, 2018 08:25
Download files with range/seq and zero-padding
for i in $(seq -f "%03g" 1 100)
do
wget http://example.com/assets/pics/myawesomestuff${i}.jpg
done
@paleite
paleite / resize-and-convert.sh
Created April 19, 2018 10:36
Batch resize and convert images with retina-support
#!/bin/bash
if ! brew ls --versions imagemagick > /dev/null; then
# The package is not installed
echo "Installing imagemagick…"
brew install imagemagick
fi
echo "Resizing to @2x…"
mogrify -path . -resize "160x30>" ../originals/*.png
@paleite
paleite / golang_on_rpi.md
Created July 19, 2017 11:18 — forked from konradko/golang_on_rpi.md
Install Golang 1.7 on Raspberry Pi
wget https://storage.googleapis.com/golang/go1.7.linux-armv6l.tar.gz
tar -C /usr/local -xzf go1.7.linux-armv6l.tar.gz
export PATH=$PATH:/usr/local/go/bin