Skip to content

Instantly share code, notes, and snippets.

Vadim ‮oknehcayD YellowAfterlife

View GitHub Profile
@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 / Player.hx
Last active Jun 6, 2020
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;
/**
* ...
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 / 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`);
View wacom-auto-map.au3
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <SendMessage.au3>
#include <Math.au3>
;
Const $margin = 120 ; in px, how far to let stylus move outside the window bounds
Const $minWidth = 600 ; in px, minimum window width (not to require large movements for tiny windows)
Const $minHeight = 300 ; in px, minimum window height (ditto)
Const $pollRate = 5 ; in ms, lower is more likely to notice short taps
@YellowAfterlife
YellowAfterlife / raw_mouse.cpp
Last active Apr 13, 2019
My tweaks to multi-device polling code by Jake Stookey (http://www.jstookey.com/arcade/rawmouse/)
View raw_mouse.cpp
//================================================================
//
// raw_mouse.c - Win XP access to multiple mice via raw input
//
// To do:
//
// - Improve the method for weeding out the RDP Mouse. Find "status bits" (see below).
//
//================================================================
@YellowAfterlife
YellowAfterlife / killa.xml
Created Jan 22, 2019
Killa UDL for Notepad++
View killa.xml
<NotepadPlus>
<UserLang name="Killa" ext="kia txm" udlVersion="2.0">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" forceLineCommentsAtBOL="no" foldCompact="no" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="yes" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments" id="0">00// 01 02 03/* 04*/</Keywords>
<Keywords name="Numbers, additional" id="1"></Keywords>
<Keywords name="Numbers, prefixes" id="2">0x</Keywords>
@YellowAfterlife
YellowAfterlife / array_foreach.gml
Created Sep 1, 2018
Coroutine output from GMEdit
View array_foreach.gml
var l_ctx = argument[0];
if (!is_array(l_ctx)) {
l_ctx = array_create(6);
var l_argc = argument_count - 1;
var l_args = array_create(l_argc);
while (--l_argc >= 0) l_args[@l_argc] = argument[l_argc + 1];
l_ctx[2/* args */] = l_args;
return l_ctx;
}
var l_args = l_ctx[2/* args */];
View keyboard_key.gml
//{ keyboard_key
#define keyboard_key_get_code
/// keyboard_key_get_code(name:string):int
var r = keyboard_key_codes[?string_lower(argument[0])];
if (!is_undefined(r)) return r;
return -1;
#define keyboard_key_get_name
/// keyboard_key_get_name(code:int):string
var code = argument[0];
var r = keyboard_key_names[?code];
You can’t perform that action at this time.