This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.Method | |
class Sendable(a: AnyRef) { | |
val methods = a.getClass.getDeclaredMethods | |
def wrapByte(b: Byte) = new java.lang.Byte(b) | |
def wrapShort(s: Short) = new java.lang.Short(s) | |
def wrapInt(i: Int) = new java.lang.Integer(i) | |
def wrapLong(l: Long) = new java.lang.Long(l) | |
def wrapFloat(f: Float) = new java.lang.Float(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MnemonicsCoder(words: List[String]) { | |
private val mnemonics = Map('2' -> "ABC", '3' -> "DEF", '4' -> "GHI", '5' -> "JKL", | |
'6' -> "MNO", '7' -> "PQRS", '8' -> "TUV", '9' -> "WXYZ") | |
/** Invert the mnemonics map to give a map from chars 'A' ... 'Z' to '2' ... '9' */ | |
private val charCode: Map[Char, Char] = | |
for ((digit, str) <- mnemonics; letter <- str) yield (letter -> digit) | |
/** Maps a word to the digit string it can represent */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see https://github.com/gseitz/Lensed | |
object Lensed { | |
import scalaz._ | |
import Scalaz._ | |
case class Address(street: String) | |
case class Person(name: String, address: Address) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sbt._ | |
import Keys._ | |
// source of the actual shell modification take from Daniel C. Sobral's gist: | |
// https://gist.github.com/996474 | |
// prompt looks like: | |
// $PROJECTNAME:$GITBRANCH> | |
object ShellPrompt extends Plugin { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import XMonad | |
import XMonad.Config.Gnome | |
main :: IO () | |
main = xmonad $ gnomeConfig { modMask = mod4Mask } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package scala.tools.nsc | |
package backend.jribble | |
import scala.collection.mutable | |
import scala.tools.nsc.transform.{Transform, TypingTransformers} | |
/** | |
* Implements 'factorymanifests' compiler phase that provides alternative implementation of | |
* Manifests that use static factories for Array creation. | |
* | |
* Canonical Manifest implementation in Scala uses reflection for generic Array creation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar *default-font-size* 13) | |
(defvar *default-font-name* "Menlo") | |
(defun increase-default-font-size () | |
"Increase font size" | |
(interactive) | |
(incf *default-font-size*)) | |
(defun decrease-default-font-size () | |
"Decrease default font size" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.Actor | |
import com.yammer.metrics.Instrumented | |
// Useful for monitoring the mailbox size of actors. | |
// Just fire up your favorite JMX client and watch the pretty graph (which hopefully is a flatline at 0). | |
trait ActorMetrics extends Instrumented { actor: Actor => | |
metrics.gauge("mailbox size", self.id){actor.self.dispatcher.mailboxSize(actor.self)} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net._ | |
import java.util.UUID | |
import com.twitter.conversions.time._ | |
import com.twitter.finagle.builder.ClientBuilder | |
import com.twitter.util._ | |
import java.nio.charset.Charset | |
import org.jboss.netty.buffer.{ChannelBuffers, ChannelBuffer} | |
import org.jboss.netty.handler.codec.http._ | |
import com.twitter.finagle.stream.Stream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sbt._ | |
import Keys._ | |
import java.util.jar.Attributes.Name._ | |
import sbt.Defaults._ | |
import sbt.Package.ManifestAttributes | |
import sbt.Fork.ForkJava | |
object Bundle extends Plugin { |
OlderNewer