Skip to content

Instantly share code, notes, and snippets.

View nisshiee's full-sized avatar

Hirokazu Nishioka nisshiee

View GitHub Profile
@nisshiee
nisshiee / gist-slide-test
Created January 16, 2012 15:36
gist-slide-test
!SLIDE
# gist-slideを試してみる
[これ](http://gist-slide.appspot.com/1191887/gist-slide)
!SLIDE
## どーよ
@nisshiee
nisshiee / Practice1.scala
Created February 19, 2012 00:29
scalaz Iterateeでファイルを読み込む練習
package iteratee.practice
import scalaz._
import Scalaz._
import effects._
import java.io.File
/**
* http://code.google.com/codejam/contest/1343486/dashboard
* の問題ファイルを読み込んでみる練習
@nisshiee
nisshiee / Practice3.scala
Created February 19, 2012 11:35
ScalazのIterateeでファイルを読み込むTipsを埋め込んだ
package iteratee.practice
import scalaz._
import Scalaz._
import IterV._
import effects._
import java.io.File
/**
* scalazのIterateeを使ってファイルを読み込む練習
@nisshiee
nisshiee / 20120308_01.scala
Created March 8, 2012 15:07
source codes for blog
object Hello extends App {
println("Hello World!")
}
@nisshiee
nisshiee / App.scala
Created May 31, 2012 12:10
BufferedReaderをIterateeで扱う
import java.io.{ BufferedReader, FileReader }
import scalaz._, Scalaz._
import scalaz.effects._
import IterV._
object App {
def main(args: Array[String]) {
val br = new BufferedReader(new FileReader("test2.txt"))
val io = byEnumerator(br)
@nisshiee
nisshiee / ControllerHelper.scala
Created July 16, 2012 11:25
PlayでurlFormEncodedなデータを受け取る
import scalaz._, Scalaz._
trait ControllerHelper {
// Seq[String]から型Tのデータを抽出する型クラス
trait Extractor[T] {
def extract(data: Seq[String]): Option[T]
}
// Extractorを簡単に生成できるようにする
@nisshiee
nisshiee / substr.js
Created July 17, 2012 14:47
String.substr関数の挙動
// Chrome、FF、IE9
"4321".substr(-2); // → "21"
// Windowsガジェット
"4321".substr(-2); // → "4321"
@nisshiee
nisshiee / 1.scala
Created July 24, 2012 12:47
永続化の前後をクラスで表現する
case class Person(name: String, age: Int)
@nisshiee
nisshiee / 1.scala
Created August 28, 2012 14:11
lift-jsonのextractで痒いところに手を伸ばす
sealed trait Carrier
case object PC extends Carrier
case object Mobile extends Carrier
case object Smartphone extends Carrier
@nisshiee
nisshiee / 01.scala
Created October 20, 2012 01:50
heroku+SendGrid+Play2+JavaMailでメールを送る
package controllers
import play.api._
import play.api.mvc._
object SendmailTest extends Controller {
def index = Action {
sendmail
Ok(views.html.index("ok"))