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
package com.github.tototoshi.gifplayer | |
import scala.scalajs.js | |
import js.annotation.JSExport | |
import org.scalajs.dom | |
@JSExport | |
object GIFPlayer extends js.JSApp { | |
def main(): Unit = { |
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
<?php | |
class GIFReader | |
{ | |
const TRAILER = 0x3b; | |
const IMAGE_INTRODUCER = 0x2c; | |
const EXTENSION_INTRODUCER = 0x21; | |
const GRAPHIC_CONTROL_LABEL = 0xf9; |
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 subprocess | |
script = 'display notification "Finished" with title "Job Finished" sound name "Tritone"' | |
p = subprocess.Popen(["osascript"], stdin=subprocess.PIPE) | |
p.stdin.write(script) | |
p.stdin.close() | |
p.wait() |
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
<?php | |
/* !! 入力配列の中にある数値添字要素の添字の数値は、 結果の配列ではゼロから始まる連続した数値に置き換えられます。 */ | |
$a = array( | |
'a' => 'aaa', | |
'100' => '100100100', | |
); | |
$b = array( | |
'b' => 'bbb', |
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
libraryDependencies ++= Seq( | |
jdbc, | |
cache, | |
"org.scalikejdbc" %% "scalikejdbc" % "[1.7,)", // by scalikejdbc organization (@seratch, .....) | |
"org.scalikejdbc" %% "scalikejdbc-interpolation" % "[1.7,)", // by scalikejdbc organization | |
"org.scalikejdbc" %% "scalikejdbc-play-plugin" % "[1.7,)", // by scalikejdbc organization | |
"com.github.tototoshi" %% "play-flyway" % "1.0.1", // by me | |
"com.github.mumoshu" %% "play2-memcached" % "0.3.0.2", // by @mumoshu | |
"com.github.nscala-time" %% "nscala-time" % "0.6.0", // by nscala-time organization (@kmizu, @xuwei_k ...) | |
"jp.t2v" %% "play2-auth" % "0.11.0", // by @gakuzzzz |
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.concurrent.Future | |
import scala.concurrent.ExecutionContext.Implicits.global | |
object TaskLancher extends skinny.task.TaskLauncher { | |
register("h2-browser", (params) => { | |
val f = Future { | |
org.h2.tools.Server.main() | |
} | |
f.onFailure { case e => e.printStackTrace() } |
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 alpaca | |
visit("http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html") | |
click("input[type=radio]") | |
click(partialLink("macosx-x64.dmg")) |
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
/* 1.0.0 */ | |
import scala.slick.driver.PostgresDriver.simple._ | |
case class Task(id: Int, name: String) | |
object Task extends Table[Task]("task") { | |
def id = column[Int]("id") | |
def name = column[String]("name") | |
def * = id ~ name <> (Task.apply _, Task.unapply _) | |
} |
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 sbt._ | |
import sbt.Keys._ | |
object ScalaoauthasyncBuild extends Build { | |
lazy val scalaoauthasync = Project( | |
id = "scala-oauth-async", | |
base = file("."), | |
settings = Project.defaultSettings ++ Seq( | |
name := "scala-oauth-async", |
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
val m1 = Map(1 -> 2, 2 -> 5, 3 -> 1) | |
val m2 = Map(2 -> 4, 3 -> 3, 4 -> 3) | |
def toMultiMap[A, B](m1: Map[A, B], m2: Map[A, B]): Map[A, Set[B]] = | |
(m1.toSeq ++ m2.toSeq).groupBy(_._1).mapValues(_.map(_._2).toSet) | |
/* | |
scala> toMultiMap(m1, m2).mapValues(_.max) | |
res0: scala.collection.immutable.Map[Int,Int] = Map(2 -> 5, 4 -> 3, 1 -> 2, 3 -> 3) | |
*/ |