This file contains hidden or 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
| #!/usr/bin/env python | |
| from subprocess import call | |
| import os | |
| servers = [ | |
| { | |
| 'host': 'some.remote.host', # host to connect to | |
| 'dir' : '/usr/local/supersecret/' # remote dir to mount | |
| }, | |
| { |
This file contains hidden or 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 | |
| object Greeter { | |
| case object Greet | |
| } | |
| class Greeter extends Actor { | |
| def receive = { | |
| case Greeter.Greet => { | |
| println("Hello, World") | |
| } |
This file contains hidden or 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 main | |
| import ( | |
| "flag" | |
| "log" | |
| "net/http" | |
| "net/url" | |
| ) | |
| var ( |
This file contains hidden or 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
| <?php | |
| class Node { | |
| public $key; | |
| public $next; | |
| public function __construct($key, $next=null) { | |
| $this->key = $key; | |
| $this->next = $next; | |
| } | |
| } |
This file contains hidden or 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
| val s1 = {"hello"} // s1: String = hello | |
| val s = "hello" // s: String = hello |
This file contains hidden or 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
| def timing[A](x: => A): Int = { | |
| import com.github.nscala_time.time.Imports._ | |
| import org.joda.time.PeriodType | |
| val then = LocalDateTime.now | |
| x | |
| new Period(then, LocalDateTime.now, PeriodType.millis).getValue(0) | |
| } |
This file contains hidden or 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
| Object Util { | |
| def dangerousString(str: String) : Future[String] = { | |
| liveDangerously() | |
| Future.successful(str) | |
| } | |
| // now becomes | |
| def dangerousString(str: String) : Future[String] = { |
This file contains hidden or 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
| struct Node<T> { | |
| value: T, | |
| next: Option<~Node<T>> | |
| } | |
| struct LinkedList<T> { | |
| head: ~Node<T>, | |
| tail: ~Node<T> | |
| } |
This file contains hidden or 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
| language: scala | |
| scala: | |
| - 2.10.3 | |
| script: | |
| - sbt compile test:compile | |
| - sbt scalastyle | |
| - sbt test | |
| jdk: | |
| - oraclejdk7 | |
| - openjdk7 |
This file contains hidden or 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
| def set = Command(SetCommand, setBrief, setDetailed)(setParser) { | |
| case (s, (all, arg)) => | |
| val extracted = Project extract s | |
| import extracted._ | |
| val dslVals = extracted.currentUnit.unit.definitions.dslDefinitions | |
| // TODO - This is possibly inefficient (or stupid). We should try to only attach the | |
| // classloader + imports NEEDED to compile the set command, rather than | |
| // just ALL of them. | |
| val ims = (imports(extracted) ++ dslVals.imports.map(i => (i, -1))) | |
| val cl = dslVals.classloader(currentLoader) |