Skip to content

Instantly share code, notes, and snippets.

View kevinresol's full-sized avatar
💭
Stand with Hong Kong

Kevin Leung kevinresol

💭
Stand with Hong Kong
View GitHub Profile
@kevinresol
kevinresol / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kevinresol
kevinresol / AssetPaths.hx
Created August 22, 2015 01:44
Macro to read asset paths
package util;
/**
* ...
* @author Kevin
*/
@:build(util.AssetPathsMacro.build())
class AssetPaths
{
@kevinresol
kevinresol / JS Callback to Future
Last active November 11, 2015 01:38
Convert js-style callback to Future, with macro
Convert js-style callback to Future, with macro
Copy expressions with Haxe macro
@kevinresol
kevinresol / Pool.hx
Created October 9, 2016 05:30
Just a pool
class Pool<T> {
var pool:Array<T>;
var factory:Void->T;
public function new(factory) {
this.factory = factory;
pool = [];
}
public function get() {
if(pool.length == 0) return factory();
return pool.pop();
lix install haxelib:travix
lix install haxelib:hxnodejs
lix install gh:haxetink/tink_chunk
lix install gh:haxetink/tink_streams#pure
lix install gh:haxetink/tink_io#pure
lix install gh:haxetink/tink_http#pure
lix install gh:haxetink/tink_web#pure
@kevinresol
kevinresol / gmap.hx
Created June 23, 2017 16:16
Google Map + Coconut
class Map extends View<{workers:WorkersData}> {
var map:GoogleMap;
var markers:Array<GoogleMapMarker> = [];
var locations:List<Location>;
function render() {
// "extract" the location and store in class variable
// this also cause render() to run again when the `locations` are updated
this.locations = workers.locations;
@kevinresol
kevinresol / vide-site
Last active July 10, 2017 08:18
ViDe Insight
# Posts
## Categories
| Name | Slug |
| -- | -- |
| Contact | contact |
| Home Banner | home-banner |
| Home Masthead | home-masthead |
| Work | work |

Keybase proof

I hereby claim:

  • I am kevinresol on github.
  • I am kevinresol (https://keybase.io/kevinresol) on keybase.
  • I have a public key whose fingerprint is 0411 D430 43CF E70E A1EB A7E1 43D5 3282 049D FB30

To claim this, I am signing this object:

@kevinresol
kevinresol / Wiper.hx
Created January 20, 2018 02:37
Client side API Wiper for tink_web
package api;
// to use: add `implements api.Wiper` to your API class
// but it doesn't handle imports, either you use wildcard (import api.*) or guard them with `#if`
#if macro
import haxe.macro.Context;
using tink.MacroApi;
#end