Skip to content

Instantly share code, notes, and snippets.

View romamik's full-sized avatar
🐢

romamik

🐢
View GitHub Profile
#include <string>
#include <iostream>
#include <fstream>
#include <map>
#include <locale>
#include <vector>
#include <algorithm>
void countWords(std::ifstream &in, std::map<std::string, int> &result) {
std::string word;
@romamik
romamik / Main.hx
Created February 15, 2017 14:17
haxe null safety example
package;
import haxe.macro.Expr;
class Bar {
public var foo:Foo = null;
public function new() {}
}
class Foo {
public function new() {}
@romamik
romamik / KhaImageFromEncodedBytes.hx
Created January 11, 2017 08:29
Create kha image from encoded (png, jpg, etc...) bytes
package;
import haxe.io.Bytes;
import kha.Image;
#if sys_kore
@:cppFileCode('
#include <Kore/Graphics/stb_image.h>
#ifndef INCLUDED_kha_graphics4_TextureFormat
#include <kha/graphics4/TextureFormat.h>
@romamik
romamik / unzip.hx
Created November 8, 2016 15:10
haxe read zip file in js and flash and sys targets
//add this to html to use in js: <script src="pako_inflate.min.js"></script>
//also put this file near html file: https://github.com/nodeca/pako/blob/master/dist/pako_inflate.min.js
function unzipEntry(entry:haxe.zip.Entry) {
#if flash
if (entry.compressed) {
var data = entry.data.getData();
data.inflate();
entry.data = Bytes.ofData(data);
}