Skip to content

Instantly share code, notes, and snippets.

package plugins;
import play.PlayPlugin;
import play.mvc.Http;
import play.mvc.Http.Request;
import play.mvc.Http.Response;
import play.mvc.Router.Route;
import play.vfs.VirtualFile;
import util.MetricsUtil;
@Rodolfocartas
Rodolfocartas / Info.plist
Created June 12, 2014 13:45
Make JasperStudio run on jdk 7 on Mavericks
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>Jaspersoft Studio Professional</string>
<key>CFBundleGetInfoString</key>
<string>Eclipse 3.8 for Mac OS X, Copyright IBM Corp. and others 2002, 2011. All rights reserved.</string>
<key>CFBundleIconFile</key>
@Rodolfocartas
Rodolfocartas / gist:8561062
Created January 22, 2014 15:45
Java fix for mac os x mavericks
<key>JVMCapabilities</key>
<array>
<string>JNI</string>
<string>BundledApp</string>
<string>WebStart</string>
<string>Applets</string>
<string>CommandLine</string>
</array>
@Rodolfocartas
Rodolfocartas / play.plist
Created May 27, 2013 22:05
Launchd file to start Play Framework 1.x.x project as a daemon in Mac OS X.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>mx.blimp.infinitoServer</string>
<key>ProgramArguments</key>
<array>
<string>/Users/rodolfo/java/play-1.2.4/play</string>
<string>run</string>
@Rodolfocartas
Rodolfocartas / Test.h
Created December 6, 2012 23:17 — forked from siannopollo/Test.h
Bootstrap a CoreData test class
#import <SenTestingKit/SenTestingKit.h>
#import <CoreData/CoreData.h>
@interface Test : SenTestCase {
NSManagedObjectModel *model;
NSPersistentStoreCoordinator *coordinator;
NSManagedObjectContext *context;
}
- (NSString *)applicationSupportDirectory;
@Rodolfocartas
Rodolfocartas / remove_diacritics.js
Created November 20, 2012 01:52 — forked from yeah/remove_diacritics.js
Remove diacritics (Umlauts, Accents, Special characters) in JavaScript
var diacriticsMap = [
{'base':'A', 'letters':/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},
{'base':'AA','letters':/[\uA732]/g},
{'base':'AE','letters':/[\u00C4\u00C6\u01FC\u01E2]/g},
{'base':'AO','letters':/[\uA734]/g},
{'base':'AU','letters':/[\uA736]/g},
{'base':'AV','letters':/[\uA738\uA73A]/g},
{'base':'AY','letters':/[\uA73C]/g},
{'base':'B', 'letters':/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},
{'base':'C', 'letters':/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},
@Rodolfocartas
Rodolfocartas / play.conf
Created October 19, 2012 15:10 — forked from leon/play.conf
Upstart script for Play Framework 2.0
# 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
@Rodolfocartas
Rodolfocartas / playframework
Created October 19, 2012 15:00 — forked from domdorn/playframework
Upstart Script for the PlayFramework 1.x
# Upstart script for a play application that binds to an unprivileged user.
# put this into a file like /etc/init/playframework
# you can then start/stop it using either initctl or start/stop/restart
# e.g.
# start playframework
# http://dominikdorn.com
description "Description of your app"
author "Dominik Dorn <[email protected]>"
version "1.0"
@Rodolfocartas
Rodolfocartas / Application.java
Created May 22, 2012 20:12 — forked from fehmicansaglam/Application.java
Accept range header and write a partial content to the response with Play! Framework.
public static void downloadFile(final Long fileId) throws IOException {
response.setHeader("Accept-Ranges", "bytes");
notFoundIfNull(fileId);
File underlyingFile = ... //load file
String fileName = ...//name of the file
Header rangeHeader = request.headers.get("range");
if (rangeHeader != null) {
throw new PartialContent(underlyingFile, fileName);