Skip to content

Instantly share code, notes, and snippets.

View atelierbram's full-sized avatar

Bram de Haan atelierbram

View GitHub Profile
@atelierbram
atelierbram / fix-luasnip-jsregexp-not-found-in-neovim.md
Last active April 8, 2026 12:11
Neovim symbol not found: luaopen_jsregexp

Fix: LuaSnip jsregexp "Symbol Not Found" in Neovim

When you receive the warning jsregexp library required for Placeholder-transformations in :checkhealth luasnip, the jsregexp C library needs to be compiled. On modern systems (such as Apple Silicon), this often goes wrong because the library is built for the wrong Lua version.

The Problem

Neovim uses LuaJIT, which is compatible with Lua 5.1. When you install jsregexp via a standard package manager, it is often built for Lua 5.4 or higher. This results in the error message: dlsym(... luaopen_jsregexp): symbol not found.

The Solution (Step-by-step)

  1. Compile for Lua 5.1 Use LuaRocks to build the module specifically for the Lua 5.1 ABI. This ensures that the binary symbols are compatible with Neovim.
@atelierbram
atelierbram / let-remote-server-recognise-ghostty-terminal-using-ssh.md
Created April 3, 2026 15:28
Let remote server recognise ghostty terminal using SSH

Let remote server recognise ghostty terminal using SSH

From the remote server:

  infocmp -a xterm-ghostty

On local machine:

 infocmp -x | ssh remote-server-user@ip "tic -x -"
@atelierbram
atelierbram / _elements.scss
Created April 3, 2026 11:24
CSS reset / starter (in SCSS)
@use "sass:color";
@use "../mq/mq" as *;
// @use "../settings/settings" as *;
@use "../settings/variables" as *;
html {
cursor: auto;
font-size: 16px;
line-height: 1.5;
-moz-tab-size: 2;
@atelierbram
atelierbram / convert-hsl-to-hex-colors-in-batch.md
Created March 10, 2026 08:55
How to convert a range of HSL color values to HEX in batch with color-convert and write to file
@atelierbram
atelierbram / functions.php
Created February 16, 2026 15:03
Colophon section which can be edited in WordPress customizer (GeneratePress child-theme)
<?php // colophon section which can be edited in WordPress customizer (GeneratePress child-theme)
add_action( 'customize_register', function( $wp_customize ) {
$wp_customize->add_section( 'fia_colophon_section', array(
'title' => __( 'Colofon Informatie', 'fia-theme' ),
'priority' => 120,
) );
// Velden configuratie
$fields = array(
@atelierbram
atelierbram / compress-pdf-with-ghostscript.sh
Last active September 15, 2025 08:39
Compress PDF with ghostscript from commandline
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed.pdf input.pdf
@atelierbram
atelierbram / cc-css-starter.css
Last active September 13, 2025 12:58
Chris Coyier's CSS Starter
/* https://codepen.io/editor/chriscoyier/pen/0198772a-a759-7dc4-b8fc-1dfdbed39fdb
** https://shoptalkshow.com/681/ */
@layer reset {
html {
color-scheme: light dark;
font:
clamp(1rem, 1rem + 0.5dvw, 2rem) / 1.4 system-ui,
sans-serif;
tab-size: 2;
hanging-punctuation: first allow-end last;
@atelierbram
atelierbram / environment-variables-with-wordpress.md
Last active September 10, 2025 12:41
Environment variables with WordPress PHP

Environment Variables - in wp-config.php

1. In wp-config.php

Add this at the end of the file:

// setup environment
define( 'WP_ENV', 'dev' );     // options: 'dev' or 'prod'
define( 'WP_SERVER', 'local' ); // options: 'local' or 'remote'
@atelierbram
atelierbram / compress-output.php
Created August 13, 2025 18:55
Compress output PHP
<?php
// Start output buffering and clean whitespace
ob_start(function ($buffer) {
// Remove tabs, newlines, multiple spaces between tags
$buffer = preg_replace('/\s+/', ' ', $buffer);
// Remove spaces between HTML tags
$buffer = preg_replace('/>\s+</', '><', $buffer);
return trim($buffer);
});
?>
@atelierbram
atelierbram / append-suffix-on-files-without-suffix-in-subdirectories.sh
Created May 29, 2025 11:00
This command should rename files in subdirectories that don't have a suffix and don't contain a `?` character in their name by appending `.html`
find . -mindepth 1 -type f -not -name "*.*" -not -name "*\?*" -exec sh -c 'mv "{}" "{}".html' \;
# In this version, I've removed the -name '*.*' option, since we want to rename files that don't have a suffix.
# I've also replaced the -not -name '*\?' option with -not -name "*\?*",
# which should correctly exclude files that contain a ? character in their name.