Skip to content

Instantly share code, notes, and snippets.

View haxiomic's full-sized avatar
:octocat:
Everything is happening

George Corney haxiomic

:octocat:
Everything is happening
View GitHub Profile
@haxiomic
haxiomic / Partial.hx
Last active February 26, 2023 11:44
Haxe macro to make all fields of a type optional (similar to Typescript's Partial<T>)
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.TypeTools;
#if !macro
@:genericBuild(PartialMacro.build())
#end
class Partial<T> {}
class PartialMacro {
@haxiomic
haxiomic / url.js
Created July 25, 2016 13:29
JavaScript URL parsing with regex - fallback for when window.URL isn't available
(function(URL, parent){
var initialConstructor = parent.URL;
var urlPattern = new RegExp(
"^" +
//protocol
"(?:((?:\\w+):)?/?/?)" +
//user:pass
"(?:(?:([^:]*)(?::([^@]*))?)?@)?" +
@haxiomic
haxiomic / timelord.js
Last active January 5, 2021 15:39
TimeLord.js: hack javascript's sense of time
window.TimeLord = (function(){
/*
# Time accounted for
Date.now()
window.performance.now()
window.setInterval(...)
window.setTimeout(...)
window.requestAnimationFrame(...)
# Not accounted for
@haxiomic
haxiomic / ClassBuild.hx
Last active July 18, 2017 09:04
Recursive version of getSaveData macro for haxe group thread
import haxe.macro.ComplexTypeTools;
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.ExprTools;
import haxe.macro.Type.TInst;
import haxe.macro.TypeTools;
class ClassBuild{
//the entire contents of a class is contained in the class's fields
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.ExprTools;
class ClassBuild{
//the entire contents of a class is contained in the class's fields
//a class-building-macro's job is to return an array of fields
static function saveClass():Array<Field>{
@haxiomic
haxiomic / instructions
Last active August 29, 2015 14:22
Hello!
# Installing Alchemy Control and Player
- Download an android file transfer tool if you've not got one
### With oculus.zip
- Open the oculus.zip and copy the Oculus folder to the sd card. Copy the Bikini Atoll.mp4 video to Oculus/360Videos.
- Open a file manager app on the android (search file manager on store). Navigate to Oculus/Alchemy/Apps Tap on the two apk files individually and it should prompt to install. Once installed, go to your app launcher, find Alchemy Control and open it.
- It should say "Service Running" in green and above "Autoplay Video Bikini Atoll.mp4". If service isn't running hit enable. If the autoplay video name isn't grey, it can't find the video file. Make sure it's in the right place (should be Oculus/360Videos/Bikini Atoll.mp4). If it says "not set" it can't find the autoplay.txt, make sure that is Oculus/Alchemy/autoplay.txt and contains the video name.
@haxiomic
haxiomic / voxel-flatten.hx
Last active August 29, 2015 14:20
voxel flatten
function createSliceTexture(vox:Vox, axis:Int = 0, ?params:TextureParams, maxW:Null<Int> = 4096, POT:Bool = true):SliceTexture{
if(params == null) params = {};
var defaultParams = {
channelType: GL.RGBA,
dataType: GL.UNSIGNED_BYTE,
filter: GL.LINEAR,
wrapS: GL.CLAMP_TO_EDGE,
wrapT: GL.CLAMP_TO_EDGE,
unpackAlignment: TextureTools.defaultParams.unpackAlignment
@haxiomic
haxiomic / Main.hx
Last active August 29, 2015 14:16
Working features touch_events
import luxe.Color;
import luxe.Input;
import luxe.Screen;
class Main extends luxe.Game {
var colors:Array<Color>;
override function config(config:luxe.AppConfig) {
@haxiomic
haxiomic / SassMeister-input-HTML.html
Created February 3, 2015 11:40
Generated by SassMeister.com.
<style>
.column,.columns{
background: #DDD;
text-align: center;
border-radius: 4px;
font-size: 1rem;
text-transform: uppercase;
height: 30px;
line-height: 30px;
margin-bottom: .75rem;
//THREE.hx r68
import js.html.*;
typedef HTMLElement = js.html.Element;
typedef HTMLCanvasElement = js.html.CanvasElement;
typedef HTMLImageElement = js.html.ImageElement;
typedef WebGLRenderingContext = js.html.webgl.RenderingContext;
/* Auto-generated using ts2hx */
@:enum @:native("THREE.CullFace") abstract CullFace(Int) {