Skip to content

Instantly share code, notes, and snippets.

@dwhitney
dwhitney / index.html
Created May 4, 2022 14:09
Loading fonts in CSS
<!doctype html>
<html>
<head>
<style>
@import url('https://fonts.googleapis.com/css2?family=Water+Brush&display=swap');
@import url(https://cdn.jsdelivr.net/npm/firacode@6.2.0/distr/fira_code.css);
.waterBrush {
font-family: "Water Brush";
font-size: 34px;
module Main where
import Prelude
import Data.Array (range) as Array
import Data.Traversable (traverse)
import Effect.Aff (Aff)
combineABunchOfArrays :: Aff (Array Int)
@dwhitney
dwhitney / Main.purs
Created January 13, 2019 19:06
compiles
module Main where
import Prelude
import Effect (Effect)
import Effect.Console (logShow)
import Prim.Row (class Union)
type Layout =
( x :: String
@dwhitney
dwhitney / Main.purs
Created January 13, 2019 19:05
Doesn't compile
module Main where
import Prelude
import Effect (Effect)
import Effect.Console (logShow)
import Prim.Row (class Union)
type Layout =
( x :: String
@dwhitney
dwhitney / README.md
Last active March 5, 2022 12:54
Quick React Native with PureScript
  1. create-react-native-app purescript-app; cd purescript-app

  2. pulp init --force

  3. pulp build

  4. src/Main.js

var React = require("react");
var RN = require("react-native");

exports.text = function(props){
@dwhitney
dwhitney / Mail.purs
Created April 18, 2018 23:53
React stuff based on purescript-react-basic
module Main where
import Prelude
import Control.Monad.Eff (Eff)
import Unsafe.Coerce (unsafeCoerce)
h1 :: forall props. { | props } -> Array ReactElement -> ReactElement
h1 props children = element "h1" props children
@dwhitney
dwhitney / Main.purs
Created January 7, 2018 04:57
spork app
import Prelude hiding (div)
import Control.Monad.Eff (Eff)
import DOM (DOM)
import DOM.HTML (window) as DOM
import DOM.HTML.Window (localStorage) as DOM
import DOM.WebStorage.Storage (getItem, setItem) as DOM
import Data.Const (Const)
import Data.Either (hush)
import Data.Maybe (Maybe(..))
@dwhitney
dwhitney / Main.purs
Last active September 21, 2017 21:47
Variant exaple
module Main where
import Prelude
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)
import Data.Variant (SProxy(SProxy), Variant, inj, match)
oneTwoThree :: Variant (one :: String, two :: Boolean, three :: Number) -> String
oneTwoThree = match {
@dwhitney
dwhitney / Main.purs
Created June 9, 2017 17:47
same example as previous, but now with a EncodeJson type class
module Main where
import Data.Generic
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (log, CONSOLE)
import Data.Argonaut.Core (Json, stringify)
import Data.Argonaut.Encode.Class (class EncodeJson)
import Data.Argonaut.Generic.Aeson (encodeJson) as A
import Data.Argonaut.Encode (encodeJson)
import Data.Maybe (Maybe(..))
@dwhitney
dwhitney / Main.purs
Created June 9, 2017 17:02
Toy example of purescript argonaut generic encoding
module Main where
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (log, CONSOLE)
import Data.Argonaut.Core (Json, stringify)
import Data.Argonaut.Generic.Aeson (encodeJson)
import Data.Generic
import Data.Maybe (Maybe(..))
import Prelude (($), Unit)