Skip to content

Instantly share code, notes, and snippets.

@j-mueller
j-mueller / chart.css
Created October 8, 2012 09:36
Zoom and Pan with D3
.zoomchart div {
width: 100%;
}
.axis path, .axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
23c23
< <version>7</version>
---
> <version>9</version>
29c29
< <version>3.9.0.Final</version>
---
> <version>3.9.4.Final</version>
73a74,82
> <dependency>
@j-mueller
j-mueller / DST.hs
Created July 29, 2016 20:25
Dempster-Shafer theory of evidence in Haskell
-- | Simple implementation of DST
module DST where
import Control.Applicative
import Data.Foldable
import Data.Monoid
import Data.Semigroup
import qualified Data.Set as S
-- | Belief structure, mass function, basic belief assignment
@j-mueller
j-mueller / ghcjs.md
Last active February 6, 2018 12:59
GHCJS with Nix on WINDOWS

1. Prerequisites

2. Start a nix shell with docker

  • Create a new folder and open a terminal inside it
@j-mueller
j-mueller / docker.ps1
Created January 31, 2018 09:30
Delete all docker images of the same name (with Powershell)
docker images hello-world -q | ForEach-Object { & "docker" "rmi" $_ }
@j-mueller
j-mueller / StructuredTree.hs
Last active March 10, 2018 14:42
A binary tree whose shape `s` is encoded in the type, with an instance `Monoid (StructuredTree s a)` that appends the leaf values, and JSON serialization
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE LambdaCase #-}
Error: Used but not defined in the current conversion: Type variable: a
Context: Converting type: a
Context: Converting expr: case ds_df5t of {
__DEFAULT -> False;
[] ->
&&_adXn
(> @ Height $fOrdInt h_adXl (I# dt_df8e))
(&&_adXn
(<= @ Height $fOrdInt h_adXl campaignCollectionDeadline_adXj)
(&&_adXn
@j-mueller
j-mueller / StateMachine.hs
Created November 30, 2018 15:26
State machine
{-# LANGUAGE TemplateHaskell #-}
module Language.Plutus.Coordination.StateMachine.TH(
StateMachine(..),
stateMachine
) where
import Language.Haskell.TH (Q, TExp)
import Language.Plutus.Runtime (PendingTx(..), ValidatorHash, DataScriptHash(..), RedeemerHash(..))
import qualified Language.Plutus.Runtime.TH as TH
import qualified Language.PlutusTx.Builtins as Builtins
@j-mueller
j-mueller / CrowdFunding.hs
Last active December 5, 2018 20:28
Playground contracts
-- | Crowdfunding contract implemented using the [[Plutus]] interface.
-- This is the fully parallel version that collects all contributions
-- in a single transaction. This is, of course, limited by the maximum
-- number of inputs a transaction can have.
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
@j-mueller
j-mueller / DoesntWork.hs
Last active March 15, 2019 18:34
Playground error
-- DOESNT WORK
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -O0 #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}