Skip to content

Instantly share code, notes, and snippets.

@munificent
munificent / generate.c
Last active August 29, 2025 13:51
A random dungeon generator that fits on a business card
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u
@hsyl20
hsyl20 / ghc_gitlab.user.js
Created January 14, 2019 16:16
Add some buttons to Gitlab instance of GHC
// ==UserScript==
// @name Gitlab discussion helper
// @version 1
// @grant none
// @description This script let you toggle all discussions in Gitlab
// @include https://gitlab.haskell.org/*
// @run-at document-idle
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// ==/UserScript==
type name default problem
Opt_WarnDuplicateExports duplicate-exports on
Opt_WarnOverflowedLiterals overflowed-literals on
Opt_WarnEmptyEnumerations empty-enumerations on
Opt_WarnMissingFields missing-fields on
Opt_WarnMissingMethods missing-methods on
Opt_WarnOverlappingPatterns overlapping-patterns on
@osa1
osa1 / checked.hs
Created February 24, 2017 20:02
lightweight checked exceptions with freer
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE IncoherentInstances #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RoleAnnotations #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
server = Server.make_dispatch(Server.Filter.path(["app1"]),
| {~path ...} -> Resource.html("Test", <>This is application 1, with path {List.to_string(path)}</>)
)
server = Server.make_dispatch(Server.Filter.path(["app2"]),
| {~path ...} -> Resource.html("Test", <>This is application 2, with path {List.to_string(path)}</>)
)
server = Server.simple_dispatch(
| {~path ...} -> Resource.html("Test", <>No application, this is {List.to_string(path)}</>)