Skip to content

Instantly share code, notes, and snippets.

@cheald
Created January 21, 2012 00:04
Show Gist options
  • Save cheald/1650353 to your computer and use it in GitHub Desktop.
Save cheald/1650353 to your computer and use it in GitHub Desktop.
{completed_in:0.108 max_id:160502595486617600 max_id_str:160502595486617601 next_page:?page=2&max_id=160502595486617601&q=blue%20angels&rpp=5&include_entities=1 page:1 query:blue+angels refresh_url:?since_id=160502595486617601&q=blue%20angels&include_entities=1 results:[{created_at:"Fri, 20 Jan 2012 23:22:55 +0000" entities:{hashtags:{} urls:{} user_mentions:[{screen_name:monicaroman name:monicaroman id:12337752 id_str:12337752 indices:[012]}]} from_user:jebarrientos from_user_id:168281739 from_user_id_str:168281739 from_user_name:"Jorge E. Barrientos" geo:null id:160502595486617600 id_str:160502595486617601 iso_language_code:es metadata:{result_type:recent} profile_image_url:"http://a2.twimg.com/profile_images/1755293761/image_normal.jpg" profile_image_url_https:"https://si0.twimg.com/profile_images/1755293761/image_normal.jpg" source:"<a href="http://twitter.com/#!/download/iphone" rel="nofollow">Twitter for iPhone</a>" text:"@monicaroman lo mas seguro es que los ruidos son los Blue Angels en entrenamiento, trabajo 10 hrs manejando y no he escuchado nada raro" to_user:monicaroman to_user_id:12337752 to_user_id_str:12337752 to_user_name:monicaroman}{created_at:"Fri, 20 Jan 2012 23:20:40 +0000" entities:{hashtags:[{text:Photo indices:[28]}{text:Blue indices:[1621]}{text:Angels indices:[2229]}{text:Landing indices:[3038]}] urls:[{url:"http://t.co/qtJIDKye" expanded_url:"http://www.redgage.com/photos/rene/blue-angels-landing.html" display_url:redgage.com/photos/rene/bl… indices:[3959]}] user_mentions:{}} from_user:rdonnalson from_user_id:78296061 from_user_id_str:78296061 from_user_name:"Rene Donnalson" geo:null id:160502027640782850 id_str:160502027640782848 iso_language_code:en metadata:{result_type:recent} profile_image_url:"http://a1.twimg.com/profile_images/1304339915/P1030136_cropped_normal.jpg" profile_image_url_https:"https://si0.twimg.com/profile_images/1304339915/P1030136_cropped_normal.jpg" source:"<a href="http://www.socialoomph.com" rel="nofollow">SocialOomph</a>" text:"A #Photo of the #Blue #Angels #Landing http://t.co/qtJIDKye" to_user:null to_user_id:null to_user_id_str:null to_user_name:null}{created_at:"Fri, 20 Jan 2012 23:10:43 +0000" entities:{hashtags:{} urls:{} user_mentions:[{screen_name:MistahGeeh name:"Mista G" id:256057850 id_str:256057850 indices:[314]}]} from_user:mgzcom from_user_id:111028674 from_user_id_str:111028674 from_user_name:"Manny G" geo:null id:160499525037994000 id_str:160499525037993984 iso_language_code:nl metadata:{result_type:recent} profile_image_url:"http://a2.twimg.com/profile_images/673440849/handsonearth_normal.jpg" profile_image_url_https:"https://si0.twimg.com/profile_images/673440849/handsonearth_normal.jpg" source:"<a href="http://www.facebook.com/twitter" rel="nofollow">Facebook</a>" text:"RT @MistahGeeh: tonight inside blue angels night club.. mistah geeh and dj richie.." to_user:null to_user_id:null to_user_id_str:null to_user_name:null}{created_at:"Fri, 20 Jan 2012 23:07:20 +0000" entities:{hashtags:{} urls:[{url:"http://t.co/XlsUEueM" expanded_url:"http://bit.ly/zRFcPf" display_url:bit.ly/zRFcPf indices:[7696]}] user_mentions:{}} from_user:rarityguide from_user_id:66311623 from_user_id_str:66311623 from_user_name:RarityGuide.com geo:null id:160498675385253900 id_str:160498675385253889 iso_language_code:en metadata:{result_type:recent} profile_image_url:"http://a1.twimg.com/profile_images/367749248/iconrarg_normal.gif" profile_image_url_https:"https://si0.twimg.com/profile_images/367749248/iconrarg_normal.gif" source:"<a href="http://www.rarityguide.com/forums/" rel="nofollow">MyCollectorItems</a>" text:"CITIZEN ECO DRIVE BLUE ANGELS ATOMIC LIMITED EDITION WATCH MODEL JY0041-05L http://t.co/XlsUEueM" to_user:null to_user_id:null to_user_id_str:null to_user_name:null}{created_at:"Fri, 20 Jan 2012 23:01:03 +0000" entities:{hashtags:{} urls:{} user_mentions:{}} from_user:MistahGeeh from_user_id:256057850 from_user_id_str:256057850 from_user_name:"Mista G" geo:null id:160497094493339650 id_str:160497094493339648 iso_language_code:nl metadata:{result_type:recent} profile_image_url:"http://a2.twimg.com/profile_images/1748286912/300521_277863082231079_100000221681594_1248799_205776_n_normal.jpg" profile_image_url_https:"https://si0.twimg.com/profile_images/1748286912/300521_277863082231079_100000221681594_1248799_205776_n_normal.jpg" source:"<a href="http://www.facebook.com/twitter" rel="nofollow">Facebook</a>" text:"tonight inside blue angels night club.. mistah geeh and dj richie.." to_user:null to_user_id:null to_user_id_str:null to_user_name:null}] results_per_page:5 since_id:0 since_id_str:0}
{"completed_in":0.108,"max_id":160502595486617601,"max_id_str":"160502595486617601","next_page":"?page=2&max_id=160502595486617601&q=blue%20angels&rpp=5&include_entities=1","page":1,"query":"blue+angels","refresh_url":"?since_id=160502595486617601&q=blue%20angels&include_entities=1","results":[{"created_at":"Fri, 20 Jan 2012 23:22:55 +0000","entities":{"hashtags":[],"urls":[],"user_mentions":[{"screen_name":"monicaroman","name":"monicaroman","id":12337752,"id_str":"12337752","indices":[0,12]}]},"from_user":"jebarrientos","from_user_id":168281739,"from_user_id_str":"168281739","from_user_name":"Jorge E. Barrientos","geo":null,"id":160502595486617601,"id_str":"160502595486617601","iso_language_code":"es","metadata":{"result_type":"recent"},"profile_image_url":"http://a2.twimg.com/profile_images/1755293761/image_normal.jpg","profile_image_url_https":"https://si0.twimg.com/profile_images/1755293761/image_normal.jpg","source":"<a href="http://twitter.com/#!/download/iphone" rel="nofollow">Twitter for iPhone</a>","text":"@monicaroman lo mas seguro es que los ruidos son los Blue Angels en entrenamiento, trabajo 10 hrs manejando y no he escuchado nada raro","to_user":"monicaroman","to_user_id":12337752,"to_user_id_str":"12337752","to_user_name":"monicaroman"},{"created_at":"Fri, 20 Jan 2012 23:20:40 +0000","entities":{"hashtags":[{"text":"Photo","indices":[2,8]},{"text":"Blue","indices":[16,21]},{"text":"Angels","indices":[22,29]},{"text":"Landing","indices":[30,38]}],"urls":[{"url":"http://t.co/qtJIDKye","expanded_url":"http://www.redgage.com/photos/rene/blue-angels-landing.html","display_url":"redgage.com/photos/rene/bl\u2026","indices":[39,59]}],"user_mentions":[]},"from_user":"rdonnalson","from_user_id":78296061,"from_user_id_str":"78296061","from_user_name":"Rene Donnalson","geo":null,"id":160502027640782848,"id_str":"160502027640782848","iso_language_code":"en","metadata":{"result_type":"recent"},"profile_image_url":"http://a1.twimg.com/profile_images/1304339915/P1030136_cropped_normal.jpg","profile_image_url_https":"https://si0.twimg.com/profile_images/1304339915/P1030136_cropped_normal.jpg","source":"<a href="http://www.socialoomph.com" rel="nofollow">SocialOomph</a>","text":"A #Photo of the #Blue #Angels #Landing\thttp://t.co/qtJIDKye","to_user":null,"to_user_id":null,"to_user_id_str":null,"to_user_name":null},{"created_at":"Fri, 20 Jan 2012 23:10:43 +0000","entities":{"hashtags":[],"urls":[],"user_mentions":[{"screen_name":"MistahGeeh","name":"Mista G","id":256057850,"id_str":"256057850","indices":[3,14]}]},"from_user":"mgzcom","from_user_id":111028674,"from_user_id_str":"111028674","from_user_name":"Manny G","geo":null,"id":160499525037993984,"id_str":"160499525037993984","iso_language_code":"nl","metadata":{"result_type":"recent"},"profile_image_url":"http://a2.twimg.com/profile_images/673440849/handsonearth_normal.jpg","profile_image_url_https":"https://si0.twimg.com/profile_images/673440849/handsonearth_normal.jpg","source":"<a href="http://www.facebook.com/twitter" rel="nofollow">Facebook</a>","text":"RT @MistahGeeh: tonight inside blue angels night club.. mistah geeh and dj richie..","to_user":null,"to_user_id":null,"to_user_id_str":null,"to_user_name":null},{"created_at":"Fri, 20 Jan 2012 23:07:20 +0000","entities":{"hashtags":[],"urls":[{"url":"http://t.co/XlsUEueM","expanded_url":"http://bit.ly/zRFcPf","display_url":"bit.ly/zRFcPf","indices":[76,96]}],"user_mentions":[]},"from_user":"rarityguide","from_user_id":66311623,"from_user_id_str":"66311623","from_user_name":"RarityGuide.com","geo":null,"id":160498675385253889,"id_str":"160498675385253889","iso_language_code":"en","metadata":{"result_type":"recent"},"profile_image_url":"http://a1.twimg.com/profile_images/367749248/iconrarg_normal.gif","profile_image_url_https":"https://si0.twimg.com/profile_images/367749248/iconrarg_normal.gif","source":"<a href="http://www.rarityguide.com/forums/" rel="nofollow">MyCollectorItems</a>","text":"CITIZEN ECO DRIVE BLUE ANGELS ATOMIC LIMITED EDITION WATCH MODEL JY0041-05L http://t.co/XlsUEueM","to_user":null,"to_user_id":null,"to_user_id_str":null,"to_user_name":null},{"created_at":"Fri, 20 Jan 2012 23:01:03 +0000","entities":{"hashtags":[],"urls":[],"user_mentions":[]},"from_user":"MistahGeeh","from_user_id":256057850,"from_user_id_str":"256057850","from_user_name":"Mista G","geo":null,"id":160497094493339648,"id_str":"160497094493339648","iso_language_code":"nl","metadata":{"result_type":"recent"},"profile_image_url":"http://a2.twimg.com/profile_images/1748286912/300521_277863082231079_100000221681594_1248799_205776_n_normal.jpg","profile_image_url_https":"https://si0.twimg.com/profile_images/1748286912/300521_277863082231079_100000221681594_1248799_205776_n_normal.jpg","source":"<a href="http://www.facebook.com/twitter" rel="nofollow">Facebook</a>","text":"tonight inside blue angels night club.. mistah geeh and dj richie..","to_user":null,"to_user_id":null,"to_user_id_str":null,"to_user_name":null}],"results_per_page":5,"since_id":0,"since_id_str":"0"}
## Coffeescript to serialize to "compacted JSON"
serializeJson = (d) ->
str = ""
if d == null
str += "null"
else if typeof d == "object" and d.length # array
console.log "Got an array!", d
str += "["
str += serializeJson(elem) for elem in d
str += "]"
else if typeof d == "object"
str += "{"
out = []
for k, v of d
out.push serializeJson(k) + ":" + serializeJson(v)
str += out.join(" ")
str += "}"
else if typeof d == "number"
str += d
else if d.match(/[: \}\]]/)
str += '"' + d + '"'
else
str += d
str
[chris@luna repos]$ ll *.json
-rwxr--r--. 1 chris chris 4792 Jan 20 17:00 compact.json
-rwxr--r--. 1 chris chris 5206 Jan 20 17:00 orig.json
[chris@luna repos]$ gzip *.json
[chris@luna repos]$ ll *.json.gz
-rwxr--r--. 1 chris chris 1450 Jan 20 17:00 compact.json.gz
-rwxr--r--. 1 chris chris 1499 Jan 20 17:00 orig.json.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment