Skip to content

Instantly share code, notes, and snippets.

{
// make the editor font look nice
"editor.fontSize": 18,
"editor.fontFamily": "Monaco, 'Courier New', monospace",
// format on pasting and saving
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
// save files automatically
"files.autoSave": "afterDelay",
// delete trailing whitespace
@lamdor
lamdor / vimrc
Last active August 18, 2021 20:12
" Turn on syntax highlighting
syntax on
" For plugins to load correctly
filetype plugin indent on
let mapleader = " "
" Security: do not trust modelines set in files
set modelines=0
// Package twofer gives a two for one phrase back
package twofer
import "fmt"
// ShareWith returns the two for one statement
func ShareWith(name string) string {
if name == "" {
name = "you"
package hamming
import (
"errors"
)
// Distance calculates the Hamming distance between two strings
func Distance(a, b string) (int, error) {
if len(a) != len(b) {
return 0, errors.New("Not same length")
package hamming
import (
"errors"
)
// Distance calculates the Hamming distance between two strings
func Distance(a, b string) (int, error) {
if len(a) != len(b) {
return 0, errors.New("Not same length")
@lamdor
lamdor / build.sbt
Last active May 26, 2021 21:27
Playing around with tagless final style and Eff (from https://github.com/edmundnoble/final-tagless-typelevel-summit)
scalaVersion := "2.11.8"
scalaOrganization := "org.typelevel"
libraryDependencies ++= Seq(
"org.typelevel" %% "cats" % "0.9.0",
"org.atnos" %% "eff" % "4.0.0"
)
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.3")
package eg.repository.interpreter
import cats.{ MonadError, MonadState }
import java.time.LocalDate
import scala.collection.mutable.{Map => MMap}
import cats.Eval
import cats.arrow.FunctionK
import cats.data.StateT
package learn
import java.io.File
import cats.{~>, Id}
import cats.free.Free
import cats.data.Xor
import cats.instances.option._
import freek._
import scala.concurrent.Future
(setenv "SBT_OPTS"
"-XX:+CMSClassUnloadingEnabled -Xmx2g -Djava.library.path=/usr/local/lib -Djava.awt.headless=true -Dfile.encoding=utf8 -Duser.timezone=UTC")
(defun mine-set-sbt-keys-if-possible ()
(if (sbt:find-root)
(mine-set-sbt-keys)))
(defun mine-set-sbt-keys ()
(local-set-key (kbd "C-c s s") 'mine-sbt-switch)
(local-set-key (kbd "C-c s c") 'mine-sbt-compile)