Skip to content

Instantly share code, notes, and snippets.

@nbogie
nbogie / mermaid-diagrams-github-markdown-example.md
Last active June 5, 2023 12:23
github-markdown-support-for-mermaid-diagrams.md

flow diagram

flowchart TD
    A[Start] --> B{Is it?}
    B -->|Yes| C[OK]
    C --> D[Rethink]
    D --> B
    B ---->|No| E[End]
class Point {
x: number;
y: number;
/** the label for this point */
label: string;
constructor(givenLabel: string,givenX: number, givenY:number){
console.log("constructor was called")
this.x = givenX;
@nbogie
nbogie / adventOfCodeTemplate.ts
Last active December 2, 2022 10:06
TypeScript starter function for advent of code
import fs from 'fs/promises';
async function readFileAndSolveProblem() {
const inputRaw = await fs.readFile("./inputs/inputDay1A.txt", { encoding: 'utf8' })
const inputLines: string[] = inputRaw.split("\n");
console.log({ inputLines })
//TODO: solve the problem here, based on inputLines
}
@nbogie
nbogie / adventOfCodeTemplate.js
Created December 2, 2022 10:05
JavaScript (not TypeScript) starter for advent of code solutions in node.js
const fs = require('fs/promises');
async function readFileAndSolveProblem() {
const inputRaw = await fs.readFile("./inputs/inputDay1A.txt", { encoding: 'utf8' })
const inputLines = inputRaw.split("\n");
console.log({ inputLines })
//TODO: solve the problem here, based on inputLines
}
type Player = "X" | "O"
type PosState = Player | ""
type BoardState = [
PosState,PosState,PosState,
PosState,PosState,PosState,
PosState,PosState,PosState
]
//type WinState = "draw" | "X won" | "O won" | "not finished"
@nbogie
nbogie / geoJSONMapGithubMarkdown.md
Last active September 11, 2022 16:15
geoJSON github markdown diagram example
@nbogie
nbogie / github-markdown-ascii-stl-3d-files.md
Created September 11, 2022 16:05
github markdown support for 3d file viewing (ascii .stl files)

burger 3d view demo (ascii stl file)

solid Exported from Blender-3.2.1
facet normal 0.017014 0.063498 0.997837
outer loop
vertex -0.000000 0.678245 0.906216
vertex -0.000000 0.272585 0.932030
vertex 0.136293 0.236066 0.932030
endloop
@nbogie
nbogie / p5xr.md
Last active March 7, 2022 21:42
initial p5.xr VR experiments (for the quest 2)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ProjectileFirer : MonoBehaviour
{
public List<GameObject> projectilePrefabs;
public float fireStrength = 20;
public float spinStrength = 10f;