Skip to content

Instantly share code, notes, and snippets.

View boozook's full-sized avatar
🦀
Dreaming about decentralised GH based on Pijul. 👨🏻‍💻

Alexander Koz. boozook

🦀
Dreaming about decentralised GH based on Pijul. 👨🏻‍💻
View GitHub Profile
@boozook
boozook / Main.hx
Created June 26, 2016 23:50 — forked from skial/Main.hx
Haxe 3.3.0-rc.1 Abstract @:resolve and @:op(a.b) metadata simplified examples.
package;
import haxe.macro.Expr;
class Main {
static function main() {
var smap:StringMap = ['firstName' => 'Skial', 'lastName' => 'Bainn'];
trace( smap.lastName, smap.firstName ); // Bainn, Skial
@boozook
boozook / Ipfs.url.scheme.handler.scpt
Last active April 10, 2016 22:04
IPFS / IPNS URL-Scheme Handler App (for Mac OS X Safari only)
-- https://gist.github.com/fzzr-/b9cc28ee20cac95706d0bca1cedcbed9
on open location theURL
set theNewURL to ""
set theGateway to "https://gateway.ipfs.io/"
set oldDelims to AppleScript's text item delimiters
-- xxx: better use `env bash -l`
set isIpfsRunning to length of (do shell script "bash -lc " & quoted form of "ipfs id -f='<addrs>'") > 0
-- todo: display dialog "Wanna activate IPFS daemon?"
if (isIpfsRunning) then
set theGateway to "http://127.0.0.1:8080/"
@boozook
boozook / Main.hx
Created January 3, 2016 14:51
Haxe issue #4763 (compilable)
package ;
import haxe.macro.*;
import haxe.macro.Expr;
import haxe.macro.Type;
class Main
{
static var A:String = getConstA();
static var B:String = getConstB();
@boozook
boozook / Main.hx
Created January 3, 2016 14:49
Haxe issue #4763
package ;
import haxe.macro.*;
import haxe.macro.Expr;
import haxe.macro.Type;
class Main
{
static inline var A:String = getConstA();
static inline var B:String = getConstB();
@boozook
boozook / Test.hx
Last active November 18, 2015 13:30
Haxe Java Abstract(:Float) Inline Increment test (issue #4649)
import haxe.unit.*;
abstract Val<T:Float>(T) from T to T
{
public inline function incrmnt():Void this++; // HERE
}
class Test extends TestCase
{
function testAbstractInlineIncrement()
@boozook
boozook / Main.hx
Last active November 17, 2015 19:59 — forked from nadako/Main.hx
Signal builder using new Rest type parameter in Haxe
package hx.event.test;
import haxe.unit.TestRunner;
class Main
{
public static function main()
{
var runner = new TestRunner();
runner.add(new SignalTest());
@boozook
boozook / Direction.hx
Last active June 8, 2016 14:35 — forked from MSGhero/Direction.hx
Compass direction <=> degree measure abstract for Haxe. Useful for me, maybe for you.
package entities;
import nape.geom.Vec2;
/**
* @author MSGHero
*/
@:enum
abstract Direction(Int) {
@boozook
boozook / ResourceManager.hx
Last active August 26, 2015 19:26 — forked from tiagolr/ResourceManager.hx
Embeding files load with Haxe + Openfl
import haxe.io.Bytes;
import haxe.Resource;
import openfl.Assets;
import openfl.display.Bitmap;
import openfl.display.BitmapData;
import openfl.display.Loader;
import openfl.utils.ByteArray;
/**
@boozook
boozook / TestCase.hx
Created July 19, 2015 17:21
haxe.unit.TestCase with Enum-matching
/*
* Copyright (C)2005-2012 Haxe Foundation
*
* 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:
*
@boozook
boozook / Main.hx
Last active August 29, 2015 14:21 — forked from savage69kr/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);