Skip to content

Instantly share code, notes, and snippets.

mlms13 / postgresql_color_adt.sql
Last active Sep 19, 2017
Create a sum type for colors in sql
View postgresql_color_adt.sql
-- data NamedColor = Red | Green | Blue
-- data CustomColor = CustomColor
-- { r :: Int
-- , g :: Int
-- , b :: Int
-- }
-- data Color = NamedColor | CustomColor
create type custom_color as (r int, g int, b int);
Ravenstine /
Last active May 29, 2020
Fast CouchDB setup in AWS

Fast CouchDB setup in AWS

CouchDB is a NoSQL database for storing JSON documents. It comes with a REST API out of the box so your client applications can persist data while requiring you to write little or no server-side code. CouchDB's killer feature is its ability to easily replicate, which allows for horizontal scaling, easy backup, and for client adapters to synchronize documents. This is perfect if you want to write an application that is offline-first. It's become my go-to database when creating new

nadako / Main.hx
Created Jun 24, 2015
Haxe + SDL = native love \o/
View Main.hx
class Main {
static function main() {
var win = Sdl.createWindow("Hello", 100, 100, 800, 600, Sdl.WINDOW_OPENGL);
var ren = Sdl.createRenderer(win, -1, Sdl.RENDERER_ACCELERATED);
var bmp = Sdl.loadBMP("test.bmp");
var tex = Sdl.createTextureFromSurface(ren, bmp);
for (i in 0...3) {
View stream.js
import Timer from 'ui/timer';
let _listeners = Symbol();
class Source {
constructor(callback) {
this[_listeners] = [];
let sink = (value) => {
Timer.immediate(() => {
this[_listeners].map(ƒ => ƒ(value));
dpeek / gist:7803958
Created Dec 5, 2013
Building Haxe for Android
View gist:7803958
$ mkdir haxe-droid && cd haxe-droid
$ git clone
$ git clone
$ tar -vjxf android-ndk-r9b-darwin-x86.tar.bz2 && rm android-ndk-r9b-darwin-x86.tar.bz2 && mv android-ndk-r9b android-ndk
$ wget
$ tar -xzf ocaml-4.01.0.tar.gz && rm ocaml-4.01.0.tar.gz && mv ocaml-4.01.0 ocaml-src
deltaluca / gist:5413225
Created Apr 18, 2013
16.16 Fixed point numbers in Haxe 3
View gist:5413225
abstract Fixed16(Int) {
inline function new(x:Int) this = x;
inline function raw() return this;
inline static function RAW(x:Int) return new Fixed16(x);
public static var MAX_VALUE:Fixed16 = RAW(0x7fffffff);
public static var MIN_VALUE:Fixed16 = RAW(1);
@:from public static inline function fromf(x:Float) {
#if debug
puffnfresh / Catamorphism.hx
Created Apr 16, 2013
Automatically deriving a catamorphism from a closed interface.
View Catamorphism.hx
package precog.macro;
import haxe.macro.Expr;
import haxe.macro.Context;
class Catamorphism {
#if macro
public static function build(classes: Array<String>) {
var fields = Context.getBuildFields();
fields.push(cataMethod(classes, null));
puffnfresh / Example.hx
Last active Mar 6, 2020
Macro to generate "value classes" in Haxe
View Example.hx
import precog.macro.ValueClass;
class ABC implements ValueClass {
var a: Int;
var b: Bool;
var c: String;
class ABC extends ValueClass {
tong / NekoBoot.hx
Last active Jan 27, 2020
Haxe port of nekoboot.neko for creating executables from bytecode. Original: Usage : nekoboot <file.n>
View NekoBoot.hx
import sys.FileSystem;
Haxe port of nekoboot.neko for creating executables from neko bytecode.
Original version:
Usage : nekoboot <file.n>
View sass_and_less_compared.markdown

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.


You can’t perform that action at this time.