Skip to content

Instantly share code, notes, and snippets.

View nisshiee's full-sized avatar

Hirokazu Nishioka nisshiee

View GitHub Profile
@nisshiee
nisshiee / make_selenium.sh
Created May 3, 2013 07:29
集英社×kobo 史上最強の超マンガ祭り!!(2013/05)で、 JOJOを30%OFFクーポン利用&ポイント全利用で大人買いするSeleniumテストケースを作る。
#!/bin/bash
cat << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://rakuten.kobobooks.com/" />
<title>one_buy</title>
@nisshiee
nisshiee / scalas_template.scala
Last active December 18, 2015 21:48
Scalasスクリプトのテンプレート
#!/usr/bin/env scalas
/***
scalaVersion := "2.10.3"
libraryDependencies ++= Seq(
"org.scalaz" %% "scalaz-core" % "7.0.5"
,"org.typelevel" %% "scalaz-contrib-210" % "0.1.5"
,"com.typesafe.akka" %% "akka-actor" % "2.2.3"
,"com.github.scala-incubator.io" %% "scala-io-core" % "0.4.2"
@nisshiee
nisshiee / 01.scala
Last active December 20, 2015 21:39
TDDBC参加レポート
case class VendingMachine(total: Int, stock: Map[Drink, Int])
@nisshiee
nisshiee / post-commit
Last active December 20, 2015 22:19
twireminder hooks
#!/bin/bash
cp conf/__application.conf.tmp conf/application.conf
rm conf/__application.conf.tmp
@nisshiee
nisshiee / myscreen.sh
Last active December 21, 2015 16:59
screen -lsの出力を見て適切にオプションつけてscreenを起動してくれるスクリプト
#!/bin/bash
STATUS=`screen -ls`
new_session() {
exec screen
}
detach_and_reattach() {
exec screen -d -r
@nisshiee
nisshiee / myhttp.scala
Last active February 25, 2016 13:12
Dispatchの文字化け対策
import dispatch._
import com.ning.http.client.filter.{ ResponseFilter, FilterContext }
import scala.collection.JavaConverters._
val MyHttp = Http.configure { builder =>
builder.addResponseFilter(new ResponseFilter {
override def filter(ctx: FilterContext[_]) = {
ctx.getResponseHeaders.getHeaders.get("Content-Type").asScala.toList match {
case "text/html" :: Nil =>
ctx.getResponseHeaders.getHeaders.put("Content-Type", List("text/html; charset=utf-8").asJava)
@nisshiee
nisshiee / Juice.scala
Created September 16, 2013 09:14
自動販売機2.0をScalazのStateモナドを使って実装する http://devtesting.jp/tddbc/?TDDBC%E5%A4%A7%E9%98%AA3.0%2F%E8%AA%B2%E9%A1%8C
package org.nisshiee.vendingmachine
case class Juice(name: String, price: Int)
object Juice {
val coke = Juice("コーラ", 120)
val redbull = Juice("Red Bull", 200)
}
@nisshiee
nisshiee / 01.scala
Last active December 23, 2015 04:09
def apply[S, A](f: (S) ⇒ (S, A)): State[S, A]
@nisshiee
nisshiee / 01.scala
Last active December 24, 2015 06:59
import akka.actor._
trait AbstractActor[MesType] extends Actor {
override def receive = ...
}
case class MyMessage(mes: String)
class MyActor extends AbstractActor[MyMessage]
@nisshiee
nisshiee / 01.scala
Created October 19, 2013 07:53
[akka]ステートフルActorに関する考察
import akka.actor._
class VarCounter extends Actor {
private[this] var count: Int = 0
override def receive = {
case _: String => count = count + 1
}
}