Skip to content

Instantly share code, notes, and snippets.

@Shiti
Shiti / fileUploadExample.scala
Last active December 10, 2015 09:29
Example function to handle a form with image and other fields in Play Scala
def addProfile = Action(parse.multipartFormData) {
request =>
val formData = (request.body).asFormUrlEncoded
val email = formData.get("email").get(0)
val name = formData.get("name").get(0)
val userId = User.create(User(email, name))
request.body.file("displayPic").map {
picture =>
val fileName = businessId
val path="/socialize/user/"
@Shiti
Shiti / TestConfig.jstd
Created December 12, 2012 13:49
JSTestDriver Configuration File
load:
- path/to/jquery-1.8.3.js
- path/to/jasmine-1.1.0.js
- path/to/JasmineAdapter-1.1.2.js
- path/to/angular.js
- path/to/angular-resource.js
- path/to/angular-mocks.js
- path/to/app,models and controllers
test:
- path/to/testfile.js
@Shiti
Shiti / dragNResize.js
Created October 1, 2012 18:51
jQuery UI draggable() and resizable() on an image
$('img').load(function(evt){
$('.drag').resizable()
$('.ui-wrapper').draggable();
});