This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scopePreservingSplit(str: String, by: String) { | |
var scopePairs = ['()', '[]', '{}', '<>']; | |
var scopeState = [0, 0, 0, 0]; | |
var parts = new Array<String>(); | |
var buffer = ''; | |
inline function handleScope(c) { | |
for (i in 0...scopePairs.length) { | |
var open = scopePairs[i].charAt(0); | |
var close = scopePairs[i].charAt(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Global State | |
[select object] | |
- activeTexture(unit:TextureUnit) | |
- bindBuffer(target:BufferTarget, buffer:GLBuffer) | |
- bindFramebuffer(target:FramebufferTarget, framebuffer:GLFramebuffer) | |
- bindRenderbuffer(target:RenderbufferTarget, renderbuffer:GLRenderbuffer) | |
- bindTexture(target:TextureTarget, texture:GLTexture) | |
- useProgram(program:GLProgram) | |
[primtive draw state] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HXML ?= $(shell find . -name "*.hxml" -print -quit) | |
SOURCES ?= $(shell find . -name "*.hx") | |
# Determine output file or directory from target arguments in HXML | |
OUTPUT ?= $(shell echo ' \ | |
class M { static function main() { \ | |
var r = ~/^\s*-?-(js|lua|swf|as3|neko|php|cpp|cppia|cs|java|python|hl)\s+([^\\n]+)/im; \ | |
if (r.match(sys.io.File.getContent(Sys.args()[0]))) \ | |
Sys.print(r.matched(2)); \ | |
} } \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C)2005-2018 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: | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C)2005-2018 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: | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getType(x) { | |
let type = typeof x; | |
if (type === 'object') { | |
if (Array.isArray(x)) { | |
return `Array<${getType(x[0])}>`; | |
} else { | |
let fields = []; | |
for (let key of Object.keys(x)) { | |
fields.push(`${key}: ${getType(x[key])}`); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* # GFF3 File format | |
* https://github.com/The-Sequence-Ontology/Specifications/blob/master/gff3.md | |
*/ | |
export type LineCallbacks = { | |
// directives | |
onVersion: (versionString: string) => void, | |
onSequenceRegion: (seqId: string | null, start: number | null, end: number | null) => void, | |
onFeatureOntology: (uri: string) => void, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// analyitc spring integration | |
// useful when you want a robust single-spring simulation | |
stepSpring( | |
dt_s: number, | |
state: { | |
x: number, | |
v: number, | |
pe: number, // potential energy | |
}, parameters: { | |
tension: number, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Incomplete parser for closure compiler externs | |
Converts closure externs to haxe classes and modules | |
Tested using https://github.com/nodebox/opentype.js/tree/master/externs | |
https://github.com/google/closure-compiler/wiki | |
*/ | |
class ClosureExternConverter { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package; | |
import haxe.io.Bytes; | |
import haxe.io.Input; | |
@:enum abstract DDSD(UInt) to UInt{ | |
var CAPS = 0x1; | |
var HEIGHT = 0x2; | |
var WIDTH = 0x4; | |
var PITCH = 0x8; |