Skip to content

Instantly share code, notes, and snippets.

@stianl
stianl / gist:5590899
Created May 16, 2013 10:52
Debugging language detection in Play framework on Heroku
public static Result acceptedLanguages() throws IOException {
Map<String, Object> stuff = new HashMap<>();
stuff.put("profilepage.profile.button.connect", Messages.get("profilepage.profile.button.connect"));
stuff.put("acceptedLanguages header", request().headers().containsKey("Accept-Language")?request().headers().get("Accept-Language")[0]:"non-existant");
stuff.put("play.mvc.Http.Context.current().request().cookies()", Http.Context.current().request().cookies());
List<Lang> availables = Lang.availables();
Collection<Locale> transform = Collections2.transform(availables, new Function<Lang, Locale>() {
@Override
public Locale apply(Lang lang) {
return lang.toLocale();
@stianl
stianl / continous-qunit.ps1
Created October 16, 2012 13:53 — forked from jfromaniello/continous-qunit.ps1
Since less doesn't include a --watch option, and the only options I found was with ruby watchr+shell scripting I modified this Powershell script that continuously watch for file changes in a directory, and compiles less file
# watch a file changes in the current directory,
# compiles bootstrap.less
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = get-location
$watcher.IncludeSubdirectories = $true
$watcher.EnableRaisingEvents = $false
$watcher.NotifyFilter = [System.IO.NotifyFilters]::LastWrite -bor [System.IO.NotifyFilters]::FileName
while($TRUE){