Skip to content

Instantly share code, notes, and snippets.

View xandkar's full-sized avatar
🤔
quis custodiet ipsos custodes?

Siraaj Khandkar xandkar

🤔
quis custodiet ipsos custodes?
View GitHub Profile
@xandkar
xandkar / darcsden-github-faail.md
Last active August 29, 2015 13:57
Error upon attempt to register for hub.darcs.net with github.com

error Sorry.. your GET request to /register/github/response?code=add360add3e8acd7e88e&state=pifygsytshhofkywtizyiuebmwfizcitsyeoevdqiscfhdoteh failed.

StatusCodeException
  (Status {statusCode = 404, statusMessage = "Not Found"})
  [ ("Server","GitHub.com")
  , ("Date","Mon, 10 Mar 2014 20:09:23 GMT")
  , ("Content-Type","application/json; charset=utf-8")
  , ("Transfer-Encoding","chunked")
open Core_kernel.Std
let group_by l f =
List.fold_left l ~init:[] ~f:(fun groups x ->
let y = f x in
let group =
match List.Assoc.find groups y with
| Some xs -> x :: xs
| None -> [x]
in
type 'a list = Nil | Cons of 'a * 'a list;;
type 'a list = Nil | Cons of 'a * 'a list
#
let l = Cons (1, Nil);;
val l : int list = Cons (1, Nil)
#
let hd, tl = match l with Cons (hd, tl) -> hd, tl;;
Warning 8: this pattern-matching is not exhaustive.
@xandkar
xandkar / exh.ml
Created July 1, 2014 17:01 — forked from NicolasT/exh.ml
(* This works *)
module W = struct
type a
type b
type (_, _) t =
| AA : (a, a) t
| AB : (a, b) t
| BB : (b, b) t
module Resource : sig
type t
val create : string -> t
end = struct
type t = string
let create realm =
realm
end
@xandkar
xandkar / automating-creativity.md
Last active August 29, 2015 14:04
What does "creativity" mean? Can we automate (at least a part of) the process?

Automating Creativity

What is creativity? One way to put it is: usage of some object in an unexpected way. As is sometimes said "He used X in a creative way."

All objects are understood by their properties and interfaces. Say for instance a pencil can be thought of having these:

Pencil:

@xandkar
xandkar / http_uri_parse.erl
Created August 1, 2014 21:11
http_uri:parse/1 is mildly retarded
4> http_uri:parse("http://photos.example.net/photos?size=original&file=vacation.jpg").
{ok,{http,[],"photos.example.net",80,"/photos",
"?size=original&file=vacation.jpg"}}
5>
@xandkar
xandkar / oauth1-init-coverage
Created August 1, 2014 22:07
oauth1 coverage after first test case
Coverage for application 'oauth1'
Coverdata collected over all tests
Excluded module(s): []
Module Covered (%) Covered (Lines) Not covered (Lines)
oauth1_authorization_request 0 % 0 21
oauth1_authorizations 0 % 0 22
oauth1_callback 0 % 0 15
ERROR: Conflicting dependencies for cowlib: [{"From: cowboy",
{".*",
{git,
"git://github.com/extend/cowlib.git",
"1.0.0"}}},
{"From: oauth1_core",
{".*",
{git,
"https://github.com/extend/cowlib.git",
{tag,"1.0.0"}}}}]
@xandkar
xandkar / how_to_set_granular_compiler_flags_via_myocamlbuild.md
Last active August 29, 2015 14:07
How to tweak compiler warnings when configuring build with Oasis?

How to tweak compiler warnings when configuring build with Oasis?

When using bare ocamlbuild, it is simple-enough - just add -cflags -w <warnings> to the ocamlbuild command line options. But when using Oasis to configure the build - it is less straight forward. Your options are:

  • A) use _tags file, which is simple, but incomplete in functionality and documentation
  • B) use myocamlbuild.ml, which is not documented at all

I first tried using option (A), but found that it only allows you to add one of the letter options and does not allow disabling individual, numbered, warnings: