Skip to content

Instantly share code, notes, and snippets.

View jcdickinson's full-sized avatar
🐵

Jonathan Dickinson jcdickinson

🐵
View GitHub Profile
// Example
State {
x
cond
}
local a = state.x + 1
text a
@jcdickinson
jcdickinson / fix-aoe4.sh
Last active August 3, 2022 21:51
AOE4 Desync Fix
#!/usr/bin/env bash
set -e
STEAM_DIR=$HOME/.steam/steam/steamapps
if [ ! -e "$STEAM_DIR" ]; then
# Possibly flatpak
STEAM_DIR=/var/home/$USER/.var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps
fi
const fetchMachine = Machine({
initial: "init",
context: {
element: null,
pointerId: 0,
startX: 0,
startY: 0,
transform: null,
},
invoke: {
@jcdickinson
jcdickinson / machine.js
Last active July 2, 2021 00:58
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
initial: "dragging",
context: {},
entry: "log",
states: {
dragging: {
on: {
pointerup: "drop",
pointermove: {
@jcdickinson
jcdickinson / machine.js
Last active July 1, 2021 21:38
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
initial: "dragging",
context: {},
entry: () => console.log("started"),
states: {
dragging: {
on: {
pointerup: "drop"
@jcdickinson
jcdickinson / machine.js
Last active July 1, 2021 19:47
Generated by XState Viz: https://xstate.js.org/viz
const DragMachine = null;
const fetchMachine = Machine({
id: "exampleParent",
initial: "idle",
context: {
x: 0,
y: 0,
},
@jcdickinson
jcdickinson / LICENSE
Last active June 30, 2021 20:07
XState Drag/Drop
Copyright 2021 Jonathan Dickinson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE O
@jcdickinson
jcdickinson / Parse.cpp
Created October 4, 2018 05:55
hextoint
// Does not reject invalid data. define NO_OVERFLOW to avoid values
// larger than 15, but it will still accept invalid characters.
// MSN(x) = Most-significant nibble
// LSN(x) = Least-significant nibble
// SHL(x, y) = Shift left
// SHR(x, y) = Shift right
// MSN(Digits) = 0011
// MSN(Upper) = 0100
@jcdickinson
jcdickinson / Add.asm
Last active November 4, 2017 14:39
The Curious Case of the 1814 Byte Method
; Assembly listing for method System.HashCode:Test_1():int
; Emitting BLENDED_CODE for X64 CPU with AVX
; optimized code
; rsp based frame
; partially interruptible
; Final local variable assignments
;
; V00 loc0 [V00 ] ( 29, 11 ) struct (32) [rsp+0x30] do-not-enreg[XSFB] must-init addr-exposed ld-addr-op
; V01 tmp0 [V01,T00] ( 3, 6 ) int -> rcx
; V02 tmp1 [V02,T08] ( 5, 2 ) int -> rcx
@jcdickinson
jcdickinson / razerngen.ps1
Last active February 28, 2017 17:31
Razer NGEN
$InstallDir = 'C:\Program Files (x86)\Razer'
Get-ChildItem -Path $InstallDir -Filter '*.dll' -Recurse | ForEach-Object {
$Assembly = $_.FullName
Write-Host "Queueing up $Assembly for NGEN installation."
C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe install $Assembly /queue:2 /nologo
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe install $Assembly /queue:2 /nologo
}
Get-ChildItem -Path $InstallDir -Filter '*.exe' -Recurse | ForEach-Object {