Checking uber surge status from terminal

Because I’m too lazy to pick up the phone and wait for the uber app to load.

We are going to use uber api for this. Create an app and get your server token. In the estimates endpoint you don’t need to pass different start location and end location to get the surge multiplier. (Note that I’m using the v1 of the api. v1.2 doesn’t provide us the surge multiplier since they are showing upfront charges now). Just pass the starting location to check for surge. (Use google maps and check the url to get your lat, long).

Here’s a simple script to get what we need from the api. Don’t forget to replace YOUR_TOKEN with your actual server token from the uber developer dashboard.

Then from your terminal set an alias to the script  with your lat long values.

$ alias surge="/path/to/script/surge.php 6.9328 79.8414722"

Reload the profile to make the new alias work. In my case its;

$ source ~/.zshrc

Next time you want to check if there’s any surge you just have to type surge in your terminal.

weaving css faster

Dreamweaver is the fastest editor I have ever used. We can make it more faster by doing some small changes.

ie: when we want to add a background to an element, once we hit the ‘b’ key we get,

the first suggestion is backface-visibility  which we use very rarely. In order to get the background property we have to either hit down arrow or type more letters (backg). To overcome this problem and get background as the first hint when I hit ‘b’ key I removed backface-visibility from code hints. All you have to do is,

  1. Open dreamweaver’s CSS3_hints.html file. In my system it’s at C:\Program Files (x86)\Adobe\Adobe Dreamweaver CS5.5\configuration\CodeHints
  2. Search for ‘backface-visibility‘ and comment out the code blocks associated to it.
  3. Restart Dreamweaver
  4. profit

Next time we hit the ‘b’ key the code hint looks like this

Can do the same thing for ‘widows’ property. It’s in CodeHints.xml file.

Watching good shows?

I don’t download tv shows anymore. When I feel like watching a tv show I point my browser to http://tv.blinkx.com/. They have lot of shows with streaming links in megavideo and few other video streaming sites. But the problem is how to find a good tv show. Selecting the tv show name, then right click to search google for it and click on imdb page to check rating gets boring after you repeat it few times. So I thought of writing a bookmarklet to make the process easier.

IMDB doesn’t provide a direct API to grab ratings. I emailed them few months back asking about an API for another project I was on. This is what they said:

Because IMDb licenses some data from third parties, we cannot offer permission to use it without charging a fee.  We offer custom data feeds as a part of an IMDb Content Licensing Agreement. Because these are custom created feeds, the minimum cost to license data from IMDb is US$15,000 per year.

Seriously?  $15000/year ? So how to get imdb ratings.. I found this php class by alif. It made the things very easy.

All I do with my bookmarklet is sending the show names to that php class hosted on my server, then it searches IMDB and returns the IMDB rating for the show. This serves my needs but there are some problems with this method.

  • There’s no common way to pick tv show/movie names form different sites.  The current bookmarklet works only for blinkx.com. Have to make separate jQuery selectors and regex to grab the names from other sites.
  • Rarely the rating shown is wrong because IMDB search fails to find the exact match and points to some other movie/tv show.

Easier way to check spelling on a website

We need youtube time. We need engadget time. We don’t have time to check spelling in each and every word of the content on web pages we develop.

To make things easier I made a small bookmarklet to check spelling. It uses html5 contenteditable attribute to do the magic. Many new browsers has spell checker feature on text areas. If you navigate to a webpage and click the bookmarklet it will add the contenteditable attribute and set it true to body tag. In other words now the whole web page is a text area. You will be able to see the red line below misspelled words. = profit.

Works perfectly in firefox. Buggy in chrome.

javascript:(function(){(document.body.getAttribute('contenteditable')==true)?document.body.setAttribute('contenteditable','false'):document.body.setAttribute('contenteditable','true');})();

You can also Visit this page and drag the link to bookmarks bar.

ToDo app with HTML5 localStorage

Here‘s a simple todo app I did with html5 localstorage. It saves todo items in your browser. The app needs more features like editing the list etc. Hoping to add them soon.

Just type what you have to do in the box and hit enter to save. Can mark them as done by clicking the tick icon in the middle of the item. Yeah the icon is too small. Let me know if you have any suggestions

ToDo5 Continue reading “ToDo app with HTML5 localStorage”