Skip to content

Instantly share code, notes, and snippets.

View jakub-g's full-sized avatar

jakub-g jakub-g

  • Antibes, France
  • 05:05 (UTC +02:00)
View GitHub Profile
@jakub-g
jakub-g / async-defer-module.md
Last active July 26, 2026 21:35
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@jakub-g
jakub-g / gist:b7b54852011dfd8d708fa88300452f5a
Created May 12, 2020 09:49
Samsung TV browser and Samsung TV webview useragent strings
Samsung Browser:
----------------
Mozilla/5.0 (SMART-TV; Linux; Tizen 5.0) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/2.2 Chrome/63.0.3239.84 TV Safari/537.36
Mozilla/5.0 (SMART-TV; Linux; Tizen 4.0) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/2.1 Chrome/56.0.2924.0 TV Safari/537.36
Samsung WebView:
----------------
Mozilla/5.0 (SMART-TV; LINUX; Tizen 5.0) AppleWebKit/537.36 (KHTML, like Gecko) Version/5.0 TV Safari/537.36
@jakub-g
jakub-g / hn.md
Last active April 4, 2026 00:27
Hacker News Links

Hacker News "hidden" URLs

Many of HN URLs are not easily discoverable as there are no links to them in a prominent part on the page, or sometimes even nowhere. The following is a list of links to standard and "special" HN pages. The ones is bold are the less discoverable ones.

See also: https://github.com/minimaxir/hacker-news-undocumented

Posts

@jakub-g
jakub-g / safari-release-notes-history+stable-technical-preview-mapping.md
Last active April 1, 2026 12:44
Mapping Safari releases to Safari TP versions
@jakub-g
jakub-g / double-fetch-triple-fetch.md
Last active March 3, 2026 02:17
Will it double-fetch? Browser behavior with `module` / `nomodule` scripts
@jakub-g
jakub-g / 1-unicode-js-regex.md
Last active February 21, 2026 16:50
Unicode-aware JavaScript regex cheat sheet

Unicode-aware JavaScript regex (Unicode property escapes /\p{..}\P{..}/u) cheat sheet

Browser support MDN

@jakub-g
jakub-g / git-clone-print-progress-to-terminal-and-to-file.md
Last active February 9, 2026 08:21
git clone, print progress BOTH to terminal and to a file, without buffering, and annotate progress with timestamps (on MacOS)

Note: this is MacOS specific

ORG=...
REPO=...
DEST_FOLDER=...
# just clone main branch, without tags, and don't fetch blobs over 1MB
FETCH_OPTIONS='--no-tags --single-branch --filter=blob:limit=1m'

caffeinate -d unbuffer \
@jakub-g
jakub-g / source-shrc-alt.md
Last active February 2, 2026 10:25
Alternative to `source ~/.zshrc`
export PATH=$(zsh -l -c 'echo $PATH')

or shell agnostic

# 1. Detect the parent process name
parent_shell=$(ps -p $PPID -o comm= | tr -d '-') # tr removes the leading dash if it's a login shell

# 2. Map the process name to a valid binary path
@jakub-g
jakub-g / readme.md
Last active January 31, 2026 08:30
Microsoft Sculpt Ergonomic Keyboard x MacOS x Karabiner settings
@jakub-g
jakub-g / README.md
Last active December 26, 2025 12:19
Karabiner-Elements: Remap cmd-capslock to cmd-backtick(tilde) (Switch window within an app)

What this rule does

On MacOS, cmd-tab only toggles between different apps. To toggle between different windows of the same app, you need to use cmd-` . However this is cumbersome for regular usage, as it requires stretching your fingers unnaturally. This rule allows to use cmd-CapsLock instead, which is much easier.

To enable the rule

  • Install Karabiner Elements and give it all permissions it asks for
  • cd ~/.config/karabiner/assets/complex_modifications and put the json file below there
  • Restart Karabiner Elements
  • Go to "Complex Modifications > Add rule"