I recently took a trip up to Toronto, Ontario on short notice for work. Since I didn’t have a lot of time I didn’t plan anything for my mobile phone and ended up just turning it off while I was there. This ended up being a really interesting unintended experiment for me of temporarily getting off of the “always connected” lifestyle I’ve come to know.

The first couple days it was weird. I felt like I was missing stuff and just felt a general discomfort with the situation. I was suddenly aware of how often I use my Google Maps and Yelp. Especially being in a new city. Perhaps the most noticeable change for me, though, was my tiny down times throughout the day when I would pull out my phone but have nothing to do on it anymore. Waiting in line, waiting for a friend to finish in the bath room, etc were no longer moments to check in to my online world. This left me feeling disconnected, frustrated, and a general sense of missing something or being out of touch.

It wasn’t long though (probably around day 3) that I found myself actually enjoying it. I found that without the ability to always use GPS and Maps I actually learned my way around the city much faster than usual (and I am definitely geographically challenged). I found myself using my short down times to actively think about my mental backlog and pay attention to my surroundings. I definitely felt like I got more out of my short trip to Toronto than I have from other similar trips in the past. But the biggest and best change I noticed was an appreciation for not being constantly interrupted throughout my day. No more Facebook links being shared or Meetup comments or any of the other junk that comes streaming my way throughout the day. This was something I greatly appreciated by the end of my trip.

Its worth mentioning that I never complained (or really actively considered) any of these issues before. It has been a slow change over time that I never really realized had happened. But the abrupt change to zero was very interesting.

I don’t plan to turn off my phone in general now that I’m back. It is an amazing tool and being with out it gave me a new appreciation for how life changing the mobile revolution has been. It did make me decide to be a little more strict on which apps can notify me and how I use my micro downtime throughout the day. I also think it will change how I vacation and I will actively try to eliminate my interruptions when I’m off work and spending time with the wife.

If you haven’t tried disconnecting recently I would give it a go. Find a couple days and just put your phone in airplane mode or turn it off entirely. It might surprise you to see the impact being connected is having on you.

Posted in Introspective | Tagged , | Leave a comment


I’m not really a big fan of new year’s resolutions. I think it’s important to continually work on self-improvement, not hastily come up with some bold resolutions once a year. I do like the idea of new year’s day as a milestone marker, though, and a time of reflection on the previous year.

2013 was a very intense year for me. From having to fire my co-founder, to finding out my mom was diagnosed with cancer, to selling my second company and transitioning over to work at the largest company (by far) I’ve ever worked for – 2013 was definitely a year to remember. A strange mix of some of the worst moments and the best moments I’ve had in recent memory. I definitely couldn’t have predicted the way this year shaped up at the start of it.

Ultimately I see this as a good thing (even if some of the stuff I couldn’t predict wasn’t good), though. Volatility can certainly be unpleasant, but it’s also a key component to making big strides forward personally and professionally in my experience. I’ve also grown and learned A TON over the last year.

Here’s to a better 2014, hopefully one still full of opportunities to grow.

Posted in Introspective | Tagged | Comments Off


Often starting is the hardest part. Inertia is hard and the act of going from nothing to something is often the single biggest step.

I often find for myself that the ability to start new projects, adventures, or whatever, is a bit like a muscle. If you don’t use it for a while it begins to atrophy and starting new things gets tougher and tougher. However if I just force myself to be disciplined and dive into new things on a regular basis it gets easier and easier with each new thing.

So start something today, no matter how small and start building that muscle. Build a new routine that involves trying something new or starting something small regularly. It makes it a lot easier to make that difficult first step when it is really needed.

Posted in Introspective | Tagged | Leave a comment

13 JavaScript Performance Tips

Daniel Clifford recently gave a great talk at Google I/O 2012 called “Breaking the JavaScript Speed Limit with V8″. In it he goes in depth to explain 13 simple optimizations you can do in your JavaScript code to help Chrome’s V8 JavaScript engine compile / run your JavaScript code faster. In the talk he gives a lot of great explanations as to what they are and why they help, but if you just want the quick and dirty list, here goes:

  1. Initialize all object members in constructor functions
  2. Always initialize object members in the same order
  3. Prefer numeric values that can be represented as 31-bit signed integers
  4. Use contiguous keys starting at 0 for Arrays
  5. Don’t pre-allocate large Arrays (>64K elements) to their maximum size, instead grow as you go
  6. Don’t delete elements in arrays, especially numeric arrays
  7. Don’t load uninitialized or deleted elements
  8. Initialize using array literals for small fixed-sized arrays
  9. Preallocate small arrays to correct size before using them
  10. Don’t store non-numeric values (objects) in numeric arrays
  11. Prefer monomorphic over polymorphic wherever possible
  12. Don’t use try {} catch {} blocks
  13. Avoid hidden class changes in functions after they are optimized

If you have time to check out the full video and/or slides I would highly recommend it. I know I for one will check back to the list often and am trying to watch for these gotchas in my code going forward.

Posted in Javascript, Performance | Tagged , , , | Leave a comment

Torbit Insight – Measure Your Real Performance

I’m extremely excited about our latest product launch at Torbit called Torbit Insight. Insight is all about measuring the performance of your website and tying it into the business metrics you care about (conversion rate, bounce rate, etc). Up till now, the performance space has been pretty limited in ways to measure performance on your site. There are a lot of tools that do synthetic performance tests (a server in the cloud loads up your website and gives you some basic information about the performance of it), but these tools fail to measure what your real visitors are experiencing and often ignore things like caching and real world network conditions. The piece that has largely been missing is an easy way to measure the performance your actual visitors are experiencing.

Torbit Insight exists to answer this need. By adding a small asynchronous javascript snippet to your website we can measure the real timing of your website from your actual visitors. Every visitor and every pageview matters, so we make sure to sample them all. We then roll up all this data and give you a breadth of different ways to slice and dice the data. You can see full histograms, performance for different browsers, different geographic locations, and a whole lot more.

Insight Histogram
Insight Histogram
Insight Key Metrics
Insight Key Metrics

If that wasn’t enough, we also have a ton of particularly awesome real time analytics so that you can see how your website is performing for visitors on your site as it happens. There just isn’t anywhere else to get this kind of data.

Insight Realtime Map
Insight Realtime Map

I’m extremely proud of the Torbit team and all the hard work that went into the product launch. If you want to help us build awesome stuff and make the web a better place be sure to check out our jobs page – we’re hiring!

There’s a much more in depth post announcing Insight on the Torbit blog. You can sign up for free and start measuring the performance of your site today.

Posted in Performance, work | Tagged , , | 1 Comment

stop-sopa.js – along with WordPress, Blogger, and Typepad plugins

SOPA (the Stop Online Privacy Act) is a really bad thing that potentially threatens this wonderful thing we created called the internet. If you don’t already know about it I won’t rehash it all here, but you can check out this post from Electronic Frontier Foundation.

At Torbit, we saw what other companies like Reddit and Craigslist were already doing and wanted to help other people participate in protesting SOPA. What we came up with is stop-sopa.js, which is an open source widget to add an informative modal window to your site with information about SOPA and how to contact your local representatives to tell them you oppose this new bill. By default it will only be displayed on January 18th from 8am–8pm EST (1300–0100 UTC). It’s available as a WordPress plugin, Blogger widget, Typepad widget, and a simple javascript snippet. Check out the screenshot below to see what it looks like or click here to try it out.


Help protest this threat to the internet. Notify your representatives, spread the word, and protest on your site. Stop censorship by stopping SOPA!

Posted in General | Tagged , , , | Leave a comment

Find the Time to First Byte Using Curl

I was recently looking for an easy way to find the time to first byte (TTFB) for a given url using curl. I wanted to run some script based tests for a bunch of urls over time. I ended up coming up with the following:
curl -w "Connect time: %{time_connect} Time to first byte: %{time_starttransfer} Total time: %{time_total} \n" -o /dev/null [url to test]

This gives you something like the following:
curl -w "Connect time: %{time_connect} Time to first byte: %{time_starttransfer} Total time: %{time_total} \n" -o /dev/null www.google.com
Connect time: 0.402 Time to first byte: 0.453 Total time: 0.475

Hope this is useful to someone else.

Posted in Code | Tagged , , | Leave a comment

PHP str_replace_last function

I recently found myself in need of a way to replace the last (and only the last) occurrence of a substring within a string. Basically exactly str_replace, but only on the last occurrence of the needle within the haystack. I came up with this quick solution. Feedback welcome.

function str_replace_last( $search, $replace, $subject ) {
    if ( !$search || !$replace || !$subject )
        return false;
    $index = strrpos( $subject, $search );
    if ( $index === false )
        return $subject;
    // Grab everything before occurence
    $pre = substr( $subject, 0, $index );
    // Grab everything after occurence
    $post = substr( $subject, $index );
    // Do the string replacement
    $post = str_replace( $search, $replace, $post );
    // Recombine and return result
    return $pre . $post;

Hope someone else finds this useful.

Posted in Code, php | Tagged , | 2 Comments

Torbit is Hiring!

My current company Torbit is growing and we’re looking for a few good people to join us. If you want to help us make the web a better place let us know.

Here are a few quick job descriptions of what we’re looking for:

Systems administrator
Our ideal candidate would have experience building and scaling large distributed infrastructure across multiple data centers. Your job would include architecting new infrastructure, helping us set up global data centers and performing ongoing maintenance. You would be expected to build redundancy, active failover and monitoring into our system and find ways for us to improve performance at the server-level. We would like to see experience with Chef along with a working knowledge of Anycast, NGINX, MySQL and Node. Experience with SPDY, tweaking TCP slow-start and other performance optimizations a plus.

Frontend PHP developer
We need a front-end developer who will be responsible for the public-facing parts of our application. Responsibilities would include our marketing site, account system, billing system, DNS control panel, reporting dashboards and lots more. We would expect you to be good with JavaScript, HTML and CSS. A performance background and good design sense a plus.

Performance engineer
For this position, we want someone who has a strong background in front-end performance. This job will be to help us research and implement new techniques for speeding up websites. Strong PHP and JavaScript skills required. Experience working with large scalable systems a plus.

If you don’t fit into one of these but are interested in what we’re doing that’s ok. We’re looking for smart people interested in solving interesting problems. We’d love to hear from you if that sounds appealing. Feel free to email us at jobs@torbit.com and check out the Torbit blog post for more information.

Posted in work | Tagged , | Leave a comment

How to programmatically find the continent from a given city or state

I recently ran across a somewhat unusual problem. I needed to find a programatic way to convert a string that could be a city or a state name into the continent that the city or state belongs to. I Googled around a bit and couldn’t find an obvious solution, so I thought I’d write this up in hope of helping the next guy.

What I ended up doing is using the Yahoo! GeoPlanet API. This allowed me to do a query of my city or state name and get a place resource, then use that to find the continent that the place resource belongs to.

So first things first, you’re going to need an app id from Yahoo!, so if you don’t already have one you’ll need to get one. Then you just need to make a request like the following:
Where CITY_OR_STATE is the query term you’re searching for and YOUR_APP_ID is the Yahoo! app id from above. Then you’ll get back something like the following:

<places xmlns="http://where.yahooapis.com/v1/schema.rng" xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:start="0" yahoo:count="1" yahoo:total="300">
<place yahoo:uri="http://where.yahooapis.com/v1/place/2488042" xml:lang="en-US">
<placeTypeName code="7">Town</placeTypeName>
<name>San Jose</name>
<country type="Country" code="US">United States</country>
<admin1 type="State" code="US-CA">California</admin1>
<admin2 type="County" code="">Santa Clara</admin2>
<locality1 type="Town">San Jose</locality1>

You want to grab the woeid (in this case 2488042) for the next part. Next, we need to lookup the continent this place resource belongs to. To do this we make a request like so:
Where THE_WOEID is the woeid we found in the last step (2488042 in this example) and YOUR_APP_ID is your app id again. This should return something like the following:

<places xmlns="http://where.yahooapis.com/v1/schema.rng" xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:start="0" yahoo:count="1" yahoo:total="1">
<place yahoo:uri="http://where.yahooapis.com/v1/place/24865672" xml:lang="en-US">
<placeTypeName code="29">Continent</placeTypeName>
<name>North America</name>

Where North America is clearly what we want to pull out of it.

I was doing this in PHP, so here’s a quick and dirty PHP example:

function continent_lookup( $search ) {
    if ( strlen( $search ) == 0 )
        return false;

    $search = urlencode( $search );

    $app_id = 'YOUR_APP_ID';

    $res = file_get_contents( "http://where.yahooapis.com/v1/places.q($search)?appid=$app_id" );
    preg_match( "/<woeid>([0-9]+?)<\/woeid>/", $res, $match );

    if ( !$match )
        return false;

    $woeid = $match[1];

    $res = file_get_contents( "http://where.yahooapis.com/v1/place/$woeid/belongtos.type(29)?appid=$app_id" );
    preg_match( "/<name>(.+?)<\/name>/", $res, $match );

    return $match[1];

Hope this helps someone else out there. Let me know if you have any feedback.

Posted in Code, php | Tagged , | Leave a comment