Skip to content

Instantly share code, notes, and snippets.

object SafeFizzBuzz extends scalaz.effect.SafeApp {
import scalaz._
import scalaz.effect._
import scalaz.std.string._
override def run(args: ImmutableArray[String]): IO[Unit] = {
def int2answer(i: Int) =
if (i % 3 == 0 && i % 5 == 0) Some("fizzbuzz")
else if (i % 3 == 0) Some("fizz")
else if (i % 5 == 0) Some("buzz")
package app.models.game.world
import java.util.UUID
import app.models.game._
import app.models.game.world.buildings._
import app.models.game.world.props.{ExtractionSpeed, AsteroidImpl, PropImpl}
import app.models.game.world.units._
import utils.IdObj
import sbt.Keys._
name := "TBS Game"
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
resolvers += Resolver.sonatypeRepo("releases")
resolvers += Resolver.sonatypeRepo("snapshots")
def moveAttack[A <: MovableFighter](
world: World, unit: A,
target: SearchRes[OwnedObj], strict: Boolean=true
)(implicit ev: A#Self =:= A): Result[A] = {
moveAndThen(world, unit, target.path, strict) { case (newWorld, movedUnit) =>
movedUnit.attackWS(target.value, newWorld).right.map(_.map {
case (w, u) => (w, u)
})
}
}
#!/usr/bin/env ruby
$tracks = []
class Track
attr_accessor :no, :hours, :minutes, :seconds, :performer, :song_name
def initialize(no, hours, minutes, seconds, title)
@no, @hours, @minutes, @seconds = no, hours, minutes, seconds
split_title = title.split("-", 2)
@arturaz
arturaz / gist:a533ea7e832a8132d791
Created January 7, 2015 20:31
cue file extractor
#!/usr/bin/env ruby
$tracks = []
class Track
attr_accessor :no, :hours, :minutes, :seconds, :performer, :song_name
def initialize(no, hours, minutes, seconds, title)
@no, @hours, @minutes, @seconds = no, hours, minutes, seconds
split_title = title.split("-", 2)
private void readFrame(
byte[] buffer, int frameLength, int leftToRead, Ref<bool> continueReading,
Act<Try<Messages.Messages.FromServer>> callback
) {
Log.debug(string.Format(
"Entering #readFrame(frameLength={0}, leftToRead={1})", frameLength, leftToRead
));
var stream = tcp.GetStream();
stream.BeginRead(buffer, frameLength - leftToRead, leftToRead, ar => {
var bytesRead = stream.EndRead(ar);
{
games: [
{
"title": "Orborun",
"description": "Orborun is a 3D run & roll game where your nerves will be put to the test.",
"youtube_key": "YnVI9AVWx5U",
"start_at_s": 50,
"platforms": ["ios", "android", "windows", "osx", "linux", "wp8"],
"links": {
"google-play": "https://play.google.com/store/apps/details?id=com.bulkypix.orborun",
package utils.actors
import akka.actor.{ActorLogging, Actor, ActorRef}
import akka.util.ByteString
import scala.reflect.ClassTag
object CodedFrameProxy {
case class Init(intFramedProxy: ActorRef, decodedMessageHandler: ActorRef)
}
package app.models.world
import java.util.UUID
import shapeless._
import shapeless.ops.record.Selector
import shapeless.record._
case class Vect2(x: Int, y: Int)
case class Bounds(position: Vect2, size: Vect2)