Skip to content

Instantly share code, notes, and snippets.


Matthieu Guillermin mguillermin

  • Swappie
  • Helsinki, Finlande
View GitHub Profile
View build.sbt
name := "testRequireJs"
version := "1.0-SNAPSHOT"
libraryDependencies ++= Seq(
View gist:7579074
status = auto
branch = auto
interactive = auto
diff = auto
co = checkout
br = branch
ci = commit
st = status
View test.php
$ php -r "echo htmlentities(htmlspecialchars('œ … ’'));"
œ … ’
$ php test.php
œ … ’
mguillermin / ImplicitSenderTest.scala
Last active Feb 5, 2021
Sample showing basic usage of Akka TestKit and TestActorRef
View ImplicitSenderTest.scala
package sample.akka.testkit
import akka.testkit.{TestKit, TestActorRef}
import org.scalatest.matchers.MustMatchers
import org.scalatest.WordSpec
class ImplicitSenderTest extends TestKit(ActorSystem("testSystem"))
// Using the ImplicitSender trait will automatically set `testActor` as the sender
mguillermin / generated_jsRoutes.js
Last active May 24, 2016
Submitting Ajax POST with PlayFramework 2.x and the Javascript Router
View generated_jsRoutes.js
_nS('controllers.admin.Products'); =
function() {
return _wA({method:"POST", url:"/" + "admin/product/search"})
mguillermin / Application.scala
Last active Dec 16, 2015
Code samples play2-elasticsearch
View Application.scala
object Application extends Controller {
def async = Action {
IndexTestManager.index(IndexTest("1", "Here is the first name", "First category"))
IndexTestManager.index(IndexTest("2", "Then comes the second name", "First category"))
IndexTestManager.index(IndexTest("3", "Here is the third name", "Second category"))
IndexTestManager.index(IndexTest("4", "Finnaly is the fourth name", "Second category"))
val indexQuery = IndexTestManager.query
mguillermin /
Created Oct 22, 2012
PlayFramework 2.0 Ebean Test with YAML data
package models;
public class Company extends Model {
public Long id;
public String name;
public static Finder<Long, Company> find = new Finder<Long, Company>(Long.class, Company.class);
mguillermin / my_module.module
Created Apr 3, 2012
Exemple de hook_module_implements_alter() dans Drupal 7
View my_module.module
function my_module_module_implements_alter(&$implementations, $hook) {
switch ($hook) {
case 'form_alter':
if (array_key_exists('my_module', $implementations)) {
// On veut que le hook_form_alter my_module soit le dernier exécuté
// On le remet à la fin du tableau
$my_module = $implementations['my_module'];
mguillermin / gist:2145559
Created Mar 21, 2012
Drupal - Utiliser Workbench pour filtrer les menus dispos lors de la création de contenu
View gist:2145559
function my_module_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'page_node_form' && !user_access('administer content')) {
// Alter node edit form
$menu_items = $form['menu']['link']['parent']['#options'];
$menu_items_to_delete = array();
$workbench_access_menus = workbench_access_get_user_tree();
foreach ($menu_items as $menu_key => $menu_value) {
$ok = false;
foreach ($workbench_access_menus as $id => $workbench_access_menu) {
mguillermin /
Created Mar 21, 2012
Play 2.0 Template inclusion with "backed" logic
package controllers;
import play.api.templates.Html;
import models.MenuItem;
public class Menu {
public static Html render(String parent) {
List<MenuItem> menuItems = MenuItem.findByParent(parent);
// more business logic...