On Friday, May 1st, I was moving to a new apartment with a big ol’ U-Haul truck. On Saturday, May 2nd, I was at Techcrunch Disrupt for the hackathon, aiming to win. And win we did.

Earlier that morning, Jeff and I discussed some potential ideas over coffee, omelettes, and flapjacks. We came down to one: create a timesheet automatically by scanning your sent e-mails and evaluating your past meeting invites. Some people know how infuriating it can be to create a timesheet for clients, because if you don’t log your time immediately, you can forget what you spent the time doing in the first place. So, this was a hack to solve that problem.

One line I was sort of OK to wait in.

When we started, I was already physically exhausted, but my brain was still fresh, and I was ready to rip. Because we were a small team of three, we knew we had to make something with a reasonable scope.

Max productivity!

We hacked and hacked, as those who hack are wont to do. And this is the rest of the story in pictures:

Get excited because we’re going to make a heatmap with Python Pandas and Google Maps JavaScript API V3. I’m assuming the audience has plenty of previous knowledge in Python, Pandas, and some HTML/CSS/JavaScript. Let’s begin with the DataFrame.

The DataFrame

First, you’re going to need a dataframe of “addresses” (can be a physical address, or even just a country name, like USA) that you eventually want to plot. (For the sake of simplicity, I’ll try to refer to the “address” as the “geo” for the rest of this document.) Second, since you are planning on using a heatmap, you’re going to want some sort of number that represents the weighted value of that row in comparison to other rows.

Now you have a list of geos and some values to use as the weight when later creating the heatmap. But to plot these points, you’re going to need some lat and long coordinates.

Getting Lat Long Coordinates from Google Maps API

If you have a list of geos or “addresses,” you can use Geocoding to convert those geos into lat/long coordinates. From Google: “Geocoding is the process of converting addresses (like “1600 Amphitheatre Parkway, Mountain View, CA”) into geographic coordinates (like latitude 37.423021 and longitude -122.083739), which you can use to place markers on a map, or position the map.”

To use this Google Maps service, you need to have a Google Maps API key. To get a key, you can follow the directions here. When you sign up for an API key, you should select “Server Side Key,” since we will be running a Python script server-side to access the Google Maps API.

Once you have your api_key, you can work on getting geocoded results for all of your geos. You can do this with the following code:

import requests
# set your google maps api key here.
google_maps_api_key = ''
# get the list of countries from our DataFrame.
countries = grouped_country_df.index
for country in countries:
# make request to google_maps api and store as json. pass in the geo name to the address
# query string parameter.
url ='https://maps.googleapis.com/maps/api/geocode/json?address={}&amp;key={}'\
.format(country, google_maps_api_key)
r = requests.get(url).json()
# Get lat and long from response. "location" contains the geocoded lat/long value.
# For normal address lookups, this field is typically the most important.
# https://developers.google.com/maps/documentation/geocoding/#JSON
lat = r['results'][0]['geometry']['location']['lat']
lng = r['results'][0]['geometry']['location']['lng']

This only gets you so far, since you still need to do something with those latitude and longitude coordinates. We have a few options here:

If you are building a web application, you can pass those values into an HTML template as variables and they will end up getting plotted via JavaScript.

We can print out the format of the JavaScript, and later past it into our HTML file within script tags.

Other approaches that I’m not going to talk about.

For the sake of time, I’m going to show #2, which lends itself to a one-off analysis. You’d probably want to go with some dynamic templating approach, like #1, if you are going to pull and plot the same data repeatedly.

Add the following code to your for-loop from above, right underneath

lng = r['results'][0]['geometry']['location']['lng']

# set the country weight for later. by getting the value for each index in the dataframe
# as it loops through.
country_weight = int(grouped_country_df.ix[country])
# print out the Javascript that we will be copy-pasting into our HTML file
print '{location: new google.maps.LatLng(%s, %s), weight: %s},' % (lat, lng, country_weight)

After running your script, copy the output, which should look like this:

Creating an HTML file that contains Javascript for Plotting your Lat Long Points.

You need to create an HTML file that contains some script tags within it. I am simply going to paste my code below with annotations. If you copy the location strings from above, you will be able to paste them directly into this HTML file under the “heatmapData” array (defined below in the code).

Shoulder surgery is kind of like getting drilled in the face with a wine opener. The only major differences are 1) the location of the drilling, and, 2) in the event of drilling your face, you’d probably die, but in the case of your shoulder, you will want to die.

OK, it’s not that bad, but it can be if you don’t have strong enough pain medication (more on that later).

I’ll break this down into a few sections for readability, which should allow you read whatever you care about (assuming you care about something).

Background of the Injury

I’m skiing with my dad and a few of our French friends in Zermatt; you can’t see much, especially not the Matterhorn. We are in shin/knee-deep powder and I come to a stop, but become slightly unbalanced and am barely standing, with the majority of my weight resting on my pole. My friend sees this and pushes me over. Annoyed, I stand back up and realize that I’m not going to push him over because he is ready for it, standing on two skis — he is also 200-220 lbs and about 6’4. So I decide to pick him up, because that’s obviously the better idea.

I wrap my arms around his legs at a very awkward angle and pull with all of my might. (Imagine standing on skis or rollerblades, rotating your torso 90 degrees to the right, and then lifting lots of weight.) What might happen is your shoulder will make a popping sound and have a minor dislocation. You might then say something like, “dang, my shoulder feels weird. I wonder if I dislocated it.” And that was me. With anterior and posterior tears to my labrum, I skied the following day with one pole; I probably should have put it in a sling.

How I Got to Surgery

The decision or path to surgery was not direct. For the first couple weeks after the injury, I had a lot of pain with overhead and behind-the-back motion. And at first, I was hoping my shoulder would just heal itself, like Wolverine. But after minimal improvements in those first weeks, I scheduled an appointment with my general doctor. He said to take it easy and come back in 2 weeks if there were no improvements.

I came back, then I got an Xray. Then I did PT. Then it still hurt. Then I went back to my Dr. Then I got referred to a specialist. Then the specialist said I should get an arthrogram MRI. Then I got the MRI. Then I went back to the specialist and he told me that my labrum was torn. Then I was sad.

By the time I decided I would get the surgery, it was June; 4 months has passed since I first injured myself. I had good range of motion again, but still couldn’t bench press or do anything overhead without pain. So I decided to go for it.

Pre-Operation

I showed up at the hospital 2 hours before surgery. The asked me to fast — no food or drink after 12 am the night before. Wondering why you fast? It’s because they don’t want you to throw up food and react poorly to the anesthesia. You don’t want complications when you’re knocked out, apparently.

Before they put me to bed, I noticed there were at least seven people in the operating room with me. The nerve block had already been administered by then, in addition to some form of valium. One of the last things I remember was the burning sting of the anesthesia coursing through my veins. And then I lost consciousness.

Post-Operation — At the Hospital (sucks)

Two hours later, I’m awake in the post-op room. People ask me how I am. I’m fine, except incredibly thirsty. I can also see that I am now in a sling. My vitals machine kept going off because of my shallow breathing. I said it was bullshit because I was sitting there intentionally taking deep breaths the whole time, just trying to get the machine to stop. (Of course I know better than the machine when I’m still wrecked from anesthesia.)

I’m only smiling because I don’t feel any pain, yet.

Once deemed ready to move to the next stage, they send me to the nurse room. In short: all of the nurses sucked, but they were nice. I was able to retrieve my clothes, and needed to put my shirt back on. A couple nurses tried to help me get my shirt back on, but in the process, my arm fell out of the sling and was hanging in the middle of space. So here I am standing in the middle of the nurse’s room with my shirt off and my arm dead between my arms. Fantastic.

When the Nerve Block Wears Off (Day 1)

I got home and started eating cookies, because I could. Around 9 p.m., the nerve block was wearing off, and I started to take my prescribed oxycodone. Around 1:30 a.m. I laid down in my bed.

And then I started to cry. The pain was unbelievable and continued to worsen. I had already taken more than the prescribed dosage of my painkillers, and based on the recommendations, should not have taken another pill for an hour or two. Around 2 a.m. I couldn’t take it any more. This was the kind of pain that will make you feel helpless. And once you start to feel helpless, you may begin to panic. I just wanted it all to end. I was damn near ready to go to the hospital for morphine or another nerve block, or jump out my goddamned window (I preferred the first two ideas).

I called my dad who was 3,000 miles away since there was a good chance he’d still be up. While being distracted by my father and pacing around my apartment, his girlfriend called my doctor and asked questions about my pain medication, and before I knew it, my doctor was calling me at 2:30 in the morning. (I could not believe it.)

Collectively, we decided that I could take another pill. I did and then slept in our la-z-boy chair that first night. Laying down was, in a word: impossible. In two words: damned terrible.

When You Need to Travel (Day 2)

I slept for about 5 hours before waking up in pain, and I immediately popped another pill. I needed to solve this pain problem. Around 10 a.m., I called my doctor and he just told me to come in as soon as possible. I left my apartment and could barely walk. I slowly struggled my way through the streets of Manhattan for a block or two before hailing a cab. Little did I know that this was about to be the most painful cab ride of my life.

All told, me and the cabbie rode 70 blocks together. Except I was the only one who cried the whole way. You don’t realize how bad NYC’s street conditions are until you experience something like this. I now have a lot of respect for people who drive and have back problems.

I pulled myself together and made it to the doctor’s office. He had me move my arm around a little bit, and again, immediate tears.

For the record, I don’t just cry for Argentina every day; it really just hurts if your painkillers aren’t doing the job.

“Everything looks fine,” he said. And then he prescribed me a stronger dosage of painkillers. This new dosage did the job.

Watching Time Melt (Days 3-30)

The more pills you pop, the faster the seconds will slip away from you. That’s a good thing if you have undergone shoulder surgery, especially on your dominant side. My first check-in came one week later, when my stitches were removed. That was also the first day I got to take a shower, and I was elated to do so.

With all your spare time, what can you do? Well, I wanted to exercise, but pretty much everything was out. I was only allowed to walk. In the third week, I started walking the stairs of my apartment’s building. On the fourth week, I began riding a stationary bike. You can probably start riding a stationary bike as soon as there is no risk of having sweat get into an open wound and risk any sort of complications or infection. I played it safe and waited till week four, though.

Throughout the time after your surgery, your mood should look about like this (X-axis = time, Y-axis = scale of 1-10. Blue is your shoulder pain. Red is your mood.):

As you can see, you are basically going to act like a moody, drugged teenager on day one.

During this time period, you should also remember to ice. I was provided with this shoulder pack that made me feel like a superhero of sorts.

Not easy to get on by yourself.

Below are some of your available activities during this first month of gloom:

Eating chicken and making dumb faces.

Eating more stuff. Making more dumb faces.

Accepting flowers shaped like bears.

Playing with every iPhone application on the app store.

Mastering the sport known as “channel surfing.”

Around the thirtieth day, or so, I tried out my ping pong skills. I probably shouldn’t have done this, but I could not resist. Consequently, my right shoulder was pretty sore the next day from being jostled around.

Tom Hanks ain’t got shit on me.

Things You Will Learn That You Took For Granted

Having two usable hands.

If you had surgery on your dominant side, your dominant hand.

All of the things that you have [insert your age – 4] years of practice doing with your dominant hand. Two examples: 1) brushing your teeth, 2) wiping your ass.

Showers.

Putting on deodorant.

Washing your left arm.

Tying your shoes.

Tying your friends up.

Tying anything.

Cooking (This didn’t affect me, I just assume it would affect others. I hate cooking.).

Friends/Family — They are what kept me going in the first few days when it was the worst.

Pro-tips

Prior to surgery, go through your house and think about all of the things that require two hands to operate; find a substitute for them. (Can opening, bottle opening, cooking in general, laundry, etc.)

Have your shoulder surgery in a place with a warm climate (avoid hot if you can). This will allow you to only have to wear t-shirts/sandals all the damn time, which makes a huge difference. I cannot imagine trying to “bundle up.”

Buy a pair of Vans slip ons. (Or old-person velcro shoes.)

Double-check that you have friends or family before doing the surgery. If you don’t, save up a lot of money so you can pay someone to do everything for you.

There’s nothing quite like having a 4-inch needle stuck into your shoulder, and then having dye injected shortly thereafter. Actually, there is something like this, and it’s called an arthrogram MRI. And actually, there’s another thing just like this too; it’s often referred to as “owwwwwwwwwwwww (actual medical name).”

Before we get to “procedures,” let me describe the environment of the 21st-century imaging facility and waiting room. I arrive at the packed lobby; it’s 10 a.m. I glide (stumble) over to the check-in counter, and say that I’m here for an appointment. “What for?” the receptionist replied.

“For the pain I’m having on my left ass-cheek,” I said.

Just kidding; I didn’t say that, but I should have. Instead I told the truth, that I was up in this hot mess of a hell-hole for an MRI. While I was getting processed, I overheard some real gems. The man to my right was complaining about computers and Obamacare. The man to my left had a tracheostomy and sounded a bit like Darth Vader. The woman behind me had a Nokia phone with the volume set to “Level 10: Deafening.”

I finished my paperwork and sat down right under the TV. Rachel Ray was on. The worst part was that the TV was being watched.

Carrying on, I sat in the first waiting room for 20 minutes, and then in some other random waiting room for another 10 minutes, and then in some dressing room for another 15 minutes, which is where I got to put on this haute couture:

I crossed my legs because that was the regal thing to do, and that dressing room was my palace, goddamnit. Then finally, some guy knocks on the door and escorts me to the Table of Terror (TOT), the origin of the arthrogram injection(s).

The Injection(s)

Once at the TOT, a doctor starts telling me how great this is all going to be. And I know that’s impossible, because I completelyfucking hate needles. “Let’s just get it over with,” I say.

First up, local anesthesia to the shoulder area, which kinda hurts. Next, a little more anesthesia, and then, El Doctor sticks the 4-inch needle in my shoulder, which is basically brushing up against my joint. I am recoiling. The Dr. asks if it hurts. I say, “yes Mr. President.” And he hits me with some more Local A. Then he stabs me with the needle again. Whammy, I can’t feel it now.

There are other people in the room; they probably think I’m crazy at this point, but one of them is working an x-ray machine. The x-ray machine is used to get the needle properly placed at the glenohumeral joint (I Googled that). From what I can tell, the needle placement looks great, and I’m ready for the ink! Coach (the Dr.) tells me that I’m going to feel some pressure when he injects the contrast dye. I take a look at the size of the injection tube — not too bad– and I noticed that the ink was clear. For some reason, I was expecting blue — not sure why.

I look at my shoulder, and there’s a needle hanging out of it (awesome). At that moment, I wonder why anyone would ever do heroin. Then Coach goes for it and pumps me full of lead. It is hard to describe the feeling. I suspect it feels pretty shitty without the local anesthesia. I would describe it as an immense amount of pressure that you want to escape, but can’t go anywhere. It’s like a balloon being inflated, but it doesn’t have anywhere to go. And that was that (except for the part where I turned into Captain America).

The MRI

From the TOT, I was on my merry way to the Magnetic Resonance Imaging machine, a.k.a, I was on my way back to the future. I was passed off to some sweet gal from God-knows-where (because I suck at picking out accents, even when people have a strong one, like she did) hits me with the details:

Don’t move.

Don’t move.

It’s kinda loud.

Don’t move.

It’s only 35 minutes.

I acknowledge that I understand her and stand there awkwardly in my sexy blue gown, waiting for the next orders. She hands me some ear plugs, and I decide to put them in my ears. Next, she has me lay down on narrow gangplank, and then she walks to the other room. Then, the gangplank starts moving into the narrow tube of the MRI machine. “Claustrophobia, here I come,” I thought. Moments later, the machine starts clicking, and zinging, and banging, and making all sorts of noises, so many that I started thinking the whole damn Chinese National Ping Pong Team had an exclusive reservation to play their sport, right inside my head. I closed my eyes.

When the sounds finally stopped, the MRI was complete, and thirty-five minutes had elapsed.

And in that glorious silence, it became clear to me after remaining physically still for those many musical minutes that The Chinese National Ping Pong Team is actually a well-versed team of terrorizing torturers. (And I will probably think twice before playing ping pong again.)

After I left the imaging center, I walked right over to the Union Square market and got a brownie — just like the other 6-year-olds do after leaving the doctor’s office. I am twenty-seven years old.

The vastness of skiable terrain here in the Alps is matched only by the amount it subsequently impresses those visiting. You cannot ski it all in a day. You cannot ski it all in a week. Sure, you could ski all of the chairs, maybe, but a single tram ride gives you access to thousands of skiable vertical feet. Subsequently, you can find more adventure than Indiana Jones while here.

If you haven’t been to the Alps before, Swiss, French, German, Austrian or Italian, then I’ll have you know that they are large. (Large enough to pass through those 5 countries, and a few others.)

We are staying in Nendaz, which is in Switzerland. Our place is called Chalet Natacha and was rented to us by a company called Interhome. Chalet Natacha’s name reminds me of Russian girls (pretty ones). To be clear, there are no Russian women staying in our chalet. Chalet Natacha rests on a steep hill, which is actually more aptly referred to as an impenetrable fortress of a mountain. You may try to drive your car up to Chalet Natacha, but you will slide backwards, forever and always. So you park at the bottom of the hill and walk up. And we’re gonna call that exercise.

My little Russian woman loves views. In fact, this is what she offers us from the living room:

Despite the terrible view, we are still having a grandiose ol’ time. I’ve had no problems maintaing my diet from the Whole Life Challenge. Because all of Europe, especially France, Italy and Switzerland are known for their Paleo-only menu selections and their general disdain for wine, cheese and chocolate. My one major obstacle right now is that I’m supposed to be on a diet. I am basically slapping bread out of the hands that try to feed it to me. In lieu of bread, I have chosen air as my primary form of sustenance. So far I’ve lost all of my weight. I suspect I will perish shortly.

This is a joke. I’ve broken lots of my dietary restriction rules and now have “CD” (Carpe Diem) stamped on my forehead. Skiing is the name of the game here, and that’s what I came to do.

“I’ll take my skiing with some ice,

please, snowtender.”

My first day of skiing and I was questioning my equipment selection. I thought I should have brought my ice skates and Kristi Yamaguchi out there with me.

I didn’t take a lot of photos because the conditions were marginal and I was still jetlagged. When you’re jetlagged, you forget how to use cameras, duh.

Our ship capsized over the Atlantic very near the Titanic and it was quite frigid in the water. I can only say that I survived by eating others in the life raft.

Dearest Isabella,

I arrived at work yesterday and found a mysterious brown bag sitting on my desk, motionless. I resolved to investigate this paper parcel in an effort to fully realize the contents within. What I found was most disturbing. Please see Exhibit A:

Most mysterious and mischievous.

By now, you must understand my overwhelming consternation that was coursing through the veins of my living self.

Bread?

What devilish soul would impart such a gift upon me. They must know that I am not allowed even a morsel of this catastrophic carbohydrate to enter my mouth. And yet they did it anyway. Cruel (and most unusual!).

Yet I will have you know that I was not led into temptation by the flour-filled flavorful snack of the demon gods. I stood steady on my ground and passed the bag to another traveler, and perhaps their own temptations led them to damnation. I cannot say for sure. But darling Isabel, I must go to bed now.

With love,

Sir Alexander of Paleo (King of the 20 Kingdoms of Kingdoms of the North and South and East and West, 5th Lord to the Second Brother of Charles, and 19th Cousin to the Lady Mary)