Skip to content

Instantly share code, notes, and snippets.

View mkurz's full-sized avatar
💭
Play Roadmap: https://github.com/orgs/playframework/projects/3

Matthias Kurz mkurz

💭
Play Roadmap: https://github.com/orgs/playframework/projects/3
  • Vienna, Austria
  • 04:51 (UTC +02:00)
View GitHub Profile
@vr100
vr100 / gist:81b37e89e9688d2ad02d
Created December 5, 2014 12:38
String and timestamp support in evolutions for play framework
/**
* Read evolution files from the application environment.
*/
@Singleton
class EvolutionsReader @Inject() (environment: Environment) {
/**
* Read the application evolutions.
*
* @param db the database name
@huljas
huljas / PrintSchemaUpdate.java
Created February 12, 2011 19:45
Example on how you could use Hibernate schema update when creating database migrations for play applications.
package play.modules.migrate;
import org.hibernate.dialect.MySQL5Dialect;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.tool.hbm2ddl.DatabaseMetadata;
import play.Play;
import play.db.DB;
import play.db.DBPlugin;
import play.utils.Utils;
@xuwei-k
xuwei-k / PlayMini.scala
Last active February 20, 2016 13:14
came back play mini!
#!/usr/bin/env scalas
/***
scalaVersion := "2.11.7"
libraryDependencies += "com.typesafe.play" %% "play-netty-server" % "2.4.6"
*/
import play.core.server._
import play.api.routing.sird._
import play.api.mvc._
@Jach
Jach / mig.py
Created December 30, 2011 04:09
Dirty migration script from Jira issues to Github issues
'''
Steps:
1. Create any milestones
2. Create any labels
3. Create each issue, linking them to milestones and labels
3.1: Update status for new issue if closed
4: Create all the comments for each issue
'''
import getpass
import json
@fxthomas
fxthomas / Advanced-settings.md
Last active August 3, 2016 09:17
SBTEclipse wiki entry about changing project description files

Changing project files

Eclipse .project and .classpath files are XML files, and you can hook into sbteclipse's generation process by using the classpathTransformerFactories and projectTransformerFactories setting keys.

(The following Scala samples should be inside your project's Build.scala file, or a plugin)

Let's say we want to add the com.example.nature nature to our project. The

package build
import java.net.InetSocketAddress
import play.sbt.PlayRunHook
import sbt._
object ProcessRunHookBuilder {
def apply(
base: File,
before: Option[String] = None,
package modules
import java.io.{FileInputStream, InputStream}
import javax.inject.{Inject, Provider, Singleton}
import play.api.db.DBApi
import play.api.{Configuration, Environment}
//import play.Environment
import play.api.db.evolutions._
import play.api.inject.{Injector, Module}
@Ciantic
Ciantic / JooqModule.scala
Last active September 11, 2017 16:57
injection with DB.getConnection fails
import javax.inject.{Singleton, Inject}
import com.google.inject.AbstractModule
import play.api.db.{DBApi}
import play.api.{Logger, Configuration}
import org.jooq.util.GenerationTool
import org.jooq.util.jaxb.{Target, Database, Generator}
import play.api.db.evolutions.EvolutionsModule
import play.api.Play.current
@stopher
stopher / ByteRangeRequestsController.java
Last active December 7, 2017 16:40
Byte range requests in Play 2 Java Controllers. Eg. for serving MP4 video files to iPhone etc.
public class ByteRangeRequestsController extends Controller {
// 206 Partial content Byte range requests
private static Result stream(long start, long length, File file) throws IOException {
FileInputStream fis = new FileInputStream(file);
fis.skip(start);
response().setContentType(MimeTypes.forExtension("mp4").get());
response().setHeader(CONTENT_LENGTH, ((length - start) +1l)+"");
response().setHeader(CONTENT_RANGE, String.format("bytes %d-%d/%d", start, length,file.length()));
@brianherman
brianherman / jessie-mssql.md
Last active June 15, 2018 19:00
Debian Jessie and mssql-server

Download mssql from the microsoft website.

wget https://packages.microsoft.com/ubuntu/16.04/mssql-server/pool/main/m/mssql-server/mssql-server_14.0.1.246-6_amd64.deb

dpkg -i mssql-server_14.0.1.246-6_amd64.deb 

The next command will install dependancies.

sudo apt-get -f install