Skip to content

Instantly share code, notes, and snippets.

View KinoAR's full-sized avatar
🏠
Working from home

Kino KinoAR

🏠
Working from home
View GitHub Profile
@KinoAR
KinoAR / json_minify.py
Last active March 23, 2023 18:49
A JSON minify script written in Python.
#!/usr/bin/env python3
"""JSON minify program. """
import json # import json library
import sys # import sys library
def minify(file_name):
"Minify JSON"
file_data = open(file_name, "r", 1).read() # store file info in variable
json_data = json.loads(file_data) # store in json structure
@KinoAR
KinoAR / RMMVNodejs2-1.js
Created December 21, 2018 16:57
An example of Node.js copying using read/write file.
//=============================================================================
// RMMVNodeP1.js
//=============================================================================
/*:
* @author PluginDev
* @plugindesc A plugin to read and write files using Node.js
*
*/
(function () {
@KinoAR
KinoAR / FlxSignalExample.hx
Last active April 19, 2022 09:38
An example of a FlxSignal in action.
import flixel.util.FlxSignal;
// for signals that don't need data, use FlxSignal
var signal = new FlxSignal();
// for signals that need data, use FlxTypedSignal with the correct function type
var stringSignal = new FlxTypedSignal<String->Void>();
function noParamCallback() {
trace('Dispatched void event');
}
@KinoAR
KinoAR / InstanceExample.hx
Created September 4, 2021 16:47
An example of using instance properties in the Haxe programming language.
// A class; a template for creating objects with the properties listed in the class
class Duck {
public var age:Int;
public function new(age:Int) {
this.age = age;
}
}
class Test {
@KinoAR
KinoAR / InstanceStaticExample.hx
Created September 4, 2021 16:45
A gist displaying how to use the static vs instance properties.
//A class; a template for creating objects with the properties listed in the class
class Duck {
static public var CAN_FLY:Bool = true;
public var age:Int;
public function new(age:Int) {
this.age = age;
}
}
@KinoAR
KinoAR / StructInitExampleCode.hx
Created August 31, 2021 22:05
Advanced Example of the power of Struct Init
//Test it out here: https://try.haxe.org/#5Fb7F1f4
class Test {
public static function main() {
// Uncomment this and see what happens
// var firstUser:Person = {
// name: 'Tim'
// };
// trace(firstUser.name);
var user:Test2 = {
@KinoAR
KinoAR / StructInit.hx
Created August 31, 2021 21:44
An example of Struct Init usage within the Haxe programming language.
@:structInit class Person {
final name:String;
var age:Int = 30;
public function new(name:String, age:Int) {
this.name = name;
this.age = age;
}
public function greet()
/**
* ADTs take in a parameter as you can see here.
*/
enum ElementalAtk {
FireAtk(?dmg:Int);
WaterAtk(?dmg:Int);
LightningAtk(?dmg:Int);
MagnetoAtk(?dmg:Int);
IceAtk(?dmg:Int);
@KinoAR
KinoAR / ElementalADTs.hx
Created July 9, 2021 00:26
Advanced Enum Example
/**
* ADTs take in a parameter as you can see here.
*/
enum ElementalAtk {
FireAtk(?dmg:Int);
WaterAtk(?dmg:Int);
LightningAtk(?dmg:Int);
MagnetoAtk(?dmg:Int);
IceAtk(?dmg:Int);
@KinoAR
KinoAR / PluginPattern.js
Created November 3, 2016 03:49
A plugin pattern for creating plugins in RPGMaker MV
//=============================================================================
// PluginPattern.js
//=============================================================================
/*:
*
* @author Plugin Author Name
* @plugindesc The description of my plugin.
*