Skip to content

Instantly share code, notes, and snippets.

@Justasic
Justasic / ThreadEngine.cpp
Last active October 20, 2017 10:19
A dynamic threading engine I built for a game I never made. You should only interact with the ThreadHandler class. Requires C++14 or C++17.
/*
* Copyright (c) 2013-2017, Justin Crawford <Justin@stacksmash.net>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose
* with or without fee is hereby granted, provided that the above copyright notice
* and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
@phadej
phadej / poly-nfdata.hs
Last active November 6, 2017 22:24
Example how is possible to write polykinded type-classes in GHC-8.0. It's not that bad or messy, but I'm not sure it's practical either.
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeSynonymInstances #-}
@taktoa
taktoa / incremental.nix
Last active January 8, 2018 12:57
Build the profunctors library incrementally using Nix.
with builtins;
rec {
pkgs = import <nixpkgs> {};
testGHC = pkgs.haskellPackages.ghcWithPackages (p: with p; [
base base-orphans bifunctors comonad contravariant distributive
tagged transformers
]);
@pyrtsa
pyrtsa / gist:6213784
Created August 12, 2013 18:46
When installing Haskell Platform fails on Mac OS X (with quick fix below)

When installing Haskell Platform fails on Mac OS X (with quick fix below)

I was fighting with Haskell last weekend. At first, I couldn't install some missing libraries with Cabal, and then, when trying to find out what's wrong, I ended up removing the whole Haskell installation — only to find out I could no longer install neither the Haskell Platform nor even just Cabal Install! The warnings I would see were more or less about the use of the single quote in source code:

Preprocessing library text-0.11.2.3...

Data/Text.hs:6:52:
     warning: missing terminating ' character [-Winvalid-pp-token]

-- Copyright : (c) 2009, 2010, 2011, 2012 Bryan O'Sullivan,

@arianvp
arianvp / gist:08ec29508ffcc7f7f3214bbf94f8a733
Created August 24, 2018 11:49
RE: NixOS in production

I think Gabriel's blogpost http://www.haskellforall.com/2018/08/nixos-in-production.html he explains how to work around nixos-rebuild's inflexibilities. However, I think everything that is being suggested is actually possible in nixos-rebuild already

They blog is still a good exercise to understanding what nixos-rebuild does behind the scenes though.

Deploy to a target machine, from a build machine, with pinned nixpkgs, and a specific nixos config:

nixos-rebuild switch \
 --build-host=build@build.service.consul \
@mnzk
mnzk / csv-bnf-rfc4180.txt
Created April 20, 2013 13:44
CSV BNF (RFC4180) for instaparse
file = [header CRLF] record (CRLF record)* [CRLF]
header = name (COMMA name)*
record = field (COMMA field)*
name = field
field = (escaped | non-escaped)
escaped = DQUOTE (TEXTDATA | COMMA | CR | LF | 2DQUOTE)* DQUOTE
2DQUOTE = DQUOTE DQUOTE
non-escaped = TEXTDATA*
COMMA = '\u002C'
CR = '\u000D'
@ezalejski
ezalejski / keybase+git-crypt.md
Created February 2, 2018 16:28 — forked from 3noch/keybase+git-crypt.md
How to add a Keybase user to your repo using git-crypt
keybase pgp pull <keybase.io user>
gpg --edit-key <keybase.io user>
  > lsign
  > save
git-crypt add-gpg-user <keybase.io user>
@edsko
edsko / RTTI.hs
Created June 9, 2017 17:54
Run-time type information in Haskell
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
@cartazio
cartazio / xcode5-haskell-directions.md
Last active May 28, 2019 00:35
xcode 5 + OS X 10.9 mavericks GHC work around nuttiness

PSA :

just use GHC for OSX https://ghcformacosx.github.io

the rest of these directions are preserved for historical purposes

TLDR version, if you have homebrew

xcode-select --install ; brew tap homebrew/versions ;   brew tap homebrew/dupes \
@api-admin
api-admin / OAuth_developer_cheat_sheet.md
Created April 25, 2014 20:33
SurveyMonkey OAuth Developer Cheat Sheet

SurveyMonkey OAuth Developer Cheat Sheet

Authorization Flow

SurveyMonkey implements the authorization code grant framework of OAuth 2.0 as described in the RFC here: http://tools.ietf.org/html/rfc6749#page-24

 +-------------+ 
 |SurveyMonkey |   O

|Account | /|\