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
#!/usr/bin/env ruby | |
require 'socket' | |
class SimpleIrcBot | |
def initialize(server, port, channel) | |
@channel = channel | |
@socket = TCPSocket.open(server, port) | |
say "NICK BytterBot" |
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 collection.immutable.{TreeMap, SortedMap} | |
import collection.SortedMapLike | |
import org.specs2.mutable._ | |
import org.specs2.ScalaCheck | |
import scalaz._ | |
import Scalaz._ | |
object Timeline { | |
def apply[A, B](l: Traversable[(B, A)])(implicit m: Manifest[B]) = m.toString match { | |
case "Int" => new Timeline(l.map(x => x._1.asInstanceOf[Int].toLong -> x._2).toMap) |
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._ | |
import akka.pattern.ask | |
import akka.util.Timeout | |
import akka.util.duration._ | |
final case class Ping(msg: String) | |
final case class Pong(msg: String) | |
class Ponger extends Actor { | |
def receive = { |
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
(T1) = It is not true that if it always has been the case that a Gambozino-like being exists then a Gambozino-like being exists and it is always going to be the case that a Gambozino-like being exists in (n). | |
(T2) = It always has been the case that a Gambozino-like being existed in (n). | |
(T3) = It is not true that a Gambozino-like being exists and it is always going to exist in (n). | |
(T4) = A Gambozino-like being does not exist in (n) | |
(T4)' = It is not the case that a Gambozino-like being will always exist in (n). | |
(T5) = In sometime in the future it will be the case that a Gambozino-like being will not exist in (n). | |
(T6) = (n) occurred before (k). | |
(T7) = A Gambozino-like being does not exist in (k). | |
(T8) = (k) occurred before (n). (Reflexive Rule) | |
(T9) = A Gambozino-like being exists in (k). |
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
scala> mzero[Int] | |
res4: Int = 0 | |
scala> mzero[List[Int]] | |
res5: List[Int] = List() | |
scala> mzero[Map[Int, Double]] | |
res6: Map[Int,Double] = Map() | |
scala> mzero[Map[Int, Boolean]] |
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 scala.util.Random | |
object PStack { | |
type Any = PStack[_, _] | |
} | |
sealed trait PStack[A, B <: PStack.Any] { | |
def ++[C, D <: PStack.Any](op: Op[A, B, C, D]): PStack[C, D] = op.execute(this) | |
} |
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 annotation.tailrec | |
import util.Random | |
object main extends App { | |
val target = "as armas e os baroes assinalados" | |
val genePool = Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ') | |
def fitness(src: String): Double = src.zip(target).count { case (s, t) => s == t } | |
val petri = new GeneticExploration[Char, String](0.01, 500, genePool, cs => new String(cs.toArray), fitness, _.exists(_ == target)) |
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.io.{BufferedOutputStream, FileOutputStream, FileInputStream, BufferedInputStream} | |
import java.util.zip.{GZIPOutputStream, GZIPInputStream} | |
import scala.io.{Source, Codec} | |
import scala.language.{reflectiveCalls, implicitConversions} | |
object main extends App { | |
import utils._ | |
val inFile = "/Users/bytter/Documents/Development/shiftforward/spitz/coopeventsfiltered.log.gz" |
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 org.scalajs.dom | |
final case class Pt(x: Double, y: Double) | |
@JSExport | |
object SierpinskiTriangle { | |
val corners = Seq( | |
Pt(canvas.width/2, 0), | |
Pt(0, canvas.height), | |
Pt(canvas.width, canvas.height) |
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
/** | |
* Created by Hugo Sereno Ferreira on 15/06/14. | |
*/ | |
import org.scalajs.dom | |
import scala.collection._ | |
sealed trait Opcode | |
object Mov extends Opcode { override def toString = "MOV" } | |
object Add extends Opcode { override def toString = "ADD" } |
OlderNewer