Skip to content

Instantly share code, notes, and snippets.

View josuigoa's full-sized avatar

Josu Igoa josuigoa

View GitHub Profile
@jasononeil
jasononeil / Metric.hx
Last active November 10, 2016 11:16
Demonstration of using Haxe abstracts to take care of explicit conversions between different units of measurement, with no performance overhead.
class Metric {
static function main() {
var coinRadius:Millimeters = 12;
var myHeight:Centimeters = 180;
var raceLength:Meters = 200;
var commuteDistance:Kilometers = 23;
diff( coinRadius, myHeight ); // 1.788 meters
diff( raceLength, commuteDistance ); // 22800 meters
sum( commuteDistance, coinRadius ); // 23000.012 meters
@ruby0x1
ruby0x1 / tilt.shift.glsl
Last active February 19, 2024 02:46
Tilt shift shader, modified from something @grapefrukt gave me
// Modified version of a tilt shift shader from Martin Jonasson (http://grapefrukt.com/)
// Read http://notes.underscorediscovery.com/ for context on shaders and this file
// License : MIT
uniform sampler2D tex0;
varying vec2 tcoord;
varying vec4 color;
/*
Take note that blurring in a single pass (the two for loops below) is more expensive than separating
import haxe.macro.Expr;
class FTW
{
public static function build()
{
return haxe.macro.Context.getBuildFields().map(transformField);
}
static function transformField(field:Field)
@Simn
Simn / Main.hx
Last active February 22, 2021 09:51
New reification examples
class Main {
static function main() {
MyMacro.testReify();
}
}
@elsassph
elsassph / JQ.hx
Created June 29, 2012 05:53
jQuery shorthand for haxe 'using'
class JQ
{
static public inline function select(j:js.Dom.HtmlDom):js.JQuery
{
return new js.JQuery(j);
}
static public inline function query(j:String):js.JQuery
{
return new js.JQuery(j);