Skip to content

Instantly share code, notes, and snippets.

View onelivesleft's full-sized avatar

Iain King onelivesleft

View GitHub Profile
/*
Original c code; this is a routine from stbsprintf distilled down to the main flow control
Lots of lines were omitted; where it looks like there is redundant flow, imagine lines of code exist
between the redundant statements.
*/
original :: () {
for (;;) {
if (0 == (bf = buf = callback(buf, user, len)))
goto done;
@onelivesleft
onelivesleft / jai_compile_and_run.md
Last active November 5, 2020 02:41
Jai Compile with options then Run

Compile then Run script for Jai

The way Jai does compiler options, using the Compiler module instead of command line arguments to the compiler, is good for use inside a project. When you're only compiling individual files, however, it is pretty clunky: you have to include effectively the script presented below in each program you write. To get round this, and speed up learning the language and testing it out, I've set up vscode to compile and run the current script with my chosen build options as one action. This involves a jai script (I say script because it never compiles to an exe) and a batch file. The setup is very basic right now, it could easily be expanded to allow you to pass in the exe name, etc. It works like this:

jai-compile.jai

This is effectively a wrapper jai script which is compiled in order to compile the target program.

@onelivesleft
onelivesleft / Tabletop Simulator VR controls update.md
Last active April 7, 2024 11:23
Tabletop Simulator VR update

Tabletop Simulator VR controls update

The goal is to provide a more intuitive VR experience; closer to how you would play a board game IRL. This is still in development, consider it an alpha test! To enable the new control scheme type -vr_controls_original into the system console.

Note

Various commands in the system console govern vr behaviour: type help vr to see them. For example, turning vr_sticky_grab on will mean you do not have to hold the trigger to maintain grip on an object; instead you press to grab, then press again to release. If you want these commands to persist then add them to your autoexec (type edit autoexec and enter them there).

You can quickly switch between old and new controls if you do something like bind right_control !vr_controls_original (...you can then hit right control to toggle)

@onelivesleft
onelivesleft / example.lua
Last active November 6, 2022 18:55
Console++ example mod source code
#include Console/console++
-- GUIDS
deck_a_guid = 'b99779'
deck_b_guid = '3e5111'
deck_c_guid = '29c75c'
d4_guid = '2a263c'
d6_guid = '6f3619'
@onelivesleft
onelivesleft / atom_cursor_vert_ruler.md
Last active May 16, 2018 08:32
Atom hack to show vertical ruler at cursor position on keypress

config.cson:

editor:
  softWrap: false
  softWrapAtPreferredLineLength: false

keymap.cson:

@onelivesleft
onelivesleft / jai_suggestions.cpp
Created January 30, 2017 00:28
Unsolicited language feature suggestions
/* If you are getting bombarded with suggestions then I apologise for joining the throng.
I really like the direction you are going with Jai, and these ideas came to me
unbidden; I thought I should share them: */
// 1. Generalise 'else' so it works on any given code block: it executes if the preceding
// block did not. Predominately this would be for 'for' and 'while' loops.
// For example:
if message {