Skip to content

Instantly share code, notes, and snippets.

type ∀[F[_]] = scalaz.Forall[F]
/**
* An unpublished arbitrary type. May be viewed as a formulation of
* (∃ α . α). Thus, we encode a rank-1 universal by means of a rank-2
* existential. This encoding is more convenient for our purposes.
*/
sealed trait τ
object τ {
sealed trait Caster[A, B]
case object CastTo extends Caster[Unit, Unit]
case class Ignored[A, B]() extends Caster[A, B]
def cast[A, B]: A =:= B =
(Ignored(): Caster[A, B]) match {
case CastTo | _ => implicitly[B =:= Unit]
}
cast[String, Int]: String =:= Int
@tadiou
tadiou / cockatrice_install_ubuntu15.txt
Created September 10, 2015 16:23
Installing Cockatrice on Ubuntu 15
Dependencies
sudo add-apt-repository ppa:ubuntu-sdk-team/ppa && sudo apt-get update
build-essential g++ qtmobility-dev libprotobuf-dev protobuf-compiler libqt4-dev
qt5-default
libqt5-dev
qt5-qtbase qt5-qtsvg qt5-qttranslations
qttools5-dev*
qtmultimedia5-dev
libqt5svg5*
@tamitutor
tamitutor / osx-mongodb-rlimits-fix.md
Last active August 21, 2024 17:50
Fix Mongodb "soft rlimits" Warning On Mac OS X (Yosemite)

If you are seeing Mongo soft rlimits warnings in your logs, or a WARNING: soft rlimits too low. Number of files is 256, should be at least 1000 when you login to mongo shell via mongo from the commandline, or any mysterious/unexplained mongo connection errors... follow this how-to exactly and it will resolve the issue for you.

(Source of this how to found at basho/basho_docs#1402)

First file: sudo vi /Library/LaunchDaemons/limit.maxfiles.plist

...containing:

Configuring SBT to use 1Password

  1. Install swig-python
  2. Use pip to install 1pass
  3. Install py-levenshtein to avoid annoying warnings
  4. Locate the nearest 1pass script (note: it may be behind you)
  5. Test 1pass on a random password

Create ~/.sbt/0.13/plugins/build.sbt with the following contents:

@kconragan
kconragan / keyrepeat.shell
Last active December 4, 2023 03:40
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@raichoo
raichoo / gist:2345414
Created April 9, 2012 18:50
Monads vs. implicit values in Scala
case class Config(host: String, port: Int) {
def prettyPrint(prefix: String, msg: String): String =
List(prefix, ": ", msg, " on ", host, ":", port.toString).mkString
}
/**
* Passing a configuration with implicits is like
* working in the state monad. You can "put" a
* new configuration even though we don't want that
* to happen in this particular example. We don't