Skip to content

Instantly share code, notes, and snippets.

View fabjan's full-sized avatar

Fabian Bergström fabjan

View GitHub Profile
@fabjan
fabjan / accessibility.gc
Last active July 13, 2023 19:49
experimenting with OpenGOAL accessibility
;;-*-Lisp-*-
(in-package goal)
;; "Installing"/testing this mod:
;; Start the game in debug mode:
;; $ ./build/game/gk --game jak1 -- -boot -debug
;; Start the repl:
;; $ ./build/goalc/goalc --game jak1
;; Connect to the game and compile/load this script:
;; gc> (lt)
@fabjan
fabjan / gltest.c
Created July 6, 2023 20:23
Debugging
// clang gltest.c -lglfw -lglew -framework OpenGL -o gltest
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <stdio.h>
void glAssertNoError(const char *msg) {
int code = glGetError();
if (code == GL_NO_ERROR) {
return;
@fabjan
fabjan / dumpdiff.js
Created June 26, 2023 13:28
one-off script for presenting opengoal translation changes in a readable, navigable HTML format
#! /usr/bin/env -S deno run --allow-read --allow-run
// This script is used to generate a diff between the local version
// translation and the master version of the subtitles, together with
// the english version.
//
// It can be used to generate an html file for easier review of changes
// with a screen reader.
//
// Usage: dumpdiff.js <game> <locale>
@fabjan
fabjan / game_custom_text_sv-SE.json.diff
Last active June 24, 2023 23:38
Jak Swedish translation proposed changes
diff --git a/game/assets/jak1/text/game_custom_text_sv-SE.json b/game/assets/jak1/text/game_custom_text_sv-SE.json
index 0bcb4a4af..b904f6342 100644
--- a/game/assets/jak1/text/game_custom_text_sv-SE.json
+++ b/game/assets/jak1/text/game_custom_text_sv-SE.json
@@ -1,35 +1,35 @@
{
- "1000": "KAMERA KONFIGURATIONER",
+ "1000": "KAMERAINSTÄLLNINGAR",
"1001": "NORMAL",
- "1002": "OVERTERAD",
#!/bin/sh
# Change the settings profile of all open Terminal.app windows to match the
# current system interface style (dark or light). By default, the "Pro" and
# "Novel" profiles are used for dark and light mode, respectively. You can
# override these defaults with the --dark and --light options.
#
# I use this to sync all my terminal windows with the automatic dark/light
# mode setting in macOS.
#
# binpack.py
# Usage: binpack.py binsize csv_file
#
# binsize is the size of the bins to be used
# csv_file is the file containing the data to be packed
#
# The CSV file should have the following format:
# name, size
# name, size
%%% Time all the things!
%%%
%%% To use this hook, on the command line:
%%% ct_run -suite example_SUITE -pa . -ct_hooks timing_cth
%%%
%%% Note `-pa .`: the hook beam file must be in the code path when installing.
-module(timing_cth).
%% Mandatory Callbacks
-export([init/2]).
@fabjan
fabjan / mapmap.erl
Last active January 31, 2023 11:50
-module(mapmap).
%% Extract all key paths from a nested map, sorted.
%%
%% Example:
%%
%% > mapmap:key_paths(#{a => 1, b => #{c => 2, d => 3}}).
%% [[a], [b, c], [b, d]]
key_paths(Map) ->
lists:sort(key_paths(Map, [])).
diff --git a/apps/els_lsp/src/els_docs.erl b/apps/els_lsp/src/els_docs.erl
index 2f0a93c..3b09f70 100644
--- a/apps/els_lsp/src/els_docs.erl
+++ b/apps/els_lsp/src/els_docs.erl
@@ -100,7 +100,17 @@ function_docs(Type, M, F, A) ->
case eep48_docs(function, M, F, A) of
{ok, Docs} ->
[{text, Docs}];
- {error, not_available} ->
+ {error, Error} ->
@fabjan
fabjan / diff-usage.sh
Created May 20, 2021 16:19
compare documented command usage with a readme
#! /bin/bash
# Compare documented usage with actual help output,
# to e.g. be used from a Git pre-push hook to keep README's up to date
CMD="$1"
README="$2"
NL="$3"
if test -z "$CMD"