Skip to content

Instantly share code, notes, and snippets.

View crappygraphix's full-sized avatar
📦
💩

Chris Johnston crappygraphix

📦
💩
View GitHub Profile
@crappygraphix
crappygraphix / RoomThemer.cs
Last active May 21, 2021 22:46
Volume Based Randomized Themer
using UnityEngine;
using System.Collections.Generic;
using DungeonArchitect;
using DungeonArchitect.Graphs;
using DungeonArchitect.Utils;
using DungeonArchitect.Flow.Domains.Tilemap;
using DungeonArchitect.Builders.GridFlow;
/// <summary>
/// Spawns various theme override volumes around rooms and corridors.
@crappygraphix
crappygraphix / Main.hs
Created October 22, 2019 16:06
Fun with dynamics
example
:: MonadWidget t m
=> Dynamic t Thing
-> m (Dynamic t ValidThing)
example dyThing =
return $ runMaybeT $ do -- the Dynamic monad
name <- lift (thing_name <$> dyThing)
-- Name must be non-empty
guard $ name /= ""
@crappygraphix
crappygraphix / Main.hs
Created September 6, 2019 19:56
SVG Widget Snippet
linkedinWidget :: MonadWidget t m => m ()
linkedinWidget =
elSvgNS "svg" svg $
elSvgNS "path" p blank
where
elSvgNS t attr guts = do
(_, a) <- elDynAttrNS' (Just "http://www.w3.org/2000/svg") t (constDyn attr) guts
return a
svg = "class" =: "svg" <> "viewBox" =: "0 0 32 32"
@crappygraphix
crappygraphix / Main.hs
Created June 27, 2019 00:09
Call Materialize AutoInit when the dom changes. WIP lots of room for improvement.
{-# LANGUAGE CPP #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Control.Monad ( void )
import Control.Monad.IO.Class ( liftIO )
import Data.Map as Map
import Data.Text as T
@crappygraphix
crappygraphix / Main.hs
Last active June 26, 2019 21:58
Example of do some stuff before link redirect
{-# LANGUAGE CPP #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Control.Monad ( void )
import Control.Monad.IO.Class ( liftIO )
import Data.Map as Map
import Data.Text as T
@crappygraphix
crappygraphix / Main.hs
Created June 26, 2019 18:37
Example of sequential javascript loading so dependent raw actions don't shit the bed.
{-# LANGUAGE CPP #-}
{-# LANGUAGE RankNTypes #-}
module Main where
import Control.Monad ( void )
import Control.Monad.IO.Class ( liftIO )
import Data.Map as Map
import Data.Text
import Language.Javascript.JSaddle
@crappygraphix
crappygraphix / Main.hs
Created June 14, 2019 20:27
Load 3rd party javascript dependencies in order with Reflex-Dom.
module Main where
import qualified Data.Map as Map
import Data.Text
import Reflex.Dom
main :: IO ()
main = mainWidgetWithHead header body
header :: MonadWidget t m => m ()
@crappygraphix
crappygraphix / cookie_policy.txt
Created May 30, 2019 18:10
Generic Cookie Policy: With analytics or ads.
@crappygraphix
crappygraphix / cookie_policy.txt
Last active May 30, 2019 17:38
Generic Cookie Policy: No analytics or ads.
@crappygraphix
crappygraphix / Frontend.hs
Created April 24, 2019 17:56
Example of Obelisk with WebSockets
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecursiveDo #-}
{-# LANGUAGE TypeFamilies #-}
module Frontend where
import Control.Monad (join)
import Obelisk.Frontend
import Obelisk.Route