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
import java.util.Calendar; | |
public class MonthlyCalendar { | |
private int year; | |
private int month; | |
private int[][] calendarMatrix = new int[6][7]; | |
private int startDay; | |
private int lastDate; | |
/** |
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
package controllers; | |
import models.*; | |
import java.util.*; | |
import play.*; | |
import play.data.*; | |
import play.mvc.*; | |
import views.html.*; |
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
package controllers; | |
import models.*; | |
import java.util.*; | |
import play.*; | |
import play.data.*; | |
import play.mvc.*; | |
import views.html.*; |
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
// Finder用の内部クラス | |
public static class FindForm { | |
@Required | |
public String input; | |
} | |
// /findにアクセスした際のAction | |
public static Result find() { | |
Form<FindForm> f = new Form(FindForm.class).bindFromRequest(); | |
List<Message> datas = null; |
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
# --- !Ups | |
create table users( | |
id SERIAL, | |
name varchar(100), | |
email varchar(100), | |
password varchar(100), | |
createDate timestamp default current_timestamp, | |
primary key(id)); | |
# --- !Downs | |
drop table users; |
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
def max(x: Int, y: Int): Int = { | |
if (x > y) x | |
else y | |
} | |
def max2(x: Int, y: Int) = if (x > y) x else y | |
val list: List[String] = List[String]("A", "B", "C\n") | |
println(max(1, 2)) | |
println(max2(3, 4)) |
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
package PSSE.code | |
//class Rational(n: Int, d: Int) { | |
// require(d != 0) // falseならば、IllegalArgumentExceptionを投げる | |
// override def toString = n + "/" + d | |
//} | |
// thatはaddメソッド呼びだしのレシーバーではないので、that.nとかthat.dとすることはできない※ | |
// thatの分子や分母にアクセスするには、それらをフィールドにする必要がある | |
//class Rational(n: Int, d: Int) { // This won't compile |
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
package PSSE.code | |
object BuitinControlStructures extends App { | |
def gcdLoop(x: Long, y: Long): Long = { | |
var a = x | |
var b = y | |
while (a != 0) { | |
val temp = a | |
a = b % a |
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
package PSSE.code | |
import java.io.PrintWriter | |
object FileMatcher extends App { | |
private def filesHere = (new java.io.File("/tmp/scalaLesson/")).listFiles | |
// def filesEnding(query: String) = | |
// for (file <- filesHere; if file.getName.endsWith(query)) | |
// yield file |
OlderNewer