Skip to content

Instantly share code, notes, and snippets.

Manuel Bernhardt manuelbernhardt

Block or report user

Report or block manuelbernhardt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@manuelbernhardt
manuelbernhardt / Busy.java
Created Jul 20, 2016
Calculates PI to keep CPU busy
View Busy.java
package com.typesafe.training.coffeehouse;
import scala.concurrent.duration.Duration;
import java.math.BigDecimal;
public class Busy {
public static BigDecimal busy(Duration duration) {
return pi(System.nanoTime() + duration.toNanos());
View gist:531261f954afc4342536
diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultDataType.java b/jOOQ/src/main/java/org/jooq/impl/DefaultDataType.java
index 5231af3..fd19cce 100644
--- a/jOOQ/src/main/java/org/jooq/impl/DefaultDataType.java
+++ b/jOOQ/src/main/java/org/jooq/impl/DefaultDataType.java
@@ -720,6 +717,15 @@ public class DefaultDataType<T> implements DataType<T> {
if (dialect != null) {
result = TYPES_BY_TYPE[dialect.family().ordinal()].get(type);
+
+ // check if we know about interfaces implemented by the type
@manuelbernhardt
manuelbernhardt / CQRSEventHandler.scala
Created Jun 2, 2015
CQRS & jOOQ example in Scala
View CQRSEventHandler.scala
package actors
import java.sql.Timestamp
import akka.actor.{Actor, ActorLogging}
import helpers.Database
import generated.Tables._
import org.jooq.impl.DSL._
class CQRSEventHandler extends Actor with ActorLogging {
@manuelbernhardt
manuelbernhardt / gist:09cbfa52e466d0cd7ae1
Created May 7, 2015
jOOQ integration in a `build.sbt` file
View gist:09cbfa52e466d0cd7ae1
libraryDependencies ++= Seq(
"org.jooq" % "jooq" % "3.6.0",
"org.jooq" % "jooq-codegen-maven" % "3.6.0",
"org.jooq" % "jooq-meta" % "3.6.0"
)
val generateJOOQ = taskKey[Seq[File]]("Generate JooQ classes")
val generateJOOQTask = (sourceManaged, dependencyClasspath in Compile, runner in Compile, streams) map { (src, cp, r, s) =>
toError(r.run("org.jooq.util.GenerationTool", cp.files, Array("conf/authentication.xml"), s.log))
View gist:2940c5d35c0d3e63806c
trait Command
trait Event
case class A(....) extends Command
case class B(....) extends Command
case class C(....) extends Command
case class D(....) extends Command
case class AA(...) extends Event
case class BB(...) extends Event
View keybase.md

Keybase proof

I hereby claim:

  • I am manuelbernhardt on github.
  • I am manuelbernhardt (https://keybase.io/manuelbernhardt) on keybase.
  • I have a public key whose fingerprint is 55EF 42DE 0756 39CD 912D 9BEF BBF8 0641 C9A1 4ACC

To claim this, I am signing this object:

View view.html
<div class="row">
<h3>Wines</h3>
<div>
<div control-group label="Language">
<select id="languageCode" name="languageCode" ng-model="$parent.currentLang" ng-options="l.value as l.label for l in languages"></select>
</div>
<div control-group label="Title">
<input type="text" id="title" name="title" ng-model="wine.translations[$parent.currentLang].title" required>
<span validation-error-for="required">Required</span>
View gist:5721504
+------------------------------------------------------------+-----------------------------------------------------------------------+-------------------------------------------------+
| org.mongodb:casbah_2.10:2.6.1 | com.novus:salat-core_2.10:1.9.2-SNAPSHOT | As casbah_2.10-2.6.1.pom |
+------------------------------------------------------------+-----------------------------------------------------------------------+-------------------------------------------------+
| org.mongodb:casbah-gridfs_2.10:2.6.1 | org.mongodb:casbah_2.10:2.6.1 | As casbah-gridfs_2.10-2.6.1.jar |
+------------------------------------------------------------+-----------------------------------------------------------------------+-------------------------------------------------+
| org.mongodb:casbah-core_2.10:2.6.1 | org.mongodb:casbah-gridfs_2.10:2.6.1
View gist:5242740
diff --git a/framework/src/play/src/main/scala/play/api/controllers/Assets.scala b/framework/src/play/src/main/scala/play/api/controllers/Assets.scala
index 18ef4cb..9649c5a 100644
--- a/framework/src/play/src/main/scala/play/api/controllers/Assets.scala
+++ b/framework/src/play/src/main/scala/play/api/controllers/Assets.scala
@@ -64,6 +64,7 @@ class AssetsBuilder extends Controller {
* @param file the file part extracted from the URL
*/
def at(path: String, file: String): Action[AnyContent] = Action { request =>
+ val now = System.currentTimeMillis()
// -- LastModified handling
@manuelbernhardt
manuelbernhardt / gist:3673622
Created Sep 8, 2012
WS UTF-8 bug workaround
View gist:3673622
def fetchList(): String = WS.url(SCHEMA_REPO + "/schema-repository.xml").get().await(5, TimeUnit.SECONDS).fold(
{ t: Throwable => log.error("Could not retrieve schema list", t); "" },
{ r: Response => r.getAHCResponse.getResponseBody("UTF-8") }
)
You can’t perform that action at this time.