Skip to content

Instantly share code, notes, and snippets.

@talesm
talesm / forth.js
Last active November 17, 2021 16:50
A forth-like implementation, with stacks and basic operations (see article https://justadevlog.neocities.org/2021/11/14/playing-with-forth/)
//#region dataStack
function createStack() {
/** @type {number[]} */
const stack = []
return {
push: val => stack.push(val | 0), // |0 ensures int32
pop: () => stack.pop(),
size: () => stack.length,
top: () => stack[stack.length - 1],
dump: () => stack.map(v => v),
@talesm
talesm / FindSDL2.cmake
Last active June 19, 2018 06:04
Finds SDL2 and friends
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#
# Author: [talesm](https://github.com/talesm)
#.rst:
# FindSDL2
# -------
#
# Looks for SDL and its most used satellite libraries.
#
@talesm
talesm / .clang-format
Created March 2, 2018 01:00
The basic format I like to use
BasedOnStyle: Mozilla
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
BinPackParameters: false
Cpp11BracedListStyle: true
IncludeCategories:
- Regex: '^("|<)catch\.hpp'
Priority: 4
- Regex: '^(<[a-z0-9_]*>)'
Priority: 1
{
"configurations": [
{
"name": "Mac",
"includePath": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}",
"${workspaceRoot}/include"
],