Skip to content

Instantly share code, notes, and snippets.

@leshido
leshido / Main.hx
Created April 7, 2019 08:12
Get param from Map as different supported types
package;
class Main {
public static function main() {
Params.fromQueryString("?foo=bar&thing=true&num=12");
Params.get("foo", "cool"); // 'bar' ('foo' is defined)
@leshido
leshido / Hacky.hx
Created February 2, 2019 20:23
A hacky way to hijack methods in the Haxe standard library
package;
import haxe.macro.*;
class Hacky {
public static function build() {
var fields = Context.getBuildFields();
for (field in fields) {
if (field.name == "random") { // Here we target the `random()` method of the Math class.
@leshido
leshido / baseline.css
Created February 22, 2017 13:34
A quick baseline grid overlay using css+svg. Inspired by [Basehold.it](https://basehold.it/).
/**
* A quick baseline grid overlay using css+svg.
* Inspired by [Basehold.it](https://basehold.it/).
* @author leshido
*/
body {
position: relative;
}
@leshido
leshido / SamsungGalaxyFix.js
Last active February 19, 2017 14:03
Fixes Samsung Galaxy S2 & S3 Android Browser rendering freezes on touch bug
// Resize document width to fix Samsung Galaxy stock-browser render freeze on touch bug:
if (/Android/.test(navigator.userAgent) && !(/Chrome/.test(navigator.userAgent)))
{
var ds = document.documentElement.style;
var origW = ds.width;
ds.width = "101%";
setTimeout(function() { ds.width = origW; }, 500);
}