Skip to content

Instantly share code, notes, and snippets.

View jaames's full-sized avatar
🐳
~

James jaames

🐳
~
  • UK, '97
  • 06:21 (UTC +01:00)
View GitHub Profile
@sketchpunk
sketchpunk / _roundedline.js
Last active January 4, 2023 15:18
Round the edges of a multi part line or 2d polygon in a flat array of vec3
/*
const pnts = [
-2,0,-2,
-2,0,2,
2,0,2,
4,0,1,
];
const poly = roundedline( pnts );
const buf = new Vec3Buffer( poly );
@sketchpunk
sketchpunk / _polyline.js
Last active January 4, 2023 15:18
Polyline from flat array of Vector 3
/*
NOTES
https://blog.scottlogic.com/2019/11/18/drawing-lines-with-webgl.html
EXAMPLE
const pnts = [
-2,0,-2,
-2,0,2,
2,0,2,
4,0,0,
@potch
potch / bayer.lua
Last active March 5, 2022 05:53
Small Lua library for working with bayer filters for use with playdate.graphics
-- bayer.lua v1.0
-- by Potch
-- MIT License
-- hard-code smallest bayer
local bayer2 = { [0] = 0x0, [1] = 0x2, [2] = 0x3, [3] = 0x1 }
-- t should be a 64 entry table of 1 and 0s, indexed at 0
-- returns a 1-indexed table of bytes for use with playdate.graphics.setPattern
local function toBytes(t)
@evaera
evaera / Cloudflare Pages deploy into subdirectories.md
Last active October 6, 2023 18:45
Cloudflare Pages deploy into subdirectories

This Github Actions workflow file lets you deploy multiple websites to Cloudflare Pages in subfolders instead of subdomains by using an intermediate repository to hold the built files.

  • Create a new repository where the files will get deployed to. That is your build repo, and you should set up your Pages from that repo.
  • Create a secret in your repo or organization called DEPLOY_PAT with the value of a GitHub personal access token of an account that has access to push to your build repo
  • Edit the values under env:
    • replace AuthorNameGoesHere with the author of the build repo
    • replace BuildRepoNameGoesHere with the name of the build repo
    • replace UsernameOfPATGoesHere with the username of the account you created the personal access token for
@zhuowei
zhuowei / patch_constanttype.patch
Last active September 25, 2022 12:17
Patches for unluac to disassemble (and partially decompile) Playdate's Lua 5.4.0 beta bytecode
# HG changeset patch
# User Zhuowei Zhang <zhuowei@worthdoingbadly.com>
# Date 1633490863 14400
# Tue Oct 05 23:27:43 2021 -0400
# Node ID 9a209bac7961ed4cc661f1a358d8ef2e23c74d7b
# Parent 0390d042f93125be8257ae3a0520aa6b1003145c
Add PlayDate's 0x23 integer type, fix boolean parsing for Lua 5.4 beta
diff --git a/src/unluac/parse/LConstantType.java b/src/unluac/parse/LConstantType.java
--- a/src/unluac/parse/LConstantType.java
@amanchopra95
amanchopra95 / file-extractor.js
Last active March 7, 2024 18:17
Extract Files in HTML5 and Javascript. Drop any file or folder. This gist will return the list of files by recursively traversing the directories
/**
* Traversing directory using promises
**/
const traverseDirectory = (entry) => {
const reader = entry.createReader();
return new Promise((resolveDirectory) => {
const iterationAttempts = [];
const errorHandler = () => {};
@rygorous
rygorous / rast.c
Created March 2, 2020 01:56
Simple watertight triangle rasterizer
// ---- triangle rasterizer
#define SUBPIXEL_SHIFT 8
#define SUBPIXEL_SCALE (1 << SUBPIXEL_SHIFT)
static RADINLINE S64 det2x2(S32 a, S32 b, S32 c, S32 d)
{
S64 r = (S64) a*d - (S64) b*c;
return r >> SUBPIXEL_SHIFT;
}
@Prof9
Prof9 / guide.md
Last active June 25, 2022 04:21
Kaeru WFC connection guide for Nintendo Wi-Fi USB Connector

Notes:

  • For some people setting DNS settings in the Nintendo Wi-Fi USB Connector properties doesn't seem to work, if that applies to you you may have to set up DNS in the internet-facing connection properties instead.

Connection guide

  1. Set up a virtual machine running Windows XP.

    • Plenty of guides online on how to do this, so I won't be going into too much detail here.
    • I'd recommend using VirtualBox and the "Windows XP Mode" method found here, as all the downloads you need are from official sources: https://www.makeuseof.com/tag/download-windows-xp-for-free-and-legally-straight-from-microsoft-si/. NOTE: Skip the part where it tells you to set up Windows XP Virtual Machine Network Settings, you don't need to do this if the internet connection in your VM is already working.
@argyleink
argyleink / easings.css
Created February 26, 2018 22:34
Handy CSS properties for easing functions
:root {
--ease-in-quad: cubic-bezier(0.55, 0.085, 0.68, 0.53);
--ease-in-cubic: cubic-bezier(0.55, 0.055, 0.675, 0.19);
--ease-in-quart: cubic-bezier(0.895, 0.03, 0.685, 0.22);
--ease-in-quint: cubic-bezier(0.755, 0.05, 0.855, 0.06);
--ease-in-expo: cubic-bezier(0.95, 0.05, 0.795, 0.035);
--ease-in-circ: cubic-bezier(0.6, 0.04, 0.98, 0.335);
--ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
--ease-out-cubic: cubic-bezier(0.215, 0.61, 0.355, 1);
--ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);