Skip to content

Instantly share code, notes, and snippets.

View fforw's full-sized avatar

Sven Helmberger fforw

View GitHub Profile
@fforw
fforw / git-tmp.zsh
Created August 22, 2025 18:29
git-tmp
#!/bin/zsh
# Don't name this *.zsh, the extension is just for github
if [ "$1" = "-h" ]; then
echo -e "Usage: git tmp\n\nAdds all tracked und untracked files and creates a new commit with the title 'TMP'"
else
git add -A
git commit -m "TMP"
fi
#!/usr/bin/env node
const ANIMAL_DATA = {
"mammals": [
"Aardvark",
"Alpaca",
"Anteater",
"Antelope",
"Ape",
// query is a GraphQL query definition and variables an object whose keys are variable values for that definition
fetch(
"/graphql",
{
method: "POST",
credentials: "same-origin",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
@fforw
fforw / config.inputSchema.json
Created June 30, 2022 13:35
Automaton-Test Schema Data
{
"schema": {
"types": [
{
"kind": "OBJECT",
"name": "AppAttachment",
"description": "File/image attachments",
"fields": [
{
"name": "description",
@fforw
fforw / builder-sig.js
Created April 13, 2021 12:42
Recast/Jscodeshift builders (some ts missing)
j.noop();
j.doExpression(body)
j.bindExpression(object, callee)
j.parenthesizedExpression(expression)
j.exportNamespaceSpecifier(exported)
# via https://devtalk.blender.org/t/alternative-in-2-80-to-create-meshes-from-python-using-the-tessfaces-api/7445/3
# Example of creating a polygonal mesh in Python from numpy arrays
# Note: this is Python 3.x code
#
# $ blender -P create_mesh.py
#
# See this link for more information on this part of the API:
# https://docs.blender.org/api/blender2.8/bpy.types.Mesh.html
#
@fforw
fforw / bezier.js
Created July 6, 2020 11:46
Three.js Bezier unrolled
const bzv0 = new Vector3();
const bzv1 = new Vector3();
function quadraticBezier( v0, v1, v2, t, out)
{
bzv0.x = v0.x + (v1.x - v0.x) * t;
bzv0.y = v0.y + (v1.y - v0.y) * t;
bzv0.z = v0.z + (v1.z - v0.z) * t;
bzv1.x = v1.x + (v2.x - v1.x) * t;
@fforw
fforw / FilterDSL.js
Last active June 30, 2020 15:04
Filter DSL Methods
// Field conditions. Used in the form e.g. field("myField").lt(value(5)). Number is the number of arguments. For example
// between takes a lower and an upper value.
// "in" is kind of special and requires one values() argument
export const FIELD_CONDITIONS = {
"greaterOrEqual":1,
"lessOrEqual":1,
"lt":1,
"notBetweenSymmetric":2,
"notEqualIgnoreCase":1,
@fforw
fforw / adjacencies.json
Created June 14, 2020 23:07
WFC Rules (Typed Arrays)
[
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 147, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 147, 1485, 0, 5, 1, 0, 0, 1, 1, 1, 0, 1,
1485, 1957, 0, 1953, 0, 0, 1957, 0, 1957, 1957, 1957, 1957, 1957, 225, 0, 0, 0, 0, 1, 65, 129, 0, 0, 0, 225, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1
]
@fforw
fforw / heightLimit.js
Created May 23, 2020 21:37
Island height function
export function heightLimit(x)
{
const beach = 0.05;
const beachSquared = beach*beach;
const mountain = 0.6;
const mountain_mid = 0.8;
if (x < beach)
{