Skip to content

Instantly share code, notes, and snippets.

View michalzubkowicz's full-sized avatar

Michał Zubkowicz michalzubkowicz

View GitHub Profile
package controllers;
public class Application extends Controller {
// in cache during 1800 seconds (30 min)
@Cached(key = "pagingList", duration = 1800)
public static Result index(Integer page) {
String uuid = session("uuid");
if (uuid == null) {
uuid = java.util.UUID.randomUUID().toString();
@michalzubkowicz
michalzubkowicz / dirtyflag
Created June 28, 2013 13:44
Knockout Dirty Flag
this.dirtyFlag = ko.dirtyFlag(this);
ko.dirtyFlag = function(root) {
var _isDirty = ko.observable(false);
var result = ko.computed(function() {
if (!_isDirty()) {
ko.toJS(root); //just for subscriptions
}
@michalzubkowicz
michalzubkowicz / new_gist_file
Created June 20, 2013 13:53
Javascript location
Whole url:
window.location.href
Path:
window.location.pathname
@michalzubkowicz
michalzubkowicz / upload
Created June 17, 2013 11:28
Upload przez iframe
<html>
<script language="Javascript">
function fileUpload(form, action_url, div_id) {
// Create the iframe...
var iframe = document.createElement("iframe");
iframe.setAttribute("id", "upload_iframe");
iframe.setAttribute("name", "upload_iframe");
iframe.setAttribute("width", "0");
iframe.setAttribute("height", "0");