Skip to content

Instantly share code, notes, and snippets.

View jannylund's full-sized avatar

Jan Nylund jannylund

View GitHub Profile
public class DatabaseTest {
public static FakeApplication app;
public static DdlGenerator ddl;
public static EbeanServer server;
@BeforeClass
public static void initialize() {
/* Start fakeapplication with default in memory db. */
Map<String, String> config = new HashMap<String, String>(Helpers.inMemoryDatabase());
$ cat conf/routes
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Home page
GET / controllers.Application.index()
GET /noflash controllers.Application.indexNoFlash()
# Map static resources from the /public folder to the /assets URL path
# Upstart script for a play application that binds to an unprivileged user.
# put this into a file like /etc/init/play.conf
#
# This could be the foundation for pushing play apps to the server using something like git-deploy
# By calling service play stop in the restart command and play-start in the restart command.
#
# Usage:
# start play
# stop play
# restart play
@(elements: views.html.helper.FieldElements)
<div class="form-group @elements.args.get('_class) @if(elements.hasErrors) {has-error}" id="@elements.args.get('_id).getOrElse(elements.id + "_field")">
<label for="@elements.id" class="col-lg-2 control-label">@elements.label(elements.lang)</label>
<div class="col-lg-10">
@elements.input
@if(!elements.errors.isEmpty) {
<span class="help-inline">@elements.errors(elements.lang).mkString(", ")</span>
} else {
<span class="help-block">@elements.infos(elements.lang).mkString(", ")</span>
<!-- Main hero unit for a primary marketing message or call to action -->
<div class="hero-unit">
<h1>Passbook: Infra-structure</h1>
<p>Your company can have passbook too.</p>
<p><a href="#" class="btn btn-primary btn-large">Learn more &raquo;</a></p>
</div>
<!-- Example row of columns -->
@jannylund
jannylund / 1.sql
Created April 16, 2014 14:13
Play Framework - Example on how to use @OneToMany with Ebean
# --- Created by Ebean DDL
# To stop Ebean DDL generation, remove this comment and start using Evolutions
# --- !Ups
create table relation (
id bigint not null,
user_id bigint,
constraint pk_relation primary key (id))
;
@jannylund
jannylund / ublock rules for di.se
Created March 4, 2016 10:50
Get rid of adblocker ad on di.se
di.se##.blockerwrap
di.se##.header_overlay_modal
login.di.se/assets/adblk.js
@jannylund
jannylund / Vagrantfile
Last active March 9, 2016 08:41
rpm for sbt-native-packaging
Vagrant.configure(2) do |config|
config.vm.box = "bento/centos-7.1"
config.vm.network "forwarded_port", guest: 9000, host: 9000
config.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 1
end
# Generic setup
final Config conf = ConfigFactory.parseFile(new File("conf/application.test.conf"));
final Configuration testConfiguration = new Configuration(conf);
@jannylund
jannylund / 00-readme.md
Last active January 15, 2017 20:28
node-red flow for Ilmatieteenlaitos.

node-red flow for fetching future data from Ilmatieteenlaitos.

Inspired by https://gist.github.com/el2ro/f11f9c488df72286fbe4fe62f070e273

Basically, this does the same thing, but using node-red functions and storing to influx.

Steps in node-red:

  1. Timer that triggers once per x minutes.
  2. Function node generating url (01-generate-fmi-url.js)