This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From haskell "Monoidal Parsing—Edward Kmett" | |
import cats.implicits._ | |
final case class Balance(l: Int, r: Int) | |
object Balance { | |
val EMPTY = Balance(0, 0) | |
val LEFT = Balance(0, 1) | |
val RIGHT = Balance(1, 0) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Grid(cells, generation, cell_scale){ | |
this.text = " all work and no play makes jack a dull boy "; | |
// cells | |
this.cells = cells; | |
this.generation = generation; | |
// scale | |
this.cell_scale = cell_scale; | |
// create next generation | |
this.next_gen = function(ruleset){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION key_underscore_to_camel_case(s text) | |
RETURNS json | |
IMMUTABLE | |
LANGUAGE sql | |
AS $$ | |
SELECT to_json(substring(s, 1, 1) || substring(replace(initcap(replace(s, '_', ' ')), ' ', ''), 2)); | |
$$; | |
-- TODO: add recursive processing | |
CREATE FUNCTION json_underscore_to_camel_case(data json) |
NewerOlder