Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthieu Guillermin mguillermin

  • Swappie
  • Helsinki, Finlande
View GitHub Profile
@mguillermin
mguillermin / User.scala
Created Mar 14, 2012
Play 2.0 Anorm Sample
View User.scala
case class User(email: String, name: String, password: String)
object User {
// -- Parsers
/**
* Parse a User from a ResultSet
*/
val simple = {
@mguillermin
mguillermin / Company.java
Created Mar 14, 2012
Play 2.0 Ebean Sample
View Company.java
@Entity
public class Company extends Model {
@Id
public Long id;
@Constraints.Required
public String name;
public Company(String name) {
@mguillermin
mguillermin / index.scala.html
Created Mar 14, 2012
Play 2.0 Scala Template Sample
View index.scala.html
@(user: User, links : List[link])
@main("User links") {
<p>Welcome @user.name !</p>
<ul>
@for(link <- links) {
<li><a href="@link.url">@link.title</a></li>
}
</ul>
}
@mguillermin
mguillermin / Application.java
Created Mar 14, 2012
Play 2.0 Java Controller Sample
View Application.java
public class Application extends Controller {
public static Result testText() {
return ok("Hello world !");
}
public static Result testTemplate() {
return ok(index.render("Your new application is ready."));
}
View BaseModelTest.java
public class BaseModelTest {
public static FakeApplication app;
public static String createDdl = "";
public static String dropDdl = "";
@BeforeClass
public static void startApp() throws IOException {
app = Helpers.fakeApplication(Helpers.inMemoryDatabase());
Helpers.start(app);
View BaseModelTest.java
public class BaseModelTest {
public static FakeApplication app;
@BeforeClass
public static void startApp() {
app = Helpers.fakeApplication(Helpers.inMemoryDatabase());
Helpers.start(app);
}
@AfterClass
View BasicTest.java
@Test
public void save() {
running(fakeApplication(), new Runnable() {
public void run() {
// Here is your real test code
Company company = new Company("My Company");
company.save();
assertThat(company.id).isNotNull();
}
});
View CI_Task_ConfigureDistTask.class.php
<?php
/**
* Replaces tokens in distribution files.
*/
class CI_Task_ConfigureDistTask extends sfBaseTask
{
/**
* @see sfTask
*/