Skip to content

Instantly share code, notes, and snippets.

View anthonyquizon's full-sized avatar

Anthony Quizon anthonyquizon

  • Sydney, Australia
View GitHub Profile
@anthonyquizon
anthonyquizon / server.d
Created June 9, 2020 01:21
Dlang Vibe.d REST with CORS example
const PORT = 8008;
interface APIInterface {
@safe:
string postMatches();
string get();
}
class APIHandlers : APIInterface {
@anthonyquizon
anthonyquizon / guile-http-client.scm
Created June 5, 2020 03:50
Example of using web client in guile
(use-modules (web client)
(web response)
((rnrs) :version (6)))
(define port "8000")
(define body "{\"foo\": \"xyx\"}" )
;; GOTCHAs
;; Body needs to be converted from string to utf8 and back again
;; Need to destructure response with let-values in order to get body string
// db.zig
const std = @import("std");
const warn = std.debug.warn;
const Allocator = std.mem.Allocator;
const util = @import("../util.zig");
const c = @cImport({
@cInclude("lmdb.h");
});
@anthonyquizon
anthonyquizon / example.rkt
Created July 24, 2019 02:01
Stacktrace information in racket repl (command line)
#lang racket
(require racket/trace)
(define (example)
(error a b c))
(trace example)
@anthonyquizon
anthonyquizon / main.rkt
Last active March 4, 2020 00:39
Racket Minimal Server with Static File Serving
#lang racket
(require web-server/servlet-env
web-server/http
web-server/dispatchers/dispatch)