Skip to content

Instantly share code, notes, and snippets.

Junichi Kato j5ik2o

Block or report user

Report or block j5ik2o

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@maoe
maoe / ViewPatterns.hs
Created Jun 21, 2010
How to use view patterns
View ViewPatterns.hs
{-# LANGUAGE PatternGuards #-}
{-# LANGUAGE ViewPatterns #-}
module ViewPatterns where
import Data.List
data EMail = EMail User Domain deriving Show
type User = String
type Domain = String
view :: String -> Maybe EMail
@poutyface
poutyface / git
Created Dec 29, 2010
gitの使い方
View git
githubへ登録
===========
git remote add origin git@github.com:<username>/<application_name>.git
git push origin master
初期設定
=======
git config --global user.name "Foo Bar"
git config --global user.email "foo@bar.com"
View gist:839320
import java.io.File
import sbt._
import de.element34.sbteclipsify._
class Project(info: ProjectInfo) extends ParentProject(info) with IdeaProject {
//lazy val mavenLocal = "Local Maven Repository" at "file://"+Path.userHome+"/.m2/repository"
lazy val geotoolsRepository = "Open Source Geospatial Foundation Repository" at "http://download.osgeo.org/webdav/geotools/"
lazy val javanetRepository = "Java.net Repository" at "http://download.java.net/maven/2"
lazy val iglootoolsRepository = "Iglootools Releases Repository" at "http://developers.sirika.com/maven2/releases/"
@xuwei-k
xuwei-k / gist:977994
Created May 18, 2011
ScalaのREPL上から、Web browser上で指定したソースコードのページ開くスクリプト
View gist:977994
object SourceCode{
val browser = """ "C:\Documents and Settings\scalaちゃん\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" """
val srcURL = "https://lampsvn.epfl.ch/trac/scala/browser/scala/tags/R_2_8_1_final/src//library/"
def apply(clazz:Class[_]){
val url = srcURL + clazz.getName.replace('.','/') + ".scala#L1"
@brunoborges
brunoborges / DSLWicket.scala
Created Jul 27, 2011
Scala DSL for Wicket
View DSLWicket.scala
package code.webapp
import scala.collection.JavaConversions.seqAsJavaList
import org.apache.wicket.behavior.AttributeAppender
import org.apache.wicket.datetime.markup.html.form.DateTextField
import org.apache.wicket.extensions.validation.validator.RfcCompliantEmailAddressValidator
import org.apache.wicket.markup.html.basic.{ MultiLineLabel, Label }
import org.apache.wicket.markup.html.form.{ TextField, TextArea, SubmitLink, RadioGroup, Radio, PasswordTextField, FormComponent, Form, DropDownChoice, CheckGroup, Button }
import org.apache.wicket.markup.html.link.{ Link, BookmarkablePageLink }
import org.apache.wicket.markup.html.link.ExternalLink
@stonegao
stonegao / rest.scala
Created Oct 9, 2011 — forked from robi42/rest.scala
Basic RESTful service with Finagle
View rest.scala
class Respond extends Service[Request, Response] with Logger {
def apply(request: Request) = {
try {
request.method -> Path(request.path) match {
case GET -> Root / "todos" => Future.value {
val data = Todos.allAsJson
debug("data: %s" format data)
Responses.json(data, acceptsGzip(request))
}
case GET -> Root / "todos" / id => Future.value {
@xuwei-k
xuwei-k / README.md
Created Oct 22, 2011
Scala dependent method types ?
View README.md

Scala dependent method types ?

ついに、ねんがんのでぃぺんでんとめそっどたいぷをてにいれたぞ

新しく 2.10 から(?) dependent method types っていう機能が Scala に入るらしいので、最新版をゴニョゴニョしてみた。 2.9.1で同じことやろうとすると def withFoo(foo: Foo): foo.Bar = foo.f という部分がコンパイル通らないはず。fooという 引数 の抽象型であるBarに依存した型だからっていう感じ?

しかし、機能の概念はなんとなくぼんやりと、把握はできたが、まだどういったときに役に立つのかわかっていない(・ω・`)

参考URLのメモ

@tyano
tyano / gist:1429205
Created Dec 4, 2011
List(1, 2, 3, 1) を Map(1 -> 2, 2 -> 1, 3 -> 1)
View gist:1429205
List(1,2,3,1).zip(List(1,1,1,1)).foldLeft(Map[Int,Int]()) { (x, y) => x.get(y._1) match { case Some(v) => x + Pair(y._1, (v + y._2)) case None => x + y }}
@makotan
makotan / gist:1476310
Created Dec 14, 2011
Either[L,Either[L,R]]のように多段になる場合にRだけを取得する
View gist:1476310
def eith[R](arg: Either[Throwable, Any] ) : R = {
arg match {
case Left(e) => throw e
case Right(o:Either[Throwable, Any]) => eith(o)
case Right(o:R) => o
}
}
@ogatatsu
ogatatsu / gist:1518754
Created Dec 25, 2011 — forked from j5ik2o/gist:1518723
こんな構文で階層型のログ出力をしたい
View gist:1518754
def connect = {
log("connect") { // connect start
// ... 何かの処理 ...
log("login") { // connect : login start
// ... 何かの処理 ...
} // connect : login end
// ... 何かの処理 ...
} // connect end
}
You can’t perform that action at this time.