Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View nicmarti's full-sized avatar

Nicolas Martignole nicmarti

View GitHub Profile
@nicmarti
nicmarti / ProjectService.java
Created May 9, 2020 17:15
Quarkus RESTEasy and update with Transaction
@ApplicationScoped
public class ProjectService {
@Inject
UserTransaction transaction;
private static Logger logger = LoggerFactory.getLogger(ProjectService.class);
@Inject
@nicmarti
nicmarti / KVotesReplay.kt
Created May 3, 2018 22:01
Devoxx CFP Web client to replay votes from a Gluon log file
import org.apache.http.client.ClientProtocolException
import org.apache.http.client.ResponseHandler
import org.apache.http.client.methods.HttpPost
import org.apache.http.entity.StringEntity
import org.apache.http.impl.client.HttpClients
import org.apache.http.util.EntityUtils
import java.io.File
/**
@nicmarti
nicmarti / README.md
Last active March 5, 2024 20:54
Exercice Scala niveau débutant

Lunatech

Scala tutorial.

Audience : cet exercice s'adresse à des développeurs ayant quelques bases en Scala. Il permet de découvrir la mise en place progressive d'un ensemble de fonctions et de types, pour résoudre un problème simple.

L'objectif de cet exercice est de réaliser un générateur d'équipement pour le jeu Minecraft. Minecraft est un jeu d'exploration. L'aventurier doit trouver des ingrédients de base, puis les combiner afin de constuire

@nicmarti
nicmarti / AkkaServerSentClientApp.scala
Created August 1, 2017 21:43
Simple Akka HTTP Server-sent-event client
/*
* Copyright 2017 Lunatech
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@nicmarti
nicmarti / java
Created July 21, 2017 15:27
Play 2.5 Java - Download a set of images, described in a JSON file with a list of URLs, using Akka stream.
package services;
import akka.actor.ActorSystem;
import akka.stream.ActorMaterializer;
import akka.stream.Materializer;
import akka.stream.javadsl.FileIO;
import com.fasterxml.jackson.databind.JsonNode;
import play.api.Play;
import play.libs.Json;
import play.libs.ws.StreamedResponse;
[info] [SUCCESSFUL ] org.scala-sbt#serialization_2.10;0.1.1!serialization_2.10.jar (1615ms)
2017-01-12T08:18:10.881+01:00[info] [SUCCESSFUL ] org.scala-lang.modules#scala-pickling_2.10;0.10.0!scala-pickling_2.10.jar (113ms)
2017-01-12T08:18:10.882+01:00[info] downloading https://repo1.maven.org/maven2/org/json4s/json4s-core_2.10/3.2.10/json4s-core_2.10-3.2.10.jar ...
2017-01-12T08:18:10.898+01:00[info] [SUCCESSFUL ] org.json4s#json4s-core_2.10;3.2.10!json4s-core_2.10.jar (81ms)
2017-01-12T08:18:10.899+01:00[info] downloading https://repo1.maven.org/maven2/org/spire-math/jawn-parser_2.10/0.6.0/jawn-parser_2.10-0.6.0.jar ...
2017-01-12T08:18:10.900+01:00[info] [SUCCESSFUL ] org.spire-math#jawn-parser_2.10;0.6.0!jawn-parser_2.10.jar (44ms)
2017-01-12T08:18:10.901+01:00[info] downloading https://repo1.maven.org/maven2/org/spire-math/json4s-support_2.10/0.6.0/json4s-support_2.10-0.6.0.jar ...
2017-01-12T08:18:11.358+01:00[info] downloading https://repo1.maven.org/maven2/org/scalamacros/quasiquotes_2.10/2.0.1/quasi
### Keybase proof
I hereby claim:
* I am nicmarti on github.
* I am nicmarti (https://keybase.io/nicmarti) on keybase.
* I have a public key whose fingerprint is 6672 0E0F 9FCC C14F 6F16 CAC8 8EE8 CC06 831B 410B
To claim this, I am signing this object:
@nicmarti
nicmarti / selection.scala
Last active August 29, 2015 14:07
Sample scala test
package roger
import org.scalatest.{FlatSpec, ShouldMatchers}
import roger.AggregationOperation.AggregationOperation
case class Metric(id: String, aggregationOperation: AggregationOperation)
case class Dimension(id: String)
object AggregationOperation extends Enumeration {
@nicmarti
nicmarti / JournauxRepository.scala
Created May 26, 2014 23:30
Slick 2.x left join
object JournauxRepository {
def allWithOperateurs():Seq[(Journal, Operateur, Option[String])] = {
DB.withSession {
implicit s =>
val result = for {
((journal, operateur), intervenant) <- Journaux leftJoin Operateurs on(_.idOperateur === _.id) leftJoin Intervenants on(_._1.idIntervenant === _.idAgence)
} yield (journal,operateur,intervenant.nom.?)
result.run
}
}
@nicmarti
nicmarti / SecureCFP Controller
Created May 10, 2014 12:39
SecureCFPController Play 2.2 Scala secure controller used for Devoxx CFP
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 Association du Paris Java User Group.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,