Posterous theme by Cory Watilo

A few things learned the week of March 19th

The best part about working with smart people is that you're always learning new things from them.

Here are a few things i learned form the awesome people on the Pulse web team this week.

 

1. (via @kedo): "onload" events do not bubble in the DOM. 

Solution:

http://stackoverflow.com/questions/9829580/using-backbonejs-view-what-is-the-...

 

2. (via @justinpeterman): "<button>" tags with containing a "<span>" are much easier to style than an "<input type="button">". Especially when you need to style the font.

Snippet:

<button><span>Click Me!</span></button>

http://www.w3schools.com/tags/tag_button.asp

 

3. (via @kedo) Caching 'length' in for loops is faster than calling it each time through:

 

Not Cached:

for(var i = 0; i < array.length; i++){ }

Cached:

for(var i = 0, len = array.length; i < len; i++){ }

http://www.erichynds.com/javascript/javascript-loop-performance-caching-the-l...

 

I look forward to the things i'll learn the next week. :)

 

This little piggy went wee all the way home: Exporting your Oink data

I was an avid Oink user and was saddened to see it go away. Alas, services come and go and it's all good as long as you can export your data, right? Wrong!

Oink provided a bunch of CSVs and photos in a zip. CSVs tend to be messy to work with. I needed a JSON with all the information about the places and items. Instead the information provided by the Milk team was minimal (rating, reviews, foursquare_id). They didn't even include the name of the place visited!

I had to make sense of all this data in order to eventually export the data to another service (like Evernote). So, I wrote a Python script which outputs a nicely formatted JSON of all the Oink items including locations.

Script Features

  • Exports to single JSON file
  • Includes foursquare venue info (name, lat, long, address, etc.)
  • Removes entries with no location
  • Merges comments and ratings for those available

Requirements

  • Oink export CSV (can be requested on http://oink.com)
  • Foursquare OAUTH token (see section below)
  • Python 
  • Terminal

Part 1: Get Foursqaure OAUTH Token

Part 2: Execution Instructions

  • Copy oink_export.py to same folder as your Oink CSVs
  • Open terminal to Oink CSV folder
  • Run 'python oink_export.py --token=YOUR_OAUTH_TOKEN_HERE'
  • Watch it fly through your data

Explore more here:

  

Hi I'm Filip, I work at Pulse and we're hiring