Skip to content

Instantly share code, notes, and snippets.

View pascalish.gml
var i;
i := 0;
while (i < 10) begin
show_message("o rly");
i := i + 1;
end;
View simple-iso.html
<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() {
@YellowAfterlife
YellowAfterlife / discord-compact.user.js
Created Dec 10, 2021
Replaces the "help" button with a button to toggle left sidebar, like so https://i.imgur.com/JsTp0pu.jpg
View discord-compact.user.js
// ==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==
View WinDev.cpp
#include <Windows.h>
#include <stdio.h>
#define dllx extern "C" __declspec(dllexport)
dllx double delay(double ms) {
Sleep((DWORD)ms);
return 1;
}
@YellowAfterlife
YellowAfterlife / config.json
Created Mar 6, 2021
An example of making custom syntax extensions for GMEdit. This collapses `//hello` in a file to `//hi` in editor and back.
View config.json
{
"name": "synext",
"description": "",
"scripts": ["synext.js"],
"stylesheets": []
}
@YellowAfterlife
YellowAfterlife / Player.hx
Last active Feb 27, 2021
Terraria 1.3 character file format implementation in Haxe
View Player.hx
package terra;
import openfl.Lib;
import openfl.utils.ByteArray;
import openfl.utils.Endian;
import Ext.cfor;
using utils.ByteArrayTools;
/**
* ...
@YellowAfterlife
YellowAfterlife / Swap.hx
Created Jun 4, 2014
Value swap macros for Haxe
View Swap.hx
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 Jul 4, 2020
Simplistic .properties parser
View Main.hx
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 Aug 5, 2014
A test for clipboard manipulation in C#.
View Program.cs
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));
}
View discord-proper-time.js
(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`);