Skip to content

Instantly share code, notes, and snippets.

William Wolf throughnothing

Block or report user

Report or block throughnothing

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@throughnothing
throughnothing / TinyServant.hs
Created Jun 5, 2019 — forked from kosmikus/TinyServant.hs
Implementation of a small Servant-like DSL
View TinyServant.hs
{-# LANGUAGE DataKinds, PolyKinds, TypeOperators #-}
{-# LANGUAGE TypeFamilies, FlexibleInstances, ScopedTypeVariables #-}
{-# LANGUAGE InstanceSigs #-}
module TinyServant where
import Control.Applicative
import GHC.TypeLits
import Text.Read
import Data.Time
@throughnothing
throughnothing / ServantGADT.hs
Created May 30, 2019
Servant with GADT types experiment
View ServantGADT.hs
{-#LANGUAGE GADTs #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
module Lib where
import Servant
import Servant.API ()
data Query t where
@throughnothing
throughnothing / DBTypes.purs
Created May 25, 2019
Is this a "clever" way to handle DB models? It keeps it POJO, and reduces redundancy for non-id'ed (and non-createdAt'ed) objects.
View DBTypes.purs
type WithId r = ( id :: Int | r )
type WithCreatedAt r = ( createdAt :: String | r )
type DB r = { | (WithId (WithCreatedAt r)) }
type DBUser = DB UserRows
type User = { | UserRows }
type UserRows =
( googleId :: String
, name :: String
, email :: String
View gist:e8373251337f50fefdd278e3ebb0954b

Operational PGP

This is a guide on how to email securely.

There are many guides on how to install and use PGP to encrypt email. This is not one of them. This is a guide on secure communication using email with PGP encryption. If you are not familiar with PGP, please read another guide first. If you are comfortable using PGP to encrypt and decrypt emails, this guide will raise your security to the next level.

View spacemacs-cheshe.md

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
  • SPC TAB - switch to previous buffer
  • SPC b b - switch buffers
View purescript-gadt.purs
module GADT.Main where
import Prelude (class Category, class Semigroupoid, (<<<), flip, identity, ($), (+), (==))
import Unsafe.Coerce (unsafeCoerce)
newtype Leibniz a b = Leibniz (forall f. f a -> f b)
infix 4 type Leibniz as ~
instance semigroupoidLeibniz :: Semigroupoid Leibniz where
@throughnothing
throughnothing / Algebra.purs
Created Dec 4, 2018 — forked from LukaJCB/Algebra.purs
Alternative Tagless Final encoding in PureScript
View Algebra.purs
module Algebra where
import Prelude
import Control.Monad.Eff (Eff)
import Data.Maybe (Maybe(..))
newtype ConsoleAlg f = ConsoleAlg
{ printLn :: String -> f Unit
, readLn :: f String
@throughnothing
throughnothing / Money.java
Last active Aug 23, 2018
Phantom Types in Java for Number Constraints
View Money.java
import com.sun.istack.internal.NotNull;
import static io.vavr.API.*;
import io.vavr.collection.List;
import io.vavr.control.Option;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Value;
import java.math.BigDecimal;
@throughnothing
throughnothing / Loeb.purs
Last active Oct 8, 2018
Loeb in Purescript
View Loeb.purs
module Loeb where
import Prelude
import Data.Lazy (Lazy, defer, force)
import Data.Array ((!!))
import Data.Maybe (fromMaybe)
loeb :: f a. Functor f => f (f (Lazy a) -> a) -> f (Lazy a)
loeb x = go where go = map (\y -> defer (\_ -> y go)) x
@throughnothing
throughnothing / collatz.purs
Last active Aug 14, 2018
Collatz Purescript
View collatz.purs
module Collatz where
import Prelude (div, otherwise, (==), (*), (+), (>), ($), map)
import Data.Array (length)
import Data.Ord (class Ord)
import Data.Semiring (class Semiring, zero)
import Data.Functor (class Functor)
import Data.Int (even)
import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
You can’t perform that action at this time.