Skip to content

Instantly share code, notes, and snippets.

/**
* ❌ bug is reproducible
* ✔️ but is not reproducible (anymore)
*
* see the assert calls
*
* Environment variable required:
* KLAVIYO_API_KEY=...
*
* Run with:
@marian-c
marian-c / zig_test_debugging_vscode.md
Created January 8, 2024 09:58 — forked from floooh/zig_test_debugging_vscode.md
How to debug Zig tests in VSCode

Tested on macOS:

  1. Install the CodeLLDB VSCode extension. Unlike the debugger in the C/C++ extension, this allows to set breakpoints inside Zig "test" blocks (in the MS C/C++ extension debugger, breakpoints inside test blocks will be disabled once the debugger starts for unknown reasons.
  2. When compiling the test, tell it to also emit a binary: zig test -femit-bin=zig-out/bin/my-test src/bla.zig, otherwise there will be no executable to debug.
  3. The compiled test executable expects the path to the Zig executable as first command line argument, the launch.json file needs to be setup accordingly (note the args item):

Type safety for array access

Problem

Here’s an array:

const arr: number[] = [1];

Display user's names

awk -F: '{ print $1}' /etc/passwd

or

cut -d: -f1 /etc/passwd
@marian-c
marian-c / redirecting-github-pages.md
Created June 12, 2020 15:14 — forked from domenic/redirecting-github-pages.md
Redirecting GitHub pages after a repository move

Redirecting GitHub Pages after a repository move

The problem

You have a repository, call it alice/repo. You would like to transfer it to the user bob, so it will become bob/repo.

However, you make heavy use of the GitHub Pages feature, so that people are often accessing https://alice.github.io/repo/. GitHub will helpfully redirect all of your repository stuff hosted on github.com after the move, but will not redirect the GitHub Pages hosted on github.io.

The solution