Skip to content

Instantly share code, notes, and snippets.

View masahitojp's full-sized avatar
🎯
Focusing

Masato Nakamura masahitojp

🎯
Focusing
View GitHub Profile
@masahitojp
masahitojp / translate.md
Created September 15, 2012 11:33
playdocja 翻訳の流れについて

日本語翻訳への貢献

Playdocja (https://github.com/garbagetown/playdocja) 上で翻訳を進めています。

翻訳の流れ

未翻訳のドキュメントを翻訳する場合、ForkしてPullReqestを送ってください。 (githubでweb上からドキュメントを編集すると自動的にFork -> PullReqestの流れになります。非常に手軽に翻訳に貢献することが可能です。) 翻訳チームでコミットさせて頂きます。

scala> case class Test(a: Int, b: Boolean)
defined class Test
scala> val c = Test(1,false)
c: Test = Test(1,false)
scala> val d = c.copy(a = 2)
d: Test = Test(2,false)
class Sample(a0:Int, a1:Int) {
println("cons")
val n0 = a0
var n1 = a1
def this(a:Int) = {
this(a, 2)
println("sub")
}
}
@masahitojp
masahitojp / packetdiag_interactive_shell_rect_whilter.js
Created November 27, 2012 08:43
packetdiag ineractive shell 0.9.2でsvgのrectタグのfill属性が黒で出力されるので無理やり白塗りする http://interactive.blockdiag.com/packetdiag/
// ==UserScript==
// @id packetdiag_interactive_shell_rect_whilter
// @name packetdiag_interactive_shell_rect_whilter
// @version 0.0.1
// @namespace packetdiag_interactive_shell_rect_whilter
// @author @Masahito
// @description packetdiag_interactive_shell_rect_whilter
// @include http://interactive.blockdiag.com/packetdiag/
// @run-at document-end
// ==/UserScript==
@masahitojp
masahitojp / gist:4246204
Created December 9, 2012 17:30
riak-java-clientでの2iの使い方
import com.basho.riak.client.RiakFactory
scala> val riakClient = RiakFactory.pbcClient()
scala> val pyspaBucket = riakClient.fetchBucket("pyspa").execute()
scala> import com.basho.riak.client.query.indexes.IntIndex
import com.basho.riak.client.query.indexes.IntIndex
scala> pyspaBucket.fetchIndex(IntIndex.named("age")).from(30).to(50).execute()
(1 to 100).map{ x =>
(x % 3, x % 5) match {
case (0,0) => "FizzBuzz"
case (0,_) => "Fizz"
case (_,0) => "Buzz"
case _ => x.toString
}
}.map(println(_))
import akka.actor.IO._
import akka.actor.{Props, IO, IOManager, Actor, ActorSystem}
import akka.event.Logging
import akka.util.ByteString
import java.net.InetSocketAddress
class TCPEchoServer(port: Int) extends Actor {
val log = Logging(context.system, this)
val state = IterateeRef.Map.async[IO.Handle]()(context.dispatcher)
// euler1
(1 to 1000).filter(x => {x % 3 == 0 | x % 5 == 0}).map(println(_))
// euler2
lazy val fib: Stream[Int] = Stream.cons(0,Stream.cons(1, fib.zip(fib.tail).map(p => p._1 + p._2)))
fib.takeWhile(_ < 4000000).filter(_ % 2 == 0).foldLeft(0)(_ + _)
============
今年の目標
============
***************
やること
***************
***************
@masahitojp
masahitojp / commandline
Last active December 12, 2015 03:18
diff => github issuneの登録の流れ
pip install github3.py
curl -O http://download.playframework.org/releases/play-2.0.4.zip
curl -O http://download.playframework.org/releases/play-2.1-RC4.zip
unzip play-2.0.4.zip
unzip play-2.1-RC4.zip
#
diff -q -r play-2.0.4/documentation play-2.1-RC4/documentation > for_diff.txt
python diff.py ./for_diff.txt > result.csv