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 org.mbte.groovypp.examples.wordcount; | |
import java.io.BufferedReader; | |
import java.io.BufferedWriter; | |
import java.io.File; | |
import java.io.FileReader; | |
import java.io.IOException; | |
import java.io.PrintWriter; | |
import java.io.Writer; | |
import java.util.ArrayList; |
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 org.mbte.groovypp.examples.wordcount; | |
import java.io.BufferedReader; | |
import java.io.BufferedWriter; | |
import java.io.File; | |
import java.io.FileReader; | |
import java.io.IOException; | |
import java.io.PrintWriter; | |
import java.io.Writer; | |
import java.util.ArrayList; |
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
object PersonExample { | |
case class Person(val firstName:String, lastName:String, dept:String, phone:String, age:Int) | |
def main(args:Array[String]) = { | |
val billy = Person("Billy", "Johnson", "Acct", "5123", 33) | |
val bobby = Person("Bobby", "Johnson", "Acct", "5123", 33) | |
val bonusForPerson = Map( | |
billy -> 100, | |
bobby -> 10000 | |
) |
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.HashMap; | |
import java.util.Map; | |
public class Person { | |
private final String _firstName; | |
private final String _lastName; | |
private final String _dept; | |
private final String _phone; | |
private final int _age; |
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 static void bootPlay(String projectName, File projectsHome) { | |
try { | |
System.setProperty("play.id", projectName); | |
File projectHome = new File(projectsHome, projectName); | |
System.setProperty("application.path", projectHome.getAbsolutePath()); | |
Play.init(projectHome, projectName); | |
Play.start(); | |
Thread.currentThread().setContextClassLoader(Play.classloader); | |
for (PlayPlugin plugin : Play.plugins) { | |
System.out.println("PlayMain.main: loaded plugin " + plugin); |
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
07:40:46,773 INFO ~ Starting /Users/adamrabung/projects/putto | |
07:40:46,776 INFO ~ Module crud is available (/Users/adamrabung/projects/play-1.1/modules/crud) | |
07:40:47,484 WARN ~ You're running Play! in DEV mode | |
07:40:50,293 INFO ~ Connected to jdbc:h2:~/test | |
07:40:51,060 INFO ~ Application 'putto' is now started ! | |
PlayMain.main: loaded plugin play.CorePlugin@51701bdc | |
PlayMain.main: loaded plugin play.data.parsing.TempFilePlugin@7df44ec7 | |
PlayMain.main: loaded plugin play.data.validation.ValidationPlugin@38717323 | |
PlayMain.main: loaded plugin play.db.DBPlugin@7c19f9d2 | |
PlayMain.main: loaded plugin play.db.jpa.JPAPlugin@7564debb |
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
// register directory and sub-directories | |
Files.walkFileTree(start, new SimpleFileVisitor<Path>() { | |
@Override | |
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { | |
register(dir); | |
return FileVisitResult.CONTINUE; | |
} | |
}); |
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 static void main(String[] args) throws IOException { | |
ITimesheetDatabase db = new ConsoleTimesheetDatabase(); | |
IPathWatcher proj1 = new TimesheetPathWatcher(db, "Project Epsilon", Paths.get("c:\\temp\\epsilon"), Paths.get("c:\\temp\\epsilon2")); | |
IPathWatcher proj2 = new TimesheetPathWatcher(db, "Project Manhattan", Paths.get("c:\\temp\\manhattan")); | |
new DirectoryWatcher(proj1, proj2).processEvents(); | |
} |
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 Collection<out T> { | |
fun contains(t:in T):Boolean; | |
} |
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 Publishable[T] { | |
def asWebMarkup(p: T): String | |
} | |
case class BlogPost(title: String, text: String) | |
implicit object BlogPostPublisher extends Publishable[BlogPost] { | |
def asWebMarkup(p: BlogPost) = | |
"""|<h2>%s</h2> | |
|<div>%s</div>""".stripMargin format(p title, p text) |
OlderNewer