This file contains 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
#!/usr/bin/env stack | |
-- stack --resolver lts-10.8 --install-ghc exec ghci | |
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE LambdaCase #-} | |
-- A key type for pretend use in looking up a doggo in a database. | |
newtype Key a = Key { unKey :: String } |
This file contains 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
package stupid | |
import ( | |
"fmt" | |
"reflect" | |
"unsafe" | |
) | |
type iptr struct { |
This file contains 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
HTTP/1.1 200 OK | |
Server: Turtle | |
Content-Type: application/turtles; charset=turtles | |
{ | |
"turtles": { | |
"turtles": { | |
"turtles": { | |
"turtles": { | |
"turtles": { | |
"turtles": { |
This file contains 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
object A1 { lazy val X = B1.Y } | |
object B1 { lazy val Y: Int = A1.X } | |
println("Executes safely unless you try and evaluate A1.X or B1.Y because they have no definition.") | |
object ABase { val X = 1 } | |
object A2 { lazy val X = B2.Y+1 } | |
object B2 { lazy val Y :Int = ABase.X*2 } | |
println("Even this could cause problems, but lazy helps. A2.X = " + A2.X.toString) |
This file contains 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
(defn get-route [route-map req] | |
(loop [routes (keys route-map)] | |
(let [route (first routes)] | |
(if (route-matches route req) | |
(get route-map route) | |
(recur (rest routes)))))) | |
; This is one way | |
(defn get-route [route-map req] | |
(when-let [[route fun] (first (filter #(route-matches (first %) req) route-map))] |
This file contains 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
<html> | |
<head> | |
<title>Welcome to Oatmeal Homeland!</title> | |
<meta name="description" content=""> | |
<meta name="keywords" content="Private server, WoW, World of Warcraft"> | |
<STYLE> | |
:link {color: #666633; font-weight: normal;} |