Skip to content

Instantly share code, notes, and snippets.

@brikis98
brikis98 / Cache.scala
Created June 22, 2013 21:57
A quick hack to wrap Google Guava's cache with a slightly more scala-friendly API. The main goal is to have a getOrElseUpdate method that is actually thread safe, unlike the one on Scala's ConcurrentMap.
package com.linkedin.playplugins.common.util
import com.google.common.cache.{Cache => GuavaCache, CacheBuilder}
import play.api.Configuration
import Cache._
import java.util.concurrent.Callable
/**
* A Scala wrapper for a Google Guava cache. Exposes the basic underlying methods of a Guava cache and adds a
* getOrElseUpdate(key, value) method that lazily evaluates the value parameter only if the key is not already present
@alvinj
alvinj / sbtmkdirs.sh
Last active January 24, 2024 19:39
A shell script to create an SBT project directory structure
#!/bin/bash
#------------------------------------------------------------------------------
# Name: sbtmkdirs
# Version: 1.5
# Purpose: Create an SBT project directory structure with a few simple options.
# Author: Alvin Alexander, http://alvinalexander.com
# License: Creative Commons Attribution-ShareAlike 2.5 Generic
# http://creativecommons.org/licenses/by-sa/2.5/
#------------------------------------------------------------------------------