Skip to content

Instantly share code, notes, and snippets.

@Jarrio
Jarrio / EcsTools.hx
Last active February 12, 2023 02:23
AdianECS EcsTools
#if !macro
import ecs.System;
import ecs.Entity;
import ecs.Universe;
#else
import haxe.macro.Expr;
import haxe.macro.Context;
using haxe.macro.TypeTools;
#end
@Jarrio
Jarrio / launch.json
Created January 19, 2023 16:30
ceramic vscode launch.js config
{
"version": "0.2.0",
"configurations": [
{
"name": "Electron: Renderer",
"type": "chrome",
"request": "attach",
"port": 9223,
"webRoot": "${workspaceFolder}/project/web",
"timeout": 30000,
@Jarrio
Jarrio / preload.js
Created January 19, 2023 16:28
electron preload.js
// preload.js
// All the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
window.addEventListener('DOMContentLoaded', () => {
const replaceText = (selector, text) => {
const element = document.getElementById(selector)
if (element) element.innerText = text
}
@Jarrio
Jarrio / main.js
Last active April 27, 2023 14:53
electron main.js
// main.js
// Modules to control application life and create native browser window
const { app, BrowserWindow } = require('electron')
const path = require('path')
const createWindow = () => {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
@Jarrio
Jarrio / Test.hx
Last active October 21, 2022 20:40
test gist
Hello World from GitHub
@Jarrio
Jarrio / MacroTools.hx
Last active June 13, 2021 00:36
Haxe enum destructor macro
package;
import haxe.macro.Printer;
import haxe.macro.Context;
#if macro
import haxe.macro.Expr;
#end
using haxe.macro.Tools;
@Jarrio
Jarrio / Async.hx
Created July 14, 2020 01:40
Cheaty Async in haxe
package utilities;
import externs.Fetch.FetchOptions;
import js.Function;
import js.Syntax;
import js.lib.Promise;
class Async {
public static inline function async(f:Void->Void) {
@Jarrio
Jarrio / AMap.hx
Last active February 29, 2020 13:22
A map that tracks length
package;
typedef TMap<A, B> = {
var length:Int;
var data:Map<A, B>;
}
@:forward abstract AMap<A, B>(TMap<A, B>) {
public var length(get, never):Int;
@Jarrio
Jarrio / CArray.hx
Last active February 7, 2020 13:43
Abstract for array allows for backwards referencing indexes, first/last getters and a built in backwards loop!
package utilities;
@:forward abstract CArray<T>(Array<T>) {
public var last(get, never):T;
public var first(get, never):T;
public function new(value) {
this = value;
}
public function rewind(data:T->Void, end:Int = 0) {