Skip to content

Instantly share code, notes, and snippets.

View MasseGuillaume's full-sized avatar

Guillaume Massé (马赛卫) MasseGuillaume

  • narrative.io
  • Montréal, Québec, Canada
  • 18:33 (UTC -04:00)
View GitHub Profile
nix-env -i pngquant
nix-env -i protobuf
nix-env -i optipng
nix-env -i yarn
set this in build.sbt:
PB.runProtoc := { args => Process("protoc", args).! },
pushd metadoc-js/target/scala-2.12/scalajs-bundler/main/node_modules/pngquant-bin/vendor/
rm pngquant
@MasseGuillaume
MasseGuillaume / Xmonad.hs
Created March 13, 2017 16:09
xmonad dvorak/querty
import XMonad
import qualified XMonad as XMonad
import XMonad.Hooks.SetWMName
import qualified XMonad.StackSet as W
import qualified Data.Map as Map
import System.Exit
dvorak conf@(XConfig {XMonad.modMask = modm}) = Map.fromList $
keyBase conf ++
[
// rec and pat mat
last(List(1, 2, 3)) == 3
def last(xs: List[Int]): Int = {
xs match {
case h :: Nil => h // List(1)
case h :: t => last(t) // List(1, ...)
case Nil => throw new NoSuchElementException
}
}
[info] Loading project definition from /home/gui/dotty-example-project/project
[info] Set current project to dotty-example-project (in build file:/home/gui/dotty-example-project/)
[info] Compiling 1 Scala source to /home/gui/dotty-example-project/target/scala-2.11/classes...
[info] 'dotty-bridge' not yet compiled for Scala 0.1-SNAPSHOT. Compiling...
exception while transforming xsbt.DelegatingReporter of class class dotty.tools.dotc.ast.Trees$Ident # 486
exception while transforming xsbt.DelegatingReporter.apply of class class dotty.tools.dotc.ast.Trees$Select # 8498
exception while transforming xsbt.DelegatingReporter.apply(delegate) of class class dotty.tools.dotc.ast.Trees$Apply # 8499
exception while transforming new dotty.tools.dotc.core.Contexts.ContextBase().initialCtx().fresh().setSbtCallback(callback).setReporter(
xsbt.DelegatingReporter.apply(delegate)
) of class class dotty.tools.dotc.ast.Trees$Apply # 8500
@MasseGuillaume
MasseGuillaume / dotty
Last active September 20, 2016 19:53
[info] Loading global plugins from /home/gui/.sbt/0.13/plugins
[info] Loading project definition from /home/gui/sbt-dotty/example/project
[info] Updating example-build
[info] Resolved example-build dependencies
[info] Fetching artifacts of example-build
[info] Fetched artifacts of example-build
[info] Set current project to testplugin (in build file:/home/gui/sbt-dotty/example/)
[debug] > compile
[debug] Evaluating tasks: compile:compile
[debug] Running task... Cancel: Null, check cycles: false, forcegc: true
@MasseGuillaume
MasseGuillaume / ProcessBuilder.md
Last active April 29, 2017 21:03
scala.sys.process.ProcessBuilder

ProcessBuilder

Signature Proposed Name Scaladoc
!(log: ProcessLogger): Int exitValue Starts the process represented by this builder, blocks until it exits, and returns the exit code.
!: Int exitValue Ibid.
!<(log: ProcessLogger): Int exitValueStdIn Ibid.
@MasseGuillaume
MasseGuillaume / gooooooogle.scala
Created June 9, 2016 03:20
gooooooogle.scala
case class Paginator(previous: Option[Int], selections: List[Int], current: Int, next: Option[Int])
def pagination(current: Int, total: Int, window: Int = 10): Paginator = {
val prev =
if(current == 1) None
else Some(current -1)
val next =
if(current == total) None
else Some(current + 1)
import com.scalakata._
import ch.epfl.scala.index._
import data._
import bintray._
import cleanup._
import scala.util.Success
import com.scalakata._
trait B
@instrument class Playground extends B {
1
}
exception: scala.MatchError: List(class Playground extends B {
def <init>() = {
super.<init>();
()
class ApplicativeSection extends Section("applicative") {
import cats._
import cats.std.all._
md"""
`Applicative` extends `Apply` by adding a single method, `pure`:
```