Skip to content

Instantly share code, notes, and snippets.

View Enichan's full-sized avatar

Emma Maassen Enichan

View GitHub Profile
@Enichan
Enichan / jrpg.js
Created September 17, 2023 16:54
Tiny Tiled Map Editor binary exporter plugin
var binaryFormat = {
name: "jRPG binary format",
extension: "bin",
write: function(map, fileName) {
var m = {
width: map.width,
height: map.height,
layers: []
};
@Enichan
Enichan / test.bas
Last active December 25, 2022 22:50
160x120 256 color VGA display mode in QBasic 1.1
DEFINT A-Z
' this program sets 160x120 256 color VGA mode in QB1.1
' downsides: qbasic drawing commands absolutely don't work correctly
' trick qbasic into thinking we're in VGA mode
SCREEN 13
' set EGA mode 0Dh through int 10h in assembly
' this is equivalent to SCREEN 7 and using SCREEN 7 will work, but
@Enichan
Enichan / DoubleDabble.cs
Created December 18, 2022 12:38
Double dabble algorithm in C#
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DoubleDabble {
class Program {
static void Main(string[] args) {
@Enichan
Enichan / index.html
Last active December 17, 2022 15:56
Mastodon redirect HTML template
<!DOCTYPE html>
<html lang="en">
<!--
Just search and replace the following tags:
{name} replace with your printed name (ex 'Elon Musk')
{image-url} replace with a 4:3 image, presumably your avatar
{twitter-username} replace with your twitter username (ex 'elonmusk')
{profile-url} replace with your mastodon profile url (ex 'https://mastodon.social/@Gargron')
@Enichan
Enichan / interpretoy.html
Last active December 16, 2021 21:38
Interpretoy: a toy lisp interpreter with REPL built in javascript
<html>
<head>
<title>Interpretoy REPL</title>
</head>
<body>
<script>
// based on lispy by Peter Norvig: http://norvig.com/lispy.html
function load(source) {
@Enichan
Enichan / triangle.p8
Last active October 6, 2021 07:42
Subpixel accurate triangle rasterizer prototype for Pico 8
pico-8 cartridge // http://www.pico-8.com
version 18
__lua__
--[[function spline(x0,y0,x1,y1,c)
local dx = x1 - x0
local dy = y1 - y0
local step = dx/dy
local x = x0 - (y0 % 1) * step
local y = flr(y0)
@Enichan
Enichan / main.c
Last active August 28, 2023 10:07
Coroutines for C using Duff's Device based on Simon Tatham's coroutines
// coroutines for C adapted from Simon Tatham's coroutines
// https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
//
// this implementation utilizes __VA_ARGS__ and __COUNTER__
// to avoid a begin/end pair of macros.
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
// modify this if you don't like the `self->name` format
@Enichan
Enichan / collatz.lua
Last active July 31, 2021 03:10
Eniko Collatz Fizzle Fade, Pico 8 implementation
seed = 38
function txp1()
if seed == 1 then
return seed
elseif seed % 2 == 0 then
seed /= 2
else
seed = seed * 3 + 1
end
@Enichan
Enichan / IDGenerator.cs
Last active November 7, 2019 17:11
Serves long identifiers in a threadsafe manner.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Franca {
[StructLayout(LayoutKind.Explicit)]
public struct IncrementalID : IEquatable<IncrementalID>, IComparable<IncrementalID> {
@Enichan
Enichan / P8Writer.cs
Last active January 21, 2020 10:53
Takes a byte[] array with binary data, and outputs that to the .p8 pico 8 cartridge format
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class P8Writer {
public const int RomSize = 0x4300;