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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
$ brew install pari |
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
/* | |
* scalac Enum.scala | |
*/ | |
/** | |
* Define Signal Enumeration | |
*/ | |
object Signal extends Enumeration { | |
val Green = Value //=> Val(0, "Green") |
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
trait Greeter { | |
def greetTo(to: String): String | |
} | |
class HelloGreeter(name: String) extends Greeter { | |
def greetTo(to: String) = s"${name} says 'Hello ${to}!'" | |
} | |
new HelloGreeter("Alice").greetTo("Bob") //=> Alice says 'Hello Bob!' |
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
public class Main { | |
public static void main(String[] args) { | |
// Signal class | |
System.out.println(Signal.class.toString()); | |
// Signal$ class (Signal.type @ Scala) | |
System.out.println(Signal$.class.toString()); | |
// Signal singleton object | |
Signal$ obj = Signal$.MODULE$; |
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
sealed abstract class MailList { | |
// コレクションとして扱うための抽象メソッド | |
def +(mailbox: Mailbox): MailList | |
// 別の型に変換するなどの処理 | |
def publish: String = this match { | |
case Mailbox(str) => str | |
case MailboxList(list) => list.map(_.publish).mkString(",") | |
} | |
} |
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 java.net.{InetAddress,UnknownHostException} | |
import util.parsing.combinator.RegexParsers | |
object IpParsers extends RegexParsers { | |
def ipAddress: Parser[String] = """[0-9a-fA-F:\.]+""".r.withFilter { str => | |
try { | |
val addr = InetAddress.getByName(str) | |
true | |
} catch { | |
case e: UnknownHostException => false |
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
require 'formula' | |
class Jhcal < Formula | |
homepage 'http://www2.tokai.or.jp/y_okamon/myfreesoft/jhcal/jhcal.html' | |
url 'http://www2.tokai.or.jp/y_okamon/myfreesoft/jhcal/jhcal-2.0.tar.gz' | |
sha1 'ae09d530c3e89da8624245f95378a7991b597101' | |
def install | |
system "make" | |
bin.install "jhcal" |
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
public interface A { | |
public static final String C = "hoge"; | |
} |
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
class MyException(message: String = null, cause: Throwable = null) extends RuntimeException(message, cause) { | |
def this(cause: Throwable) = this(Option(cause).map(_.toString).getOrElse(null), cause) | |
} |