View gist:87c1aa8b20d7f3c44852
(def-alias Zipper | |
(HMap :mandatory {:focus (U nil Node) :left (Vec Node) :right (Vec Node) :path Path :counter Integer} | |
:complete? true)) | |
(ann left [Zipper -> Zipper]) | |
(defn left [zipper] | |
(let [prev (peek (:left zipper))] | |
(if (nil? prev) | |
zipper | |
{:focus prev |
View gist:6cb25a1f5a01bbb610d7
fn main() { | |
let mut arglist = args().skip(1); | |
match arglist.next() { | |
Some(ref filename) if arglist.count() == 0 => run(filename), | |
_ => usage() | |
} | |
} |
View gist:96a54391dc4376843cea
use std::env::args; | |
use std::io::{Error, Read}; | |
use std::fs::File; | |
fn run(filename : &str) -> Result<(), Error> { | |
let mut f = try!(File::open(filename)); | |
let mut s = String::new(); | |
try!(f.read_to_string(&mut s)); | |
println!("{}", s); | |
return Ok(()); |
View gist:5636741
input { | |
lumberjack { | |
'port' => '5005' | |
'ssl_certificate' => '/opt/logstash/certs/lumberjack.cert' | |
'ssl_key' => '/opt/logstash/certs/lumberjack.key' | |
'ssl_key_passphrase' => 'testing' | |
'type' => 'gocardless' | |
} | |
} |
View gist:b2a7856d179999daa2de
module Main | |
import Data.Vect | |
import Data.Fin | |
%default total | |
find : Eq x => List x -> x -> Maybe Int | |
find [] elem = Nothing | |
find (y :: xs) elem = if y == elem then (Just 0) else (map (\ n => n + 1) (find xs elem)) |
View gist:dcc12d3ff6a49c11cdc9
-- So as an example of using a log orientated approach in PostgreSQL, | |
-- let's write a simple blog application. We will want to be able to: | |
-- * Write and edit blog posts | |
-- * Publish revisions of posts for public viewing | |
-- * Delete posts | |
-- * Add or remove tags to posts | |
-- Let's start by creating a schema. |
View gist:937b9b7910ebb8fdb7288bcb8ec6b7e3
{ | |
"components": { | |
"schemas": { | |
"example": { | |
"required": [ | |
"example", | |
"example3" | |
], | |
"type": "object", | |
"properties": { |