Rspec Candies and Cookies

candy
Standard
it "include_hash tests nested hashes" do
 { foo: 'a', bar: {nested_hash: {fi: 'c', baz:'b'} }}.should include_nested_hash(nested_hash: {fi: 'c', baz:'b'})
 end

Combining Mandraka’s ¬†Rspec Candy with this little find from CookiesHQ, led me to a nested hash matcher

Very useful for testing API responses.


def find_first_value_for(hsh, key)
 return hsh[key] if hsh[key]
 hsh.values.each do |hash_value|
   values = [hash_value] unless hash_value.is_a? Array
   values.each{ |value|   return find_first_value_for(value, key) if value.is_a? Hash }
 end
end

RSpec::Matchers.define :include_nested_hash do |expected|
 match do |actual|
   if !actual.nil? and expected.is_a? Hash
     if expected.keys.count > 1
       keys.map do |key|
         value = find_first_value_for actual(actual, key)
         !value.nil? ? {key.to_sym => value} : {}
       end
     elsif expected.keys.count == 1
      {expected.keys.first => find_first_value_for(actual, expected.keys.first)}
     else
      {}
     end
     !actual.nil? && result == expected
   else
     false
   end
 end
end

Just include it in your spec_helper.rb or custom matcher module then test with something like this:

context "when testing with rspec candy" do
 it "include_hash is available" do
 { foo: 'a', bar: 'b' }.should include_hash(foo: 'a')
 end
 it "include_hash tests nested hashes" do
 { foo: 'a', bar: {nested_hash: {fi: 'c', baz:'b'} }}.should include_nested_hash(nested_hash: {fi: 'c', baz:'b'})
 end
end

Email hack from angelist angel.co

Standard

Very often I receive or send an introduction email to two parties, either for a general introduction or to help solve a specific problem. Usually it’s the two parties being introduced who need to chat, and not me. So I do what I’ve seed to be the common pattern and asked to be moved to bcc so that when they hit reply all I am taken out of the chain. I also do the same when someone introduces me, and It’s clear that the introducer shouldn’t be in on the continuing email chain.

Here’s an example:

Intro Email pattern

Today however I received an intro email from angel.co (Angle list’s return email) and in the email they did something very clever. their email is below. When I hit reply all (which I did lazily as a guaranteed way to include the other person in the email) there was no sign of the angel.co address in the to or cc fields.

intro email that doesn't include sender's email in the reply-to field

They did this by manipulating the reply-to header in the email chain. It may be an old hack or an old trick, or even part of the design of the email standard to begin with. But I’ve never manipulated the reply-to field before and this is absolutely a great way to handle emails connection between two users. Not only is the other part in the email chain, and the send is not on reply-all, it also works for regular reply. Here is an edited version of the headers. I also noticed that mail was processed by SendGrid, so maybe this is actually a feature of sendgrid’s email management service, but in any case, I think it’s brilliant and clever.

Subject: Intro - Ashley, Someone (Example Company)
From: AngelList Talent <talent@angel.co>
Date: 1/16/14, 3:05 PM
To: Ashley@Raiteri.net, someone@example.com
Return-path: <bounces+13051-3f53-ashley=raiteri.net@send.angel.co>
Envelope-to: ashley@raiteri.net
Delivery-date: Thu, 16 Jan 2014 18:05:17 -0500
Received: from o1.send.angel.co ([74.63.231.121]:55752) by ...
Received: by mf227.sendgrid.net with SMTP id mf227.26522.52D865A98 Thu, 16 Jan 2014 23:05:13 +0000 (UTC)
Received: from angel.co (ec2-50-18-6-138.us-west-1.compute.amazonaws.com [50.18.6.138]) by ismtpd-026 (SG) with ESMTP id 1439d4d1dc8.12bc3.5ed92 Thu, 16 Jan 2014 23:05:13 +0000 (GMT)
Reply-To: Ashley@Raiteri.net, someone@example.com
Message-ID: <52d865a95d6ac_e2638aff4444aa@job01.tmail>

X-Spam-Flag: NO
Reply-to: Ashley@Raiteri.net, someone@example.com

New match: Introducing Ashley to PersonName at Example Company
You're both cc'ed on this email. You should both reply and set up a time to connect.

Ashley Raiteri
Technical Advisor on Scalability, Data Science, Product and Funding

Ruby CSV write to a file – Gotcha!

Standard

Unlike the beautifully concise and familiar 1 liner of code to dump a document to a text file:

File.open(local_filename, 'w') {|f| f.write(doc) }

The ruby csv library requires quite a bit more typing, and the documentation for it is easy to misunderstand.

Screen Shot 2013-07-22 at 11.20.25 AMOne of my primary needs, is often data wrangling. ¬†Changing the contents of a csv file for use in another framework, whether it’s reverse coordinates, stripping unwanted columns, or adding needed columns to the data, and I always trip up on how to dump the changed CSV after manipulating it.

As a reminder to myself, and maybe a hint to others, I’ve include the proper way to dump out your arr_of_arrs, once you’ve manipulated it as you will,

CSV.open(newfilename, &quot;w+&quot;,
             :write_headers =&gt; true,
             :headers =&gt; arr_of_arrs.headers) do |csv|
    arr_of_arrs.each{|row| csv &lt;&lt; row}
 end

The important bit is remembering to do an each loop of your arr_of_arrays object. This for instance will not produce the desired results:

CSV.open(newfilename, &quot;w+&quot;,
                :write_headers =&gt; true,
                :headers =&gt; arr_of_arrs.headers) do |csv|
   csv &lt;&lt; arr_of_arrs
end

Bone Yard for Travel Startups

Standard

My personal math has the Travel Startup success rate at lower than 1/2 of 1%.

I’m calculating over 1000 travel startups in the last decade with less than 50 ‘successful’ startups.

The rate for Big Time success is even lower maybe 1/10 of 1%

 

It may be too early to tell, but I essentially agree with this post on Pando Daily from a few months ago.  Travel was one of the early candidates for a market that could be disrupted by the creation of the Internet.  There are several very profitable companies that have fundamentally monopolized the space.  In the US Market, there is Expedia (created by Microsoft in partnership with GDS’s) 1996.
Orbitz.com (created by United Airlines, Delta Air Lines, Continental Airlines & Northwest Airlines in 1999).  Two of Orbitz’s founding creators no longer exist.   Travelocity.com  was created by Sabre (a GDS) which was wholly owned by American Airlines at the time.  Priceline.com was founded by Walker Digital (a very successful company with over $300M in revenues in 1998).  
So of the big 4 Online Travel Agencies in the US, none  represents what we typcially consider a startup, and 2 were actuall existing players in the market just shifting from offline to online.

If you look at the last decade, there a few very successful companies but very few that started in a dorm room.  Kayak was started by Paul English (an exec at Intuit) and Steve Hafner who was part of the original Orbitz team.  They started with a ton of funding and industry experience.

ITA Software was essentially a true startup.  It slogged along in the “Might Make it” status for 15 years before getting snatched up by Google.  Granted they had > $100M in revenues and > $200M in funding for many of their final years, but with a limited supplier chain and colossal failures in attempting to scale from Shopping Engine to PSS provider there was never going to be any future other than an acquisition for ITA.  Still an $800M acquisiton deal is clearly a SUCCESS.

 

Tripadvisor.com (11 years since founding) certainly meets the criteria.

As does Tripit.com which was acquried for $120M by Concur.

Farecompare has done very well (founded by Rick Seaney & Graeme Wallace from work they did at Hotels.com)

There’s also Farecast (founded by Oren Etzioni) purchased by Bing.

Flightcaster (Evan Konweiser, ex-kayak staff member) was purchased by NextJump.  I’m not sure NextJump is successful, but I guess I count this as a good exit.

Portland based Flightstats.com (a Datalex spin-out) seems to be doing quite well.

More recently there is Gogobot (too soon to tell whether it will last, but it has strong user growth)

And of course there is star-studded Hipmunk.com

 

Sidestep and Swoodo, both acquired by Kayak can probably also be considered true startups that succeeded by getting acquired. ($200M for Sidestep, unknown for Swoodo).  But now we’re venturing outside the US Market where there are a few other notables:

 Cheapflights.com (founded in 1996)

 Skyscanner (11 years in the making, started on the backs of 3 guys, 2 of whom kept their fulltime jobs for a while)

Danish born Momondo, (6 years old),

Maybe you can count Datalex (founded in 1985) but they don’t really fit the criteria of a start-up

There are many more notables like ClearTrip.com from India, but the point I’m trying to get it is this:

In just 2010-2011 Tnooz lists in excess of 300 startups in the travel space, only Gogobot and Hipmunk from that era are surviving at any significant level of success.

The era of the Travel startup may be over.  The cost of creating a startup in other areas is just too low, and trying to disrupt the travel space without serious connections and money is seeming less and less likely.  I’m not sure if developers will ever stop trying to tackle this space, but it’s certainly beginning to seem less and less likely that they will succeed.

Want to mention some other companies that you think qualify as ‘successful’ travel startups?  Send me a note or comment and I’ll update my post. 

 

Startup Failure Analysis

Standard

I saw this on Mashable.com  but the original source was AllmandLaw.com 

I’m always astonished by the articles that discuss startup failures.  There are many definitions, but in the tech community.  If you’re not fully funded or have overwhelming user acquisition momentum within the 1st 12 months, you probably fall in the FAILED category.  This one doesn’t attempt to cover the whole 90% statistic, but looks at a few side by side cases.  Worth looking at.

 

Dung Zen Gem

Standard

I am subscribed to The List Serve, it’s a service where 1 member writes 1 email that we all receive each day. Content tends to be very advice oriented, “never give up, pursue your dreams, be happy”. Sometimes it’s confessional. Sometimes it’s instructional. Often it’s insipid. But I still skim it everyday and today there was a Gem so I’m re-posting it here without permission.

So the story goes…..A little bird was flying south for the winter. It was so cold that the bird froze and fell to the ground into a large field. While he was lying there, a cow came by and dropped some dung on him. As the frozen bird lay there in the pile of cow dung, he began to realize how warm he was. The dung was actually thawing him out!
He lay there all warm and happy, and soon began to sing for joy. A passing cat heard the bird singing under the pile of cow dung and promptly dug him out and ate him.

Moral of the story:

(1) Not everyone who shits on you is your enemy.
(2) Not everyone who gets you out of shit is your friend.
(3) If you are happy and warm in a pile of shit then it’s smart to keep your mouth shut!

………and the doctor recommends (I really am one) :-

1) Make an effort to smile everyday, it will help you live longer.
2) Don’t forget how to use a pen. 2) Enjoy your single malt scotch as it was intended…straight and unadulterated. 3) Take time to sit with your eyes closed for atleast 10 minutes…it will open up your mind.
4) Read IF by Rudyard Kipling and Auguries of Innocence by Wiliam Blake.
5) Everything will be alright at the end, if it’s not alright then it’s not the end

Live long and prosper my friends!

Aniruddh Behere
Springfield Illinois, USA

Follow them on Twitter @thelistserve
thelistserve.com
facebook.com/thelistserve

Adulthood isn’t abandonment of dreams

Standard

So, I’m 40. That’s not particularly old. But I am fully an adult. I have a 21 year old stepson, and 11 year old daughter, a wife, I used to have a mortgage and I have life and car insurance etc.
Young Entrepeneurs constantly portray the mindset of older folks (adults) as having abandoned their dreams.

My take on it is that it comes down to your perspective of the future. As you age, the future becomes less abstract. It arrives, as it were, as it is. In the future you could have been the next Hemingway, except you’re not. You’re a 40 yr old serial entrepreneurial technologist with 2 kids.

In the future you could have invented Instagram and earned a billion in shaky Facebook stock. But you’re not. You still keep track of your hours and you usually invoice some one for Travel expenses and you pay attention to when the reimbursement check is scheduled to come.

So being an adult is about abandoning yor dreams. dreams just have shorter shelf life. There isn’t an opportunity to wait 5 years to be the next you. It’s today.

Dreams cost more because they last less long. And they mature into market value sooner. If I dream of being In band at 42. I pretty much need to learn to play guitar today. If I dream of running a marathon. I need to enter a 5k run for next month. If I dream of owning a home, I need to put away 15% of my next check towards a down payment.

So adults haven’t abandoned their dreams, they just have to work harder to have a dream, because tomorrow is today and dreams don’t come cheap. They live or die on what you did this morning.

Most clever use of four square for real estate marketing

Standard

I absolutely love this hack of foursquare for real estate