Skip to content

Instantly share code, notes, and snippets.

View friedbrice's full-sized avatar
🔵
You have unread notifications

Daniel P. Brice friedbrice

🔵
You have unread notifications
View GitHub Profile
@friedbrice
friedbrice / main.hs
Created July 18, 2022 17:40 — forked from itsuart/main.hs
Hello world Yesod example.
{-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses, TemplateHaskell, OverloadedStrings #-}
import Yesod
import Yesod.Core.Handler
data HelloWorld = HelloWorld
mkYesod "HelloWorld" [parseRoutes|
/ HomeR GET
|]
@friedbrice
friedbrice / iterm_open_with
Created June 26, 2021 01:19 — forked from trinitronx/iterm_open_with
Semantic history command for iTerm2 and Sublime Text 3. Allows iTerm integration of Command+Click to open a file in default app (if non-text), or Sublime Text with optional line number and column. Detects relative paths based on PWD.
#!/bin/sh
# iterm_open_with - open a URL, file from CWD, full path, or path with linenumber in default app or Sublime Text if text file
# For usage with iTerm2:
# In iTerm's Preferences > Profiles > Default > Advanced > Semantic History,
# choose "Run command..." and enter "/your/path/to/iterm_open_with \5 \1 \2".
# Usage: iterm_open_with $(pwd) filename [linenumber]
# $(pwd) = current working directory (either use `pwd` or $PWD)
# filename = filename to open
# lineno = line number
pwd=$1
type Address = {
street: string
zipCode: string
}
type Contact = {
name: string
phoneNumber: string
email: string
}
@friedbrice
friedbrice / Extend.java
Last active June 4, 2019 17:13 — forked from fiddlerwoaroof/extend.js
Static typable EP solution
import java.util.Map;
// This is almost a solution to the expression problem, except for
// lines 47 and 74.
// Instead of raising an exception, we want the program to fail to
// compile if there are cases that we haven't considered.
class Extend {
// I can define a data structure by cases.
-- | Can pattern match on nonempty lists
--
-- @
-- import Custom.NonEmpty (head, pattern NEL)
-- let arr = [1,2,3]
-- case arr of
-- NEL ne -> head ne
-- [] -> 42
-- @
--