Skip to content

Instantly share code, notes, and snippets.

@larroy
larroy / go.scala
Last active August 29, 2015 14:05 — forked from joa/go.scala
package go
import java.util.concurrent.{ArrayBlockingQueue => JArrayBlockingQueue, BlockingQueue => JBlockingQueue, TimeUnit}
object Channel {
def empty[A]: Channel[A] = new BlockingChannel()
def make[A]: Channel[A] = make(1)
def make[A](capacity: Int): Channel[A] = new BlockingChannel(capacity)
anonymous
anonymous / scala.breakpoint.scala
Created November 28, 2013 15:39
inspired by Pythons: >> import pdb;pdb.set_trace() I hacked something similar to have breakpoints in Scala 2.9 && 2.10 by typing: import break._;break[someClass]("MainObject" -> MainObject)
import scala.tools.nsc.interpreter._
import scala.tools.nsc.Settings
//USAGE EXAMPLE: import break._;break[someClass]("MainObject" -> MainObject)
object break{
def echo(x: Any) = Console.println(x)
def break[T: Manifest](args: NamedParam*) = {
import util.parsing.json.JSON
import io.Source
import scala.language.dynamics
object Example extends App{
val json = """{
"name" : "Adam Slodowy",
"active": "true",
"roles" : [ "teacher", "admin" ],
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: