Author Archives: kamasheto

Filter Google Code Commits

Google code project hosting doesn’t give you an easy way to filter commits easily. In any way really. Hadeer Younis has posted a nifty script that dynamically filters them from the changes page.

Being the person I am, I refactored that script for easier usage.

  • Browse normally to the commit list page, example: http://code.google.com/p/smartsoft-12/source/list
  • Load this once:
    if(!window.jQuery||confirm('Overwrite\x20current\x20version?\x20v'+jQuery.fn.jquery))(function(d,h,s){s=d.createElement('script');s.type='text/javascript';s.src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';((h=document.head)||(h=document.getElementsByTagName('head'),h?h[0]:document.body)||document.documentElement).appendChild(s)})(document);
    var total_commits = -1;
    var results = false;
    function filter_commits(regex) {
        if (total_commits == -1) {
            total_commits = $('.pagination:first').text().split('of')[1].split('Older')[0].trim()
        }
        $('div.list b:last').html('Please wait while we filter the log...');
    	if (results == false)
    	    $('#colcontrol').load('list?num='+total_commits+' #colcontrol', function(){
    	        results = $('#resultstable>tbody').clone();
    			do_filter(regex);
    	    });
    	else
    		do_filter(regex);
    }
    function do_filter(regex) {
    	$('#resultstable>tbody').html(results.html())
    	$('#resultstable>tbody>tr + tr:visible').each(function(){
    		if(!$(this).text().match(regex))
    			$(this).hide()
    	});
    	$('div.list b:last').html('Committed changes (done filtering)');
    }
  • Run this to filter
    // enter a regular expression to match against (username, r#, [uU]pdate issue #, etc)
    filter_commits("kamasheto");
    

Untitled

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Preview Print CSS on-the-fly

There are countless tools to help you with debugging CSS intended for the front-end “screen.” Inspector tools are now bundled with most modern browsers and are very powerful in terms of letting the developer manipulate the DOM in realtime.

However as soon as you try to develop UI for the printer it starts to get lame. Previewing the printer friendly version requires sometimes lots of steps and that could be quite exhausting on the long run. You could use addons that attempt to make this easier, but it still gets exhausting.

A good workaround I came across is using Javascript to dynamically remove the screen CSS and enable the print CSS instead. The underlying idea is quite simple: (jQuery)

	$('link[media="screen"]').remove()
	$('link[media="print"]').attr('media', 'screen')

You could run this code on load ($(function(){ /* here */ });), or trigger it on a certain event (clicking a certain test button for example.)

Mac101 — Owning Your First Mac Pt. 2

Owning your first Mac is usually a big step. Overcoming the feeling of buying perhaps the most overpriced gadget you’ve ever admired. And it probably goes on to having to live with people who, even when they decide to keep it to themselves, look at it as a rip-off because, always, there are much cheaper alternatives with perhaps even better specs!

All that aside, you’ve probably also spent a considerable portion of your life on a PC. You’re used to it, familiar with it, and most of all, grown attached to it.

Among other things, these are a few reasons of the many reasons I think people take Windows with them when they move to a Mac. They either install Windows *just in case* or have their older laptop readily available for when they (almost always) need it. This branches to two main problems: not exploring, and porting your conveniences. I’ll elaborate.

Not Exploring

Out of the box, a Mac is far beyond your best companion. Aside from all the apps you’ll ever need for you to dive right into work, there are probably apps that you won’t know you need until later. If you decide to assume a Mac is yet another PC and not lurk around for what’s there and what’s not, you might never know what power lies within your hands. Always look for missing items and never hesitate to Google!

Porting Your Conveniences

Get used to the old (could be bad) habits and using them on your Mac. For example relying on GUI for all tasks. Mac is built on unix and has the same powerful terminal you expect to find on any linux machine. This lets you do extraordinary things with a few commands. Once you’re used to the new “Mac” conveniences, you’ll realize everything could be done better. ;-)

Remember, treat your Mac as a new environment. Don’t use your Mac alongside a PC at least during the first few weeks of your purchase. Get used to your new gadget because it is rewarding. Happy Macing!

Under The Spotlight

Dear Diary,

I have no interest in birthdays or celebrations of that sort. They simply have (had) very little to zero significance to me. And since I’ve always thought of myself as an awkward person (probably still the same) when it comes to parties anyway, that made it all the lot easier. I don’t really look forward to being under the spotlight on my “special day” (still applies teehee) because of a lot of irrelevant reasons at the moment.

19/01/2012 marks my 25th birthday. Happily enough, 19/01/2012 also marks my 1st “surprise birthday party.” It marks the first time I was shocked to realize I’m surrounded by people that care enough to give you a special treat on your special day. People that will forever be engraved in my memory for how they made me feel on that single one day.

To all those that made this possible and were there, from the deepest spot of my heart, thank you. :-)

PS. Since I try and keep a lid on my birthday (it’s not on my Facebook and it’s not even in plain here on my website,) I spent quite some time during my shocking gaze trying to figure out how it went out. Apparently Ahmed Motaz (the extremely detail-oriented software engineer I so happen to work with) had noticed it on my CV when I applied for Zoboon, Inc.