Skip to content

Instantly share code, notes, and snippets.

View mosesn's full-sized avatar

Moses Nakamura mosesn

View GitHub Profile
@mosesn
mosesn / does not properly implement equals.scala
Last active August 29, 2015 14:01
fooling around with sbt settings
import sbt._
import Keys._
object Blah extends Build {
val mySettings = Project.defaultSettings ++ Seq[Setting[_]](
crossScalaVersions := Seq("2.9.2", "2.10.4")
)
val moreSettings: Seq[Setting[_]] = (mySettings filter { setting: Setting[_] =>
setting != (crossScalaVersions := Seq("2.9.2", "2.10.4"))
@mosesn
mosesn / gist:d6235cba5f8387b6d7cc
Created April 30, 2014 21:10
Adding Filters jankily to the current scrooge interface
trait Iface {
def abyssTweet(tweet: Tweet): Future[Unit]
}
val instance: Iface
val abyssSvc: Service[Tweet, Unit] = Service.mk { tweet: Tweet => instance.abyssTweet(tweet) }
val timeoutFilter: TimeoutFilter[Tweet, Unit]
val retryingFilter: RetryingFilter[Tweet, Unit]
val filteredSvc: Service[Tweet, Unit] = retryingFilter andThen timeoutFilter andThen abyssSvc
@mosesn
mosesn / typing.scala
Last active August 29, 2015 13:56
more experiments in doing weird type parameterization stuff
class Mult[A, B](val l: A, val r: B) {
def commute: Mult[B, A] = new Mult[B, A](r, l)
def associate[C, D](implicit ev: B <:< Mult[C, D]): Mult[Mult[A, C], D] =
new Mult[Mult[A, C], D](new Mult(l, r.l), r.r)
def left[C](fn: A => C): Mult[C, B] = new Mult(fn(l), r)
def right[C](fn: B => C): Mult[A, C] = new Mult(l, fn(r))
}
class Div[A, B](val l: A, val r: B) {
import scala.language.implicitConversions
class Mult[A, B] {
def commute: Mult[B, A] = new Mult[B, A]
def associate[C, D](implicit ev: B =:= Mult[C, D]): Mult[Mult[A, C], D] = new Mult[Mult[A, C], D]
}
object Simplify {
implicit def commute[A, B, M <% Mult[A, B]](m: M): Mult[B, A] = m.commute
implicit def associate[A, B, C, M <% Mult[A, Mult[B, C]]](m: M): Mult[Mult[A, B], C] = m.associate
@mosesn
mosesn / rvm issue
Created November 26, 2012 18:47
rvm --debug install ruby-1.9.2-p290 on OSX mountain lion, MBP
ruby-1.9.2-p290 - install
Remote file does not exist http://jruby.org.s3.amazonaws.com/downloads/ruby-1.9.2-p290.tar.bz2
Remote file does not exist https://rvm.io/binaries/osx/10.8/x86_64/ruby-1.9.2-p290.tar.bz2
rvm_remote_server_url2 not found
No remote file name found
No binary rubies available for: downloads/ruby-1.9.2-p290.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Libyaml already installed
__rvm_update_configure_env(1):CFLAGS=-I/Users/moses/.rvm/usr/include:
__rvm_update_configure_env(1):LDFLAGS=-L/Users/moses/.rvm/usr/lib:
@mosesn
mosesn / about.md
Created August 13, 2011 07:16 — forked from haldean/about.md
Programming Achievements: How to Level Up as a Developer