Skip to content

Instantly share code, notes, and snippets.

View joehillen's full-sized avatar
🦡

Joe Hillenbrand joehillen

🦡
View GitHub Profile
@joehillen
joehillen / build.sh
Last active May 30, 2024 07:12
Build bash scripts with `source` files into a single script.
#!/usr/bin/env bash
#
# https://gist.github.com/joehillen/30f08738c1c3c0ca3e4c754ad33ad2ff
#
# This script inlines 'source' files.
#
# For long scripts, it is nice to be able to break them into multiple files
# to make them easier to work with but still release as a single script.
#
# Inspired by https://stackoverflow.com/a/37533160/334632 with the following enhancements:
@amosr
amosr / House.v
Last active September 11, 2019 10:45
Coq text adventure
Set Implicit Arguments.
Inductive Place
:= Kitchen | Bedroom | Hallway | Outside.
Inductive Card := NORTH | EAST | SOUTH | WEST.
Definition moveTo (p : Place) (c : Card) : option Place :=
match p, c with
@kotnik
kotnik / hook.sh
Created August 1, 2016 08:41
Git update hook to allow only signed commits
#!/usr/bin/env bash
##############################################################################
#
# check-commit-signature
# ----------------------
# A server-side update git hook for checking the GPG signature of a pushed
# commit.
#
# To enable this hook, rename this file to "update".
#
@dysinger
dysinger / packages.el
Last active January 16, 2021 19:30
Private spacemacs layer to try out Chris Done's Intero mode for haskell
;; 1. place this in ~/.emacs.d/private/intero/packages.el
;; 2. add intero, syntax-checking and auto-completion to your
;; ~/.spacemacs layer configuration & remove the haskell layer
;; if you were using that before
;; 3. make sure you have stack installed http://haskellstack.org
;; 4. fire up emacs & open up a stack project's source files
@nh2
nh2 / GenericsTypeName.hs
Last active May 5, 2020 15:21
Getting the name of a type with GHC.Generics
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
module GenericsTypeName
( TypeName(..)
, readBS
) where
import Data.ByteString (ByteString)
@aaronshaf
aaronshaf / paas.txt
Created December 4, 2015 17:05
Docker-Based Micro-PaaS
otto
https://ottoproject.io/
https://github.com/hashicorp/otto
deis
https://deis.com/
https://github.com/deis/deis
has 5 full-time devs
flynn
@OlegIlyenko
OlegIlyenko / Event-stream based GraphQL subscriptions.md
Last active July 4, 2024 07:31
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

@jyrimatti
jyrimatti / Main.hs
Created September 22, 2015 20:47
Aeson example
-- build with cabal file:
-- name: aeson-ex
-- version: 0.1
-- build-type: Simple
--
-- executable aeson_ex
-- hs-source-dirs: src
-- main-is: Main.hs
-- build-depends: base >= 4,
@TheBB
TheBB / loading.org
Last active June 22, 2023 11:53
Loading in Spacemacs

Emacs packages, features, files, layers, extensions, auto-loading, require, provide, use-package… All these terms getting you confused? Let’s clear up a few things.

Files

Emacs files contains code that can be evaluated. When evaluated, the functions, macros and modes defined in that file become available to the current Emacs session. Henceforth, this will be termed as loading a file.

One major problem is to ensure that all the correct files are loaded, and in the

anonymous
anonymous / Explanation.md
Created July 1, 2015 09:41
A short spelunking inside GHC to see how hard it would be to produce JSON that can be used for more valuable error reporting.

A quick dive into GHC's codebase (compiler/typecheck/TcUnify.hs) and searching for "but its type" gives me this (inside a where clause):

mk_ctxt :: TidyEnv -> TcM (TidyEnv, MsgDoc)
mk_ctxt env = do { (env', ty) <- zonkTidyTcType env orig_ty
                 ; let (args, _) = tcSplitFunTys ty
                       n_actual = length args
                       (env'', orig_ty') = tidyOpenType env' orig_ty
                 ; return (env'', mk_msg orig_ty' ty n_actual) }

mk_msg orig_ty ty n_args