Skip to content

Instantly share code, notes, and snippets.

View jessechounard's full-sized avatar

Jesse Chounard jessechounard

View GitHub Profile
@jessechounard
jessechounard / json-console-log.code-snippets
Last active December 1, 2022 02:45
Prints out a JSON stringified object to the console
{
"JSON Console Log": {
"scope": "javascript,javascriptreact,typescript,typescriptreact",
"prefix": "jcl",
"body": [
"console.log('$1: ', JSON.stringify($1, null, 4));",
],
"description": "Log JSON stringified output to console"
}
}
@jessechounard
jessechounard / floatCompare.ts
Last active February 26, 2022 20:49
Typescript floating point comparison
// Based on Christer Ericson's talk on floating point tolerance
// http://realtimecollisiondetection.net/blog/?p=89
const approximatelyEqual = (a: number, b: number, tolerance: number = 0.000001) => {
return (Math.abs(a - b) <= tolerance * Math.max(1.0, Math.max(Math.abs(a), Math.abs(b))));
}
console.log(approximatelyEqual(3.56999999, 3.57)); // true
console.log(approximatelyEqual(4.001, 4.002)); // false
@jessechounard
jessechounard / main.c
Last active September 21, 2023 02:08
Simple texture rendering in FNA3D
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#define MOJOSHADER_NO_VERSION_INCLUDE
#define MOJOSHADER_EFFECT_SUPPORT
#include <mojoshader.h>
#include <mojoshader_effects.h>
#define SDL_MAIN_HANDLED
@jessechounard
jessechounard / cmder.settings.json
Created May 4, 2020 04:30
VS Code Terminal Integration (Experiments)
{
"terminal.integrated.shell.windows": "cmd.exe",
"terminal.integrated.env.windows": {
"CMDER_ROOT": "D:\\cmder"
},
"terminal.integrated.shellArgs.windows": [
"/k",
"%CMDER_ROOT%\\vendor\\bin\\vscode_init.cmd"
],
}
@jessechounard
jessechounard / launch.json
Last active April 23, 2020 18:31
Build and debug Rust in VSCode (on Windows)
{
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceRoot}/target/debug/${workspaceRootFolderName}",
"args": [],
"stopAtEntry": false,
@jessechounard
jessechounard / GameName.asl
Last active June 14, 2023 08:37
SpeedrunHelper
// This file is for the speedrun community to use as a base for
// their LiveSplit autosplitter. You can set it up to read the
// memory you've layed out, and they can take it from there.
state("GameName") {
}
startup {
vars.scanTarget = new SigScanTarget(0,
"de c0 ad de de c0 37 13" // tag (0x1337c0dedeadc0de)
@jessechounard
jessechounard / TaskQueue.cpp
Last active December 15, 2015 01:09
An object to hold and perform a sequence of tasks.
#include "TaskQueue.hpp"
namespace NinjaParty
{
bool TaskQueue::IsComplete() const
{
return tasks.empty();
}
void TaskQueue::Update(float deltaSeconds)