I hereby claim:
- I am GabrielJones646 on github.
- I am gabrieljones (https://keybase.io/gabrieljones) on keybase.
- I have a public key whose fingerprint is F496 57C7 D032 F42F B89D E79B 39B0 A58F AEF7 0618
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
import scala.annotation.tailrec | |
case class B(l: Int, h: Int, r: Int) | |
case object B { | |
val buildings = List(B(1, 11, 5), B(2, 6, 7), B(3, 13, 9), B(12, 7, 16), B(14, 3, 25), B(19, 18, 22), B(23, 13, 29), B(24, 4, 28)) | |
} | |
object Skyline extends App { | |
val edges = B.buildings.map(b=>Seq(b.l,b.r)).flatten.toSet.toSeq.sorted |
object ScalaJSExample extends js.JSApp{ | |
def main(): Unit = { | |
val G = """103,2,50,100 | |
|106,1,900,900 | |
|459,40,150,300,67,2 | |
|4,20,30,6000""".stripMargin.lines.toList | |
println(p("Input:")) | |
G.map{x=>println(x)} | |
println(p("Output: 70 bytes")) | |
for{l<-G;r=l.split(",");x=(r++r).slice(4,6).mkString(",")}{println(x)} |
import scala.util.{Failure, Success, Random} | |
import org.scalajs.dom.{Element, DOMParser} | |
import rx._ | |
object Framework { | |
/** | |
* Wraps reactive strings in spans, so they can be referenced/replaced | |
* when the Rx changes. | |
*/ |
/** | |
* Created by Hugo Sereno Ferreira on 15/06/14. | |
*/ | |
import org.scalajs.dom | |
import scala.collection._ | |
import Page.renderer | |
sealed trait Opcode | |
object Mov extends Opcode { override def toString = "MOV" } |
object ScalaJSExample extends js.JSApp { | |
type Coord = Pair[Int, Int] | |
type CoordSet = Set[Coord] | |
def handleString(str: String, identity:Boolean=false): String = { | |
val lines=str.stripMargin.trim.split("\n") | |
val coords: CoordSet = for ( |
// © 2015 Gabriel Jones | |
case class ComplexNumber(r: Double, i: Double){ | |
def +(that: ComplexNumber) = ComplexNumber(r + that.r, i + that.i) | |
def -(that: ComplexNumber) = ComplexNumber(r - that.r, i - that.i) | |
def *(that: ComplexNumber) = ComplexNumber(r*that.r - i*that.i, r*that.i + i*that.r) | |
def mag() = r*r + i*i | |
} | |
object ScalaJSExample extends js.JSApp{ | |
def main(): Unit = { |
/** | |
* Implemented from the algorithm taught in | |
* Burrows-Wheeler Transform (Ep 4, Compressor Head) Google | |
* https://www.youtube.com/watch?v=4WRANhDiSHM | |
*/ | |
object BurrowsWheelerTransform { | |
def transform(s: String): (String, Int) = { | |
val shifted: Iterator[String] = (s + s).tail.sliding(s.length) | |
val sorted: Array[String] = shifted.toArray.sortWith(_<_) |