Skip to content

Instantly share code, notes, and snippets.

@jasonzoladz
jasonzoladz / Example.hs
Created July 14, 2022 20:40 — forked from jkachmar/Example.hs
UUID as Primary Key in Persistent
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Example where
@jasonzoladz
jasonzoladz / string-conversions.hs
Created July 9, 2022 04:47 — forked from dino-/string-conversions.hs
A handy illustration of converting between String, Text and ByteString in Haskell
#! /usr/bin/env stack
-- stack --resolver lts-18.8 script
{-# LANGUAGE OverloadedStrings #-}
{-
This is a handy illustration of converting between five of the commonly-used
string types in Haskell (String, ByteString, lazy ByteString, Text and lazy
Text).
@jasonzoladz
jasonzoladz / Main.purs
Created May 18, 2017 22:47
Look Ma, no callbacks! (Using PureScript's Aff Monad with NodeJS.)
module Main where
import Prelude
import Control.Monad.Aff (attempt, forkAff, launchAff)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Class (liftEff)
import Control.Monad.Eff.Console (CONSOLE, log)
import Control.Monad.Eff.Exception (EXCEPTION)
import Data.Either (Either(..))
import Node.Encoding (Encoding(..))
@jasonzoladz
jasonzoladz / rxjs_for_unidirectional_data_flow.js
Last active January 31, 2018 16:46
Using Flow with RxJS for Unidirectional Data Using Props
// @flow
// USING PROPS
import Rx, { BehaviorSubject, Observable } from 'rxjs';
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
type AppState = {
@jasonzoladz
jasonzoladz / Main.purs
Last active March 14, 2016 19:48
SPA routing and token acquistition with purescript-react, purescript-routing, and purescript-rx-state
module Main where
import Prelude
import Control.Monad.Eff.Console (log, CONSOLE)
import Control.Monad.Eff
import Control.Monad.Eff.Class
import Control.Monad.Aff
import Control.Monad.Eff.Exception
import Data.Maybe
@jasonzoladz
jasonzoladz / page-transitions.cljs
Last active October 19, 2023 15:33
Animating Page Transitions with Reagent and Re-frame
;; style.css -- basic (lame) transitions, for demonstration
;;________________________________________________________________
.pageChange-enter {
opacity: 0.01;
}
.pageChange-enter.pageChange-enter-active {
opacity: 1;
transition: opacity 500ms ease-in;
@jasonzoladz
jasonzoladz / project.clj
Last active March 4, 2016 16:58
Setup ClojureScript Figwheel for Use With Haskell Server
(defproject udemy "0.1.0"
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/clojurescript "1.7.228"]
[reagent "0.5.1"
:exclusions [org.clojure/tools.reader, cljsjs/react]]
[cljsjs/react-with-addons "0.13.3-0"]
[reagent-forms "0.5.16"]
[reagent-utils "0.1.7"]
[re-frame "0.5.0"]
[org.clojure/core.async "0.2.374"]
@jasonzoladz
jasonzoladz / Main.hs
Created February 4, 2016 19:39
Generate and Decode JWTs in Haskell with jose-jwt
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
module Main where
import qualified Data.Aeson.Encode as A
import Data.ByteString.Lazy (toStrict)
import Data.Either
@jasonzoladz
jasonzoladz / Main.elm
Last active January 22, 2016 15:08
Client-side Routing in Elm Using Parser Combinators
module Main where
import Combine exposing (Parser, string, parse, end, andThen, many1, while, many, skip, Result (..))
import Combine.Char exposing (noneOf, char)
import Combine.Num exposing (int)
import Combine.Infix exposing ((<$>), (<$), (<*), (*>), (<*>), (<|>))
import Maybe exposing (Maybe)
import History exposing (path, setPath)
import Signal exposing (Signal, (<~), (~), send, message)
import Effects exposing (Effects, task)