Skip to content

Instantly share code, notes, and snippets.

View jeroenr's full-sized avatar

Jeroen Rosenberg jeroenr

View GitHub Profile
groups:
- name: datetime
rules:
- record: daily_saving_time_belgium
expr: |
(vector(0) and (month() < 3 or month() > 10))
or
(vector(1) and (month() > 3 and month() < 10))
or
(
@ConnorDoyle
ConnorDoyle / ReflectionHelpersSnippet.scala
Last active January 26, 2022 20:00
Generic reflective case class instantiation with Scala 2.10.x
package test
import scala.reflect.runtime.universe._
object ReflectionHelpers extends ReflectionHelpers
trait ReflectionHelpers {
protected val classLoaderMirror = runtimeMirror(getClass.getClassLoader)
@jroper
jroper / Global.scala
Last active December 20, 2015 19:38
Transparent HEAD request handling in Play 2.1. Note that it may be more efficient to implement HEAD support in an action directly, as this may avoid unnecessary opening of resources or rendering things.
import play.api.libs.iteratee.{Done, Iteratee, Enumerator}
import play.api.mvc._
import play.api._
import play.api.libs.concurrent.Execution.Implicits._
object Global extends GlobalSettings {
override def onRouteRequest(req: RequestHeader) = {
// Lookup handler
super.onRouteRequest(req) match {
@yctay
yctay / figaro-capistrano.rb
Created April 30, 2013 05:34
Capistrano recipe for deploying figaro's application.yml
namespace :figaro do
desc "SCP transfer figaro configuration to the shared folder"
task :setup do
transfer :up, "config/application.yml", "#{shared_path}/application.yml", :via => :scp
end
desc "Symlink application.yml to the release path"
task :finalize do
run "ln -sf #{shared_path}/application.yml #{release_path}/config/application.yml"
end