Skip to content

Instantly share code, notes, and snippets.

View axelhzf's full-sized avatar

Axel Hernández Ferrera axelhzf

View GitHub Profile
@mikeobrien
mikeobrien / app.coffee
Created February 21, 2012 04:49
Lazy loading backbone collection + infinite scrolling
class LazyCollection extends Backbone.Collection
indexQuerystring: 'index'
index: 1
lastLength: 0
fetch: (options) ->
options or= {}
if options.reset
@index = 1
@lastLength = 0
else
@briannesbitt
briannesbitt / ParseSesion
Created September 17, 2011 15:01
Decode the PLAY_SESSION cookie in a functional test
static Pattern sessionParser = Pattern.compile("\u0000([^:]*):([^\u0000]*)\u0000");
static final String TS_KEY = "___TS";
private Scope.Session parseSession(String sessionCookieValue) throws UnsupportedEncodingException
{
Scope.Session session = new Scope.Session();
if (sessionCookieValue != null && !sessionCookieValue.trim().equals(""))
{
String sign = sessionCookieValue.substring(0, sessionCookieValue.indexOf("-"));