Skip to content

Instantly share code, notes, and snippets.

View dsugden's full-sized avatar

Dave Sugden dsugden

  • Shopify
  • Gatineau
View GitHub Profile
@knutwalker
knutwalker / FromMap.scala
Last active April 12, 2020 15:21
Converting Map[String,Any] to a case class using Shapeless - http://stackoverflow.com/q/31640565/2996265
/*
* Based on http://stackoverflow.com/a/31641779/2996265
*
* Changed:
* - use https://github.com/knutwalker/validation to accumulate errors
* - support lists as well (polymorphic on higher kinds would be better, though)
* - use -Xexperimental for java8 style SAM support
*/
@RadoBuransky
RadoBuransky / dist-play-app-initd
Last active March 24, 2020 20:26
Init.d shell script for Play framework distributed application. Provides start, stop, restart and status commands to control applications packaged using standard "play dist" packaging command.
#!/bin/bash
#
# =========================================================================
# Copyright 2014 Rado Buransky, Dominion Marine Media
#
# 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
@Mortimerp9
Mortimerp9 / readerwithtooling.scala
Created April 14, 2013 22:14
An implementation of the Reader Monad in scala, with correct type variance and some implicit utils to simplify the daily use of Readers, In particular with Future.
/**
* A monad to abstract dependencies in the code, see https://coderwall.com/p/kh_z5g
*/
object Reader {
/**
* an implicit to convert a function A => B in a Reader[A, B]
*/
implicit def reader[C, R](block: C => R): Reader[C, R] = Reader(block)