Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# We need the TAB character for SED (Mac OS X sed does not understand \t)
TAB="$(printf '\t')"
function abort {
echo "$(tput setaf 1)$1$(tput sgr0)"
exit 1
}
@tracker1
tracker1 / 01-directory-structure.md
Last active November 8, 2024 21:10
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
@cvrebert
cvrebert / css_regression_testing.md
Last active May 28, 2024 17:42
Survey of screenshot-based CSS testing tools

Currently considering https://github.com/webdriverio/webdrivercss


Core Goals:

  • Can test in up-to-date versions of all major browsers
  • Can test on up-to-date versions of all major OSes
  • Can test in IE9 (because Bootstrap v4 will support IE9+)
  • Don't want to have to setup/maintain our own cluster of VMs running all the necessary OSes (and all the versions of Windows)
  • Workflow for management of reference/baseline/norm screenshots
@mootari
mootari / git-match-patch
Last active August 29, 2015 14:17
Attempts to find the commit a patch applies to cleanly. Usage: git-match-patch {branch} {patch-file}
#!/bin/bash
current=$(git rev-parse HEAD)
commits=$(git rev-list $1)
for rev in $commits; do
git checkout --quiet $rev
git apply --check $2 2>/dev/null
if [ $? == 0 ]; then
git log -n 1
exit 0
fi
@nz
nz / oauth lite.md
Last active October 3, 2023 07:46
Light weight HMAC token auth over HTTP Basic Auth

HMAC over Basic Auth

This is a pattern I use fairly frequently for administrative APIs. It's a sort of OAuth lite for non-public APIs that produces good quality tokens. Once you build it a few times, it's not any harder than using arbitrary basic auth in your APIs.

The client and the app share a secret, which is never transmitted across the wire. The client uses this secret to create an HMAC digest of a payload consisting of the current time and a random nonce value. The nonce is provided as the Basic Authorization user, and the resulting HMAC digest is provided as the Basic Authorization password.

A similar process is followed on the server side. The server uses the supplied nonce, its own time, and its own copy of the shared secret. It may want to check against several tokens across a small window of times to account for clock drift.

  • Using HMAC means the secret is never transmitted across the wire. Theoretically these are safe across plaintext connections, but you're using TLS anyway, right?
  • The i
@paulirish
paulirish / what-forces-layout.md
Last active November 14, 2024 11:03
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@manigandham
manigandham / rich-text-html-editors.md
Last active November 14, 2024 09:30
Rich text / HTML editors and frameworks

Strictly Frameworks

Abstracted Editors

These use separate document structures instead of HTML, some are more modular libraries than full editors

@jimmywarting
jimmywarting / readme.md
Last active November 15, 2024 12:47
Cors proxies
Exposed headers
Service SSL status Response Type Allowed methods Allowed headers
@thetechnick
thetechnick / ignition.json
Last active June 22, 2023 17:46
Hetzner Cloud terraform coreos install
{
"ignition": {
"version": "2.0.0",
"config": {}
},
"storage": {
},
"systemd": {},
"networkd": {},
"passwd": {