Skip to content

Instantly share code, notes, and snippets.

View xevix's full-sized avatar

Alejandro Wainzinger xevix

View GitHub Profile

Explaining Miles's Magic

Miles Sabin recently opened a pull request fixing the infamous SI-2712. First off, this is remarkable and, if merged, will make everyone's life enormously easier. This is a bug that a lot of people hit often without even realizing it, and they just assume that either they did something wrong or the compiler is broken in some weird way. It is especially common for users of scalaz or cats.

But that's not what I wanted to write about. What I want to write about is the exact semantics of Miles's fix, because it does impose some very specific assumptions about the way that type constructors work, and understanding those assumptions is the key to getting the most of it his fix.

For starters, here is the sort of thing that SI-2712 affects:

def foo[F[_], A](fa: F[A]): String = fa.toString
@dannguyen
dannguyen / instructions-for-subtitles.md
Last active June 9, 2016 18:47
Reading subtitles

Given a MP4 file...

Use MP4Box to extract into VOB/SUB format

First, find the info: /Volumes/GPAC\ for\ OSX/Osmo4.app/Contents/MacOS/MP4Box -info ~/Desktop/MOVIEFILE.m4v

  * Movie Info *
    Timescale 90000 - Duration 00:22:36.981

4 track(s)

@dragisak
dragisak / DateTimeMapper.scala
Created February 11, 2013 18:17
Joda DateTime mapper in Slick
import slick.lifted.MappedTypeMapper
import java.sql.Date
import org.joda.time.DateTime
import slick.lifted.TypeMapper.DateTypeMapper
object DateTimeMapper {
implicit def date2dateTime = MappedTypeMapper.base[DateTime, Date] (
dateTime => new Date(dateTime.getMillis),
date => new DateTime(date)