This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Types | |
import Database.Persist.MySQL | |
import Control.Monad.Logger | |
import Control.Monad.IO.Class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE LambdaCase #-} | |
module Main where | |
import Control.Applicative | |
import Data.Foldable | |
import Data.List.Split | |
import Data.Maybe (fromMaybe, mapMaybe) | |
import Safe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select ( | |
ident || 'StandardCode :: StandardCode' || E'\n' || ident || 'StandardCode = "' || standard_code || '"' || E'\n' || E'\n' || | |
ident || 'StandardId :: StandardId' || E'\n' || ident || 'StandardId = StandardKey "' || standard_id || '"' || E'\n' | |
) FROM | |
(select | |
(case when school_grade=1 then 'one' | |
when school_grade=2 then 'two' | |
when school_grade=3 then 'three' | |
when school_grade=4 then 'four' | |
when school_grade=5 then 'five' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE RecordWildCards #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
module Main where | |
import Control.Monad.Random.Class | |
import Control.Monad.Reader | |
import Data.Foldable (for_) | |
import Graphics.Rendering.Cairo hiding (x, y) | |
import qualified Numeric.Noise.Perlin as P | |
import System.Random |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
taperGeometric | |
:: Double | |
-- ^ percentage to decrease by each iteration | |
-> Double | |
-- ^ Starting width | |
-> [V2 Double] | |
-- ^ The path | |
-> [(V2 Double, Double)] | |
-- ^ The path, augmented with line widths | |
taperGeometric percentage startingWidth path = zip path widths |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# OPTIONS_GHC -fno-warn-unused-imports #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE RecordWildCards #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeApplications #-} | |
-- | A "living" module for short-lived experiments. | |
module Sketch where | |
import Algorithms.Bezier (ControlPoint (..)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Sketch where | |
import Data.Space2d | |
-- (Other imports omitted) | |
-- | Generate a unit vector space given a size | |
randomSpace2d :: Rational -> Generate (Space2d (V2 Double)) | |
randomSpace2d size = do | |
(w, h) <- getSize | |
let |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newtype JSONB a = JSONB { unJSONB :: a } | |
deriving | |
( Generic | |
, Eq | |
, Foldable | |
, Functor | |
, Ord | |
, Read | |
, Show | |
, Traversable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type SpringMesh = Space2d Mover | |
updateSpringMesh :: Rect -> SpringMesh -> SpringMesh | |
updateSpringMesh rect springMesh = Space2d.mapWithKey springify springMesh | |
where | |
springify index mover = | |
let movers = Space2d.neighbors index springMesh | |
in update | |
. bounceRect rect | |
. applyFriction 0.05 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
renderSketch :: Generate () | |
renderSketch = do | |
fillScreenHsv linen | |
cairo $ setLineJoin LineJoinRound | |
cairo $ setLineCap LineCapRound | |
cairo $ setLineWidth 0.1 | |
xScale <- sampleRVar (D.uniform 0 3) | |
yScale <- sampleRVar (D.uniform 0 3) |