Skip to content

Instantly share code, notes, and snippets.

@lazyvalue
lazyvalue / Tokens.scala
Last active February 20, 2023 14:14
Typeclasses in Scala3
// A quick tutorial on typeclasses in Scala 3.
// We declare a typeclass for universal IDs, called tokens, for domain objects
// in our system, like users, transaction records, shopping cart items,
// text messages, whatever.
// The typeclass gives us some type safety, some handy methods (well, one so far),
// and the set of tokens are open-ended (you can add more domain objects time).
// You know the drill ...
import java.util.UUID
@lazyvalue
lazyvalue / init.el
Created August 19, 2020 22:03
Scott's Emacs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Package stuff
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'package)
(setq package-archives '(("org" . "http://orgmode.org/elpa/")
("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")))
(package-initialize)
@lazyvalue
lazyvalue / keybase.md
Created November 5, 2018 19:45
keybase.md

Keybase proof

I hereby claim:

  • I am lazyvalue on github.
  • I am lazyvalue (https://keybase.io/lazyvalue) on keybase.
  • I have a public key whose fingerprint is 456B 8F8D E399 E4DA AD71 49D6 04AC EB53 DBD4 BBB3

To claim this, I am signing this object:

form for PortalCrane:
capabilities <- [
form for Capability:
type <- "OUTBOUND_MESSAGING"
remoteInterface <- form for RestRemoteInterface:
httpMethod <- "POST"
urlTemplate <- "https://graph.facebook.com/v2.6/me/messages?access_token={{credentials.pageAccessToken}}"
headers <- [ httpHeader "Content-Type" "application/json", httpHeader "X-Twilio" "true" ]
requestProductions <- [
" http://yannesposito.com/Scratch/en/blog/Vim-as-IDE/
call plug#begin('~/.vim/plugged')
Plug 'altercation/vim-colors-solarized'
Plug 'bronson/vim-trailing-whitespace'
Plug 'Shougo/vimproc.vim'
Plug 'Shougo/unite.vim'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
@lazyvalue
lazyvalue / gist:833b40ba538d4f0773b2
Created July 13, 2015 23:33
scala state and io stuff
package ground
// Why pure IO?
// Trampoline
// IO values and interpreters
object UnitIsNotUnit {
// Side effects are extremely hard to reason about.
// The only way you can tell when they are executed is by following imperative code
@lazyvalue
lazyvalue / gist:906c981e0ac3df470981
Created July 10, 2015 01:12
argonaut json support for akka-http
import akka.http.scaladsl.marshalling.{ ToEntityMarshaller, Marshaller }
import akka.http.scaladsl.model.{ContentTypes, HttpCharsets}
import akka.http.scaladsl.unmarshalling.{ FromEntityUnmarshaller, Unmarshaller }
import akka.stream.FlowMaterializer
import akka.http.scaladsl.model.MediaTypes.`application/json`
import argonaut.{Parse, DecodeJson, EncodeJson, Json}
object ArgonautJsonSupport {
implicit def argonautJsonUnmarshallerConverter[T](decode: DecodeJson[T])(implicit mat: FlowMaterializer): FromEntityUnmarshaller[T] =
@lazyvalue
lazyvalue / gist:1d049cb3557469883286
Created May 27, 2015 23:13
Presentation on Scala Functional IO/Trampolines
package ground
// Why pure IO?
// Trampoline
// IO values and interpreters
object UnitIsNotUnit {
// Side effects are extremely hard to reason about.
// The only way you can tell when they are executed is by following imperative code
package ground
// Show that println and Unit are not the same.
// Why pure IO?
// Trampoline
// IO values and interpreters
object UnitIsNotUnit {
// Side effects are extremely hard to reason about.
@lazyvalue
lazyvalue / gist:8831270f8b3377e59f49
Created March 11, 2015 20:22
Module examples worksheet
// Case classes
// Algebraic Data Types
// Objects
// Currying
// Traits
// Classes
// The Cake
// CASE CLASSES