Skip to content

Instantly share code, notes, and snippets.

View dwijnand's full-sized avatar

Dale Wijnand dwijnand

View GitHub Profile

See context.

To configure this script to automatically execute on file changes, save the XML config in ~/Library/LaunchAgents/dot-files.sync.plist then do:

launchctl load -w ~/Library/LaunchAgents/dot-files.sync.plist

The Cabal/Stack Disambiguation Guide

One of the most frequently asked Haskell beginner questions in recent years is:

"Stack or cabal?"

I will helpfully not answer this question. Instead I will hope to eliminate the confusion that many of the askers seem to have about the various different

@non
non / Wild.scala
Last active April 9, 2020 00:26
Interesting trick to lift existentials into values, so we can later refer to them.
package demo
import cats.{Applicative, Functor, Id, Semigroupal, Traverse}
import cats.arrow.FunctionK
/**
* Type-lifting operation to replace the wildcard type (i.e. _).
*
* In some cases we end up with code like: List[Option[_]]. This is
* fine unless you later need to write code in terms of a particular
@battermann
battermann / SameGame.scala
Last active April 17, 2023 13:47
SameGame
object SameGame {
final case class Position(col: Int, row: Int)
sealed trait Color
case object Green extends Color
case object Blue extends Color
case object Red extends Color
case object Brown extends Color
case object Gray extends Color
@paulp
paulp / gsdv.sh
Created January 24, 2018 02:28
Use google's verbatim search and date range restriction simultaneously
#!/usr/bin/env bash
#
# Use google's date range and "verbatim" simultaneously
# Paul Phillips <psp@brb.fyi>
#
NAME="$(basename "$0")"
read -r -d '' USAGE << EOM
usage: $NAME [-s days] [-e days] [search terms]
@findepi
findepi / sort-commits-for-github.sh
Last active August 6, 2021 20:53
sort commits for GitHub's sake
git rebase "$(git merge-base HEAD master)" -x 'git commit --amend -C HEAD --date="$(date -R)" && sleep 1.05'
@paulp
paulp / build.sbt
Last active October 28, 2017 13:02
/** Your task is to reason your way to which compiler
* options which will be passed for each of
* 1) sbt root/compile
* 2) sbt p1/compile
*/
scalacOptions := Seq("-DSBT")
scalacOptions in ThisBuild += "-D0"
scalacOptions in Global += "-D1"

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@paulp
paulp / demo.sh
Last active June 8, 2018 09:16
Enabling sbt plugins from the command line in any sbt project
% sbtx dependencyGraph
... blah blah ...
[info] *** Welcome to the sbt build definition for Scala! ***
[info] Check README.md for more information.
[error] Not a valid command: dependencyGraph
[error] Not a valid project ID: dependencyGraph
% sbtx -Dplugins=graph dependencyGraph
... blah blah ...
@alexandru
alexandru / task-proposal.md
Last active April 1, 2018 14:57
Task: A diverging design from Future and Scalaz Task