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 / Main.hx
Last active April 8, 2021 12:17
Coconut Animation
import haxe.Timer;
import tink.state.Observable;
import coconut.ui.View;
import coconut.ui.RenderResult;
import coconut.ui.Renderer;
import tink.pure.List;
using tink.CoreApi;
@kevinresol
kevinresol / WhatsappWebSend.js
Created January 28, 2018 15:38
Automate message sending in active chat for Whatsapp Web
function send(message) {
var input = document.querySelector('div.pluggable-input-body.copyable-text.selectable-text');
input.innerText = message;
input.dispatchEvent(new InputEvent('input', {
inputType: 'insertText',
data: message,
bubbles: true,
cancelable: false,
composed: true,
detail: 0,
@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

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 / 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 |
@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;
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 / 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();
Copy expressions with Haxe macro
@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