This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
Array("Good luck in the Facebook Hacker Cup this year!", | |
"Ignore punctuation, please :)", | |
"Sometimes test cases are hard to make up.", | |
"So I just go consult Professor Dalves") | |
.filter(_.length > 0) | |
.map(x => x.toLowerCase()) | |
.map(x => "[^a-z]*".r replaceAllIn(x, "")) | |
.map(x => x.map(y => (x.count(_ == y), y)).sortWith(_._1 > _._1).distinct.map(_._1).toArray) | |
.map(process(_)) | |
.map(_.map(x => x._1 * x._2)) |
def main(args:Array[String]) { | |
//val source = scala.io.Source.fromFile(args(0)) | |
val matrix = (new Array[Int](256), new Array[Int](256)) | |
Array("SetCol 32 20", | |
"SetRow 15 7", | |
"SetRow 16 31", | |
"QueryCol 32", | |
"SetCol 2 14", | |
"QueryRow 10", |
object Main { | |
def main(args:Array[String]) { | |
//val source = scala.io.Source.fromFile(args(0)) | |
val matrix = List.fill[Int](256, 256)(0) | |
Array("SetCol 32 20", | |
"SetRow 15 7", | |
"SetRow 16 31", | |
"QueryCol 32", |
/** | |
* Created by IntelliJ IDEA. | |
* User: UberMouse | |
* Date: 10/26/11 | |
* Time: 12:50 PM | |
*/ | |
object fizzbuzz { | |
def main(args: Array[String]) { | |
val source = scala.io.Source.fromFile(args(0)) | |
val lines = source.getLines().filter(_.length > 0) |
object Main extends App { | |
val source = scala.io.Source.fromFile(args(0)) | |
source.getLines | |
.filter(_.length > 0) | |
.map(_.split(" ").map(_.toInt)) | |
.map(x => fizz(x(0), x(1), x(2))) | |
.foreach(println) | |
def fizz(a:Int, b:Int, n:Int) = { | |
def buzz(check:Int, fizz:Int, buzz:Int) = { |
package nz.ubermouse.minecraft.classicserver.packets | |
import nz.ubermouse.minecraft.classicserver.{Client, Server} | |
import java.nio.ByteBuffer | |
import java.io.PrintStream | |
import nz.ubermouse.minecraft.classicserver.utils.Logger | |
/** | |
* Created with IntelliJ IDEA. | |
* User: UberMouse |
object Main { | |
def main(args:Array[String]) { | |
val re = "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?".r | |
val source = scala.io.Source.fromFile(args(0)) | |
source.getLines | |
.filter(x => x.length > 0) | |
.map(x => re.findFirstIn(x) != None) | |
.foreach(println) | |
} |
Array("Good luck in the Facebook Hacker Cup this year!", | |
"Ignore punctuation, please :)", | |
"Sometimes test cases are hard to make up.", | |
"So I just go consult Professor Dalves") | |
.filter(_.length > 0) | |
.map(process) | |
.foreach(println) | |
def process(line:String) = { | |
val cleanedLine = "[^a-z]*".r.replaceAllIn(line.toLowerCase, "") |
public class Option<T> | |
{ | |
public readonly T Value; | |
public bool HasValue | |
{ | |
get {return Value != null;} | |
private set {} | |
} | |