Skip to content

Instantly share code, notes, and snippets.

@jswartwood
Created March 13, 2012 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jswartwood/2029218 to your computer and use it in GitHub Desktop.
Save jswartwood/2029218 to your computer and use it in GitHub Desktop.
AE Code Golf #2

Get/Set JSON in a cookie

Provide methods to store and retrieve a JSON object in a cookie named "data". The store method should stringify the JSON, and the retrieve should parse back to an object. Cookie properties include: path, domain, and expires. Properties should be somehow configurable (eg. params, a config method). All properties should have default values: path = "/", domain = ".ae.com", expires at the end of session.

Rules

Solve the "Premise".

The smaller (bytes) the code, the better; if no one can shrink further, you win! It is good form to provide a (documented) non-minified version of your code, but it isn't required.

The programming language is dev's choice; however, languages should be compared both in isolation and overall (eg. your solution may be the best PHP solution, but Ruby may best it).

Add solutions in an appropriately suffixed solve file (eg. solve.js, solve.py).

Enjoy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment