Thursday, December 31, 2009

My New Year Resolutions

  1. Get the hang of MVC frameworks and create a working platform using CakePHP.
  2. Move to my own domain.
  3. Create a firefox addon
  4. Create chrome extension.
  5. Design a logo, a letterhead and VCs.
You can also work on them. They are quite generaal resolutions. :)

Thursday, December 3, 2009

Variable Height Iframes

I know Iframes suck! And they must be avoided as much as possible... but the fact is that they are sometimes the easiest and/or the only possible way.(GMail is all iframes). One thing that sucks about Iframes is that it's  height is constant, independent of the content it is holding. And hence either there is some extra whitespace or a very irritating scroll bar.

Here is a script that will help you make a scrollbar free iframe:


function setHeight(ele) {
saveele = ele;
var oDoc = (ele.contentWindow || ele.contentDocument);
if (oDoc.document) oDoc = oDoc.document;

var D = oDoc;
h = Math.max(
Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
Math.max(D.body.clientHeight, D.documentElement.clientHeight)
);
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
if(is_chrome) {
h = oDoc.height;
}
ele.height = h;
}


Here is a working example.

I hope it helps :)

Google Search with Text Commands


What it does?

Gives you an option to search images, videos, youtube and wikipedia right from google homepage WITHOUT any additional clicks

Format of various queries:

Search Type
Prefix/Command
Example
Destination Domain
Normal Search
Nothing
Hello
google.com
Image Search
;i
;i Hello
images.google.com
Video Search
;v
;v Hello
videos.google.com
Youtube Search
;y
;y Hello
youtube.com
Wikipedia Search
;w
;w Hello
wikipedia.org


How does it work?

It redirects the page to mentioned locations after appending queries if the query text is preceded by ;i or ;v or ;w or ;y

How to Install it?

Step 0: Install Greasemonkey (It's a Firefox Addon)
Step 1: Install My Script


I hope it will help. If you think there are more options that are needed for faster searches, do leave a message.


Search Tip

Well, we all search for definitions now and then. What we do is we go to answers.com or wikipedia or i-am-too-lazy-to-list-them-all.
Easy way:
Google this 
define:WHATEVER_YOU_WANT



P.S.: Greasemonkey is awesome