Skip to content

Instantly share code, notes, and snippets.

<html><head>
</head><body>
<div style="text-align: center">
<canvas width="640" height="360" id="canvas">
</canvas>
<br>Click to change tiles.
</div>
<script type="text/javascript">(function() {
#include <Windows.h>
#include <stdio.h>
#define dllx extern "C" __declspec(dllexport)
dllx double delay(double ms) {
Sleep((DWORD)ms);
return 1;
}
var i;
i := 0;
while (i < 10) begin
show_message("o rly");
i := i + 1;
end;
@YellowAfterlife
YellowAfterlife / discord-compact.user.js
Created December 10, 2021 18:37
Replaces the "help" button with a button to toggle left sidebar, like so https://i.imgur.com/JsTp0pu.jpg
// ==UserScript==
// @name Discord: compact checkbox
// @namespace https://yal.cc
// @version 0.2
// @description try to take over the world!
// @author YellowAfterlife
// @match https://discord.com/*
// @grant none
// ==/UserScript==
@YellowAfterlife
YellowAfterlife / config.json
Created March 6, 2021 17:49
An example of making custom syntax extensions for GMEdit. This collapses `//hello` in a file to `//hi` in editor and back.
{
"name": "synext",
"description": "",
"scripts": ["synext.js"],
"stylesheets": []
}
@YellowAfterlife
YellowAfterlife / Player.hx
Last active February 27, 2021 21:37
Terraria 1.3 character file format implementation in Haxe
package terra;
import openfl.Lib;
import openfl.utils.ByteArray;
import openfl.utils.Endian;
import Ext.cfor;
using utils.ByteArrayTools;
/**
* ...
@YellowAfterlife
YellowAfterlife / Swap.hx
Created June 4, 2014 12:23
Value swap macros for Haxe
class Main {
macro static function swap(a, b) {
return macro { var v = $a; $a = $b; $b = v; };
}
static function main() {
var i = 10, j = 15;
trace(i, j); // 10, 15
swap(i, j);
trace(i, j); // 15, 10
}
@YellowAfterlife
YellowAfterlife / Main.hx
Last active July 4, 2020 08:43
Simplistic .properties parser
class Main {
static function parseProperties(text:String):Map<String, String> {
var map:Map<String, String> = new Map(),
ofs:Int = 0,
len:Int = text.length,
i:Int, j:Int,
endl:Int;
while (ofs < len) {
// find line end offset:
endl = text.indexOf("\n", ofs);
@YellowAfterlife
YellowAfterlife / Program.cs
Created August 5, 2014 16:54
A test for clipboard manipulation in C#.
using System;
using System.IO;
using System.Windows.Forms;
// ^ In a console application project you'll need to add a reference to this first.
namespace CSCoTest {
class Program {
static MemoryStream stringToMemoryStream(string value) {
return new MemoryStream(System.Text.Encoding.UTF8.GetBytes(value));
}
(function() {
// see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString
// default en-GB will give you DD/MM/YYYY hh:mm::ss
let dateLocales = "en-GB";
let dateOptions = undefined;
// (making it easier to restart by pasting the edited snippet)
if (window.properTimes) {
clearInterval(window.properTimes);
for (let el of document.querySelectorAll(`time:not(.proper-time)`)) {
el.classList.remove(`proper-time`);