Skip to content

Instantly share code, notes, and snippets.

@hornbeck
Created October 29, 2008 12:50
Show Gist options
  • Save hornbeck/20685 to your computer and use it in GitHub Desktop.
Save hornbeck/20685 to your computer and use it in GitHub Desktop.
96> Records = todo:get_todos().
[#todo{status = "moose",description = "cow"},
#todo{status = "sleepy",
description = "really need to go to bed"},
#todo{status = "upbeat",description = "going to get coffee"},
#todo{status = undefined,description = undefined},
#todo{status = today,description = "find my shoes"},
#todo{status = urgent,description = "Buy soap"},
#todo{status = "test",description = "this is a test"},
#todo{status = "tired",description = "going to bed"}]
97> Todos = [{X#todo.status, X#todo.description} || X <- Records].
[{"moose","cow"},
{"sleepy","really need to go to bed"},
{"upbeat","going to get coffee"},
{undefined,undefined},
{today,"find my shoes"},
{urgent,"Buy soap"},
{"test","this is a test"},
{"tired","going to bed"}]
98> list_to_binary(mochijson2:encode({struct, Todos})).
<<"{\"moose\":[99,111,119],\"sleepy\":[114,101,97,108,108,121,32,110,101,101,100,32,116,111,32,103,111,32,116,111,32,98,101"...>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment