Category Archives: Startups

LeanPub Compilation and Sanitizing Tool Written in Node.js

LeanPub is an awesome publishing platform, but often we need to communicate with other  team members involved in the book production, e.g., content and copy editors. In such times, I’ve learned that Guy Kawasaki was right — when we suggested in his book APE: Author, Publisher, Entrepreneur — that author must use MS Word!

The problem is that LeanPub uses multi-file book format and a special markdown markup (that confuses Marked app). I was wrapping up a new revision of the Rapid Prototyping with JS book and previous experience of handing a txt file to an editor was poor. Luckily, Node.js came to help! Through some trail and error attempts, I found this workflow to be the best for converting LeanPub manuscript to a one MS Word file (for editing and other needs):

  1. Run leanpub-tool.js with Node.js (node leanpub-tool.js)
  2. Open file in Marked app and convert to HTML
  3. Open HTML in MS Word and enjoy.

The full code of leanpub-tool.js which is also available at

var fs = require('fs');
//change these to YOUR filenames
//probably we can read it from Book.txt but I was too lazy to implement it :-) and somebody might want to compile only sertain parts of the book
var book =[
var sanitizeText = [
  "I>## Note",
  "T>## Tip",
  "W>## Warning",
var str = '';
//read files
  str +=  fs.readFileSync(chapter,'utf8');
//sanitize LeanPub specific Markdown tags
//  console.log(text)
  //this loops through while there is not matches
  while (new RegExp (text).test(str)) {
    str = str.replace(text,'','gm')
//write output to a file

Day 6 of StartupBus 2013: All-Star Finals

On the sixth day six after departing from San Francisco, buspreneurs gathered to socialize and to let steam off at a happy hour organized by Twillio. GhostPost brought a projector to the bar to show their anonymous live chat. The funny story is that the projector was sold to them by of a fellow busmate (from the team) whose Austin-based friend the Grassroots guy to handle the Craigslist projector ad. :-) Apparently the GhostPost team weren’t happy with their defeat (and who would be?) and hustled their way through the competition to become an All-Star wildcard — and by the evening they were indeed selected as a wildcard!

StartupBus 2013 West Coast - random stop

StartupBus 2013 West Coast – random stop

Rackspace bought out the Champions sports bar in downtown Austin. GhostPost and other teams pitched during the evening to Dave McCure, Robert Scobler, and other important startup personas. The sound quality wasn’t very good. Every now and then somebody would shush the drunk, happy and tired crowd, but that didn’t help much. Despite it being very entertaining to watch Dave McClure rip apart startups and Robert (because he saw the evolution during the span of 3 days) explain and sometime defend them — in the end the decision was the same. They announced that the winner was CareerMob, and the runner up was NextChaptr.

StartupBus 2013 — Dave McClure and Rober Scoble

StartupBus 2013 — Dave McClure and Rober Scoble

Summary of StartupBus 2013

Overall StartupBus is a great experience but I can’t say that it has changed my life. :-) There are similarities to a real startup life:

  • Scarcity of resources, balance of risks and trade-offs, ample creativity to solve problems
  • Building, motivating and selling the concept to your team while pitching your idea to judges
  • Human drama: communication issues, interactions among team members in close quarters, under stress, without enough sleep, etc.
  • Startup lifestyle: exhaustion, abundance of stress

But some things are far from the reality. Mainly, in an actual startup:

  • Founders can focus not only on consumer segment, but also on small business and/or enterprise customers. Obviously, due to the lack of time and resource constraints buspreneurs targeted consumer audience.
  • Team needs to be serious and to pick not just fun and sexy ideas to get the most buzz. Solid business models usually come from ugly and boring, though concrete and painful problems.
  • These days, anyone who wants to start up a business has full-time reliable and even speedy Internet access without having to get stranded in the middle of a desert or having your mobile hot-spot picking up Mexican cell phone carriers. :-)

My conclusion is that a StartupBus trip was a good experience, but it’s not exactly the same as building a real startup.

Real StartupBus Tattoo by @claco

Real StartupBus Tattoo by @claco

StartupBus 2013 Day 5: Finals

On the final day of the StartupBus 2013, Americas hackathon competition, the judges had to choose two teams out of the six. Then, out of those two, they would pick one winner and one runner up.

Team at StartupBus 2013

Team at StartupBus 2013

Here are the six finalists from the previous day (to read more about that day and semi-finals go to my post: StartupBus 2013: Day 4, Semi-Finals):

  1. (SF): kick-starter for activism campaigns (e.g.,
  2. (SF): anonymous chat
  3. (Mexico): marketplace for construction industry
  4. NextChaptr (Chicago): book publisher with a kick-starter model
  5. CareerMob (NYC): website that helps military professionals find their civilian career
  6. Cloudspotting (Mexico): draw on photos of clouds
Team at StartupBus 2013

Team at StartupBus 2013

Everybody else was allowed to sleep in till 10am. An unheard of luxury, which came in handy for people who didn’t sleep well for the past week and went partying on the previous night in downtown San Antonio.

Then our pack rode shuttle buses to the same place at Rackspace HQ. We weren’t very lucky because our driver got lost, took narrow back roads, and drove in circles really slowly (more on this later).

StartupBus 2013 hacking

StartupBus 2013 hacking

The pitches of almost all of the finalists improved greatly. I especially liked how much improved’s pitch (I wasn’t able to find the video but here is the GoAnimate clip). Unfortunately, I couldn’t say the same about the Cloudspotting or GhostPost teams’ pitches. They just weren’t able to replicate the success of the previous night. :-( It felt like the fun aspect of the crowd cheering and support wasn’t there. Maybe the audience wasn’t surprised any more?!

After some deliberation Robert Scoble, the famous racker evangelist, announced the runner up: NextChaprt; and the winner: CareerMob! The latter decision was unexpected for a lot of people (you could see it on their faces), and many complained that CareerMob doesn’t have anything live (even a website), and has no business model whatsoever. I guess the charisma of the Air Force lieutenant made the pitch and the whole idea sound reassuring. :-)

Famous prototype

Famous prototype

It was time to wrap up and go to South by South West (SxSW) interactive festival in Austin, Texas. Sadly for our West Coast team and other random people who joined our bus, we had the same driver that we had in the morning. We got lost a few times again, took the longest detours back to the hotel and around Austin airport and its military base. When somebody finally gave Google Maps to the drive, we arrived to the Austin Convention Center. This marked the final stop of the bus part of StartupBus 2013 adventure. Virtually all of us pledged not to ride any type of buses for at least a few months. :-) infront of the judges infront of the judges

Photos by Ruben Lemmens

Paste and Match Style on Mac OS X

If you don’t like the default behavior in Mac OS X which paste text with its styles there is a way to fix it! I personally find it very annoying when I press command + V (⌘+V) and text is pasted with all the formatting from the original source. Suddenly my beautifully picked font in an email or an Evernote note is ruined. Email looks like a decorated Christmas tree.

Paste and Match Style Mac OS X Shortcut

Paste and Match Style Mac OS X Shortcut

Of course there are alternative combinations to ⌘ + V to Paste and Match style but they differ from application to application and hard to use even if you can remember them.

Go to you System Preferences, click on Keyboard Shortcuts, pick Application Shortcuts and add applications (or make an “All Applications” rule):

StartupBus 2013: Day 4, Semi Finals

On day four of our StartupBus hackathon we arrived in San Antonio, Texas. Unlike on the previous days, we settled in a nice Four Points by Sheraton hotel. The West Coast bus came first, then right after us came the bus from Mexico City, representing the whole country of Mexico. Despite being exhausted, buspreneurs filled the hotel lobby with loud voices and cheers in English and Spanish. In a few hours, the rest of the buses arrived:

  • Chicago representing the Midwest,
  • Tampa representing the Southeast,
  • New York City representing the East Coast,
  • Alumni bus from NYC representing people who participated in the previous years competitions.

Because semi-finals and finals were supposed to take place on the next day, after the dinner pretty much all the teams kept on working till late at night.
The next day, after breakfast in the hotel, we (over 150 StartupBus participants) were transported to the Rackspace HQ, a.k.a. The Mothership. It is situated in San Antonio, and was just a short ride from the hotel. Although our driver managed to get lost due to roads blocked by construction. The Rackspace HQ building is a huge box-like structure resembling a shopping mall. It is surrounded by parking lots and construction (they moved here recently) in a suburban area. We were met like rockstars, but were told not to explore anything outside of the huge hangar-like room. Knowing that most hackers disrespect any rules, Rackspace management wisely put lots of employees and security guards around us. The lunch food was subpar. Elias Bizannes (the founder of StartupBus) and other judges listened to each of more than 40 teams pitch individually. Here is a list of the teams:

StartupBus 2013 North Americacs

StartupBus 2013 North Americacs:

  • BriefSkate
  • CareerMob
  • Chromatix
  • Cloudspotting
  • Coderswb
  • Deliverish
  • DrunkSpotting*
  • Dry Erase Web
  • Emplify
  • Eventee
  • ExVersion
  • Fitchallenge
  • FlightShuffle
  • Friends Judging Friends
  • Gifdme
  • InstaLodger (alumni)
  • MyBestRx (alumni)
  • NextChaptr
  • Nomscription
  • Ovrviews
  • Payvine
  • Portioned
  • Producers
  • RepCheck (alumni)
  • SkillMeUp
  • Storedrobe
  • TagSet
  • Thumbtrotter
  • Wrong Credit Score
  • Yaank (alumni)

More information on each team is available at LeaderBoard.

  • DrunkSpotting was formed after the main competition on the way from San Antonio to Austin.

The judges looked at a few criteria such as working prototypes (or the lack thereof) and team commitment, and chose twelve teams. Here is the list of the finalists and the descriptions of their projects/startups:

  1. CareerMob (NYC): website that helps military professionals to find their civilian career
  2. (Mexico): marketplace for construction industry)
  3. NextChaptr (Chicago): book publisher with a kick starter model
  4. (SF): kick starter for activism campaigns (e.g., []
  5. GhostPost (SF): anonymous chat
  6. Coders with out borders (SF): code for a good cause/experience
  7. Deliverish (NYC): marketplace for delivery tasks
  8. Portioned (Chicago): single portion food delivery
  9. (NYC): curated book recommendation and store service
  10. Cloudspotting (Mexico): draw on photos of clouds
  11. Exversion (NYC): GitHub for data
  12. Gifdme (Chicago): animated way to share emotions via GIFs.

Next, those twelve teams pitched on-stage to Robert Scoble of Rackspace, Nicholas Longo of CoffeeCup software and GeekDome, and other judges from sponsors such as Elance and Rackspace. That was probably the most entertaining part of the whole competition! GhostPost and Cloudspotting had killer presentations. The former had a live anonymous chat on huge screens with all the unfiltered messages from the audience shown in real-time. GhostPost grabbed everybody’s attention when Elias read a Cease and Desist email, and people fell in love with GhostPost’s beautifully crafted PAC-MAN-like avatars. The latter team spokesperson can easily perform stand-up comedy: e.g., he said that Cloudspotting is not the first company to make money on clouds (Google, Rackspace, Dropbox). To appreciate the joke, you need to know that Cloudspotting allows users to draw on pictures of clouds and share their creations. :-)

The competition was set up that there would be one winner and one runner up from the pitch competition, two winners from the alumni bus (NYC) and two winners from the score competition. They selected six out of twelve teams for the finals:

  2. NextChaptr
  3. CareerMob
  4. GhostPost
  5. Cloudspotting

Tired but relieved (for most of the people the competition was over), we went on to celebrate. The six finalists kept on working for the second sleepless night.

Read more about the finals and the conclusion summary in my next blog post.

Look at social story on Storify

Asynchronicity in Node.js

Non-Blocking I/O

One of the biggest advantages of using Node.js over Python or Ruby is that Node has a non-blocking I/O mechanism. To illustrate this, let me use an example of a line in a Starbucks coffee shop. Let’s pretend that each person standing in line for a drink is a task, and everything behind the counter — cashier, register, barista — is a server or server application. When we order a cup of regular drip coffee, like Pike, or hot tea, like Earl Grey, the barista makes it. The whole line waits while that drink is made, and the person is charged the appropriate amount.

Asynchronicity in Node.js

Asynchronicity in Node.js

Of course, we know that these kinds of drinks are easy to make; just pour the liquid and it’s done. But what about those fancy choco-mocha-frappe-latte-soy-decafs? What if everybody in line decides to order these time-consuming drinks? The line will be held up by each order, and it will grow longer and longer. The manager of the coffee shop will have to add more registers and put more baristas to work (or even stand behind the register him/herself). This is not good, right? But this is how virtually all server-side technologies work, except Node. Node is like a real Starbucks. When you order something, the barista yells the order to the other employee, and you leave the register. Another person gives their order while you wait for your state-of-the-art eye-opener in a paper cup. The line moves, the processes are executed asynchronously and without blocking the queue by waiting.

This is why Node.js blows everything else away (except maybe low-level C/C++) in terms of performance and scalability. With Node, you just don’t need that many CPUs and servers to handle the load.

Asynchronous Way of Coding

Asynchronicity requires a different way of thinking for programmers familiar with Python, PHP, C or Ruby. It’s easy to introduce a bug unintentionally by forgetting to end the execution of the code with a proper return expression.

Here is a simple example illustrating this scenario:

var test = function (callback) {
  return callback();  
  console.log('test') //shouldn't be printed

var test2 = function(callback){
  console.log('test2') //printed 3rd

  console.log('callback1') //printed first
  console.log('callback2') //printed 2nd

If we don’t use return callback() and just use callback() our string test2 will be printed (test is not printed).


For fun I’ve added a setTimeout() delay for the callback2 string, and now the order has changed:

var test = function (callback) {
  return callback();  
  console.log('test') //shouldn't be printed

var test2 = function(callback){
  console.log('test2') //printed 2nd

  console.log('callback1') //printed first
      console.log('callback2') //printed 3rd



The last example illustrates that the two functions are independent of each other and run in parallel. The faster function will finish sooner than the slower one. Going back to our Starbucks examples, you might get your drink faster than the other person who was in front of you in the line. Better for people, and better for programs! :-)