Skip to content

Instantly share code, notes, and snippets.

View fal-works's full-sized avatar

FAL fal-works

View GitHub Profile
@fal-works
fal-works / IconCreator.pde
Created April 14, 2018 15:31
Icon Creator
// Processing 3.3.7
int iconSize = 640;
float strokeWeightFactor = 1.0 / 24;
int lineColorValue = 32;
int backgroundColorValue = 255;
boolean transparentIndicator = false;
float rotationAngleDegrees = -24;
@fal-works
fal-works / SoftShape.pde
Last active June 5, 2018 11:00
Draws a random soft shape with curveVertex().
// See also:
// https://forum.processing.org/one/topic/how-to-create-a-closed-spline-curve.html
float[] radiusArray;
void setup() {
size(600, 600);
noLoop();
noStroke();
fill(32);
@fal-works
fal-works / FizzBuzz.pde
Last active January 19, 2019 15:06
FizzBuzz with Processing
import java.util.Map.Entry;
class WordList {
private final StringList words = new StringList();
private final String separator;
WordList(String separator) {
this.separator = separator;
}
@fal-works
fal-works / 弾幕仮想機械メモ
Last active April 3, 2019 09:57
弾幕仮想機械メモ
// 命令セット一覧(2019-04-03)
// 命名規則が揺れている……
END // 実行終了。以降、速度などそのままに動き続ける
VANISH // バイトコードを動かしているActor(敵や弾丸の総称)自体を消して終了
// スタック操作系
PUSH_8
PUSH_16
PUSH_32
@fal-works
fal-works / MyMacro.hx
Created March 8, 2020 09:58
Haxe build macro sample: adding method
#if macro
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.TypeTools;
class MethodBuilder {
public static function build(): Array<Field> {
final fields = Context.getBuildFields();
final localType = Context.getLocalType();
@fal-works
fal-works / Macro.hx
Created March 19, 2020 17:11
Haxe: Build macro doesn't find namespaced metadata
#if macro
import haxe.macro.Context;
import haxe.macro.Expr.Field;
using StringTools;
class Macro {
static macro function checkMeta():Null<Array<Field>> {
warnIfNotFound(":myMeta");
return null;
@fal-works
fal-works / Main.hx
Created April 14, 2020 17:19
Haxe: abstract with @:generic type (doesn't compile)
@:generic // Without this it compiles fine
class GenericObject<T> {
final value: T;
public function new(v: T)
this.value = v;
}
abstract GenericAbstract<T>(GenericObject<T>) from GenericObject<T> {
public inline function new(data: GenericObject<T>)
@fal-works
fal-works / Main.hx
Created April 20, 2020 19:59
Haxe: Cannot force Iterator to be inlined
abstract MyInt(Int) from Int to Int {
@:op(A...B) static extern inline function iter(a: MyInt, b: MyInt): MyIntIterator
return new MyIntIterator(a, b);
public extern inline function toInt()
return this;
}
// @:access(IntIterator)
// @:forward(min, max, hasNext)
@fal-works
fal-works / Main.hx
Created April 21, 2020 13:53
Haxe: std.UInt with HashLink
class Main {
static function main() {
var a: UInt = -1;
Sys.println(a); // -1
trace(a); // 4294967295
}
}
@fal-works
fal-works / lastIndexOfFromNull.js
Created April 26, 2020 00:11
str.lastIndexOf(searchString, null) returns -1
// Node v13.12.0
const str = "abcde";
const searchString = "c";
const indices = [
str.indexOf(searchString), // 2
str.indexOf(searchString, null), // 2
str.lastIndexOf(searchString), // 2
str.lastIndexOf(searchString, null) // -1