“A design is finished, not when there is nothing left to add, but when there is nothing left to take away.”
- Antoine de Saint-Exupéry
Posted September 2nd, 2010 - PermalinkThis weekend I participated in Node Knockout with Jerod and Cody. It was awesome, we made a game in 48 hours (less than that of actual working time).
It was a lot of work, how much?
We had 129 total commits, 82 were mine, 35 belonged to Jerod, and 12 to Cody. That’s not 100% accurate because Cody had some git problems part way through, so I committed things for him. In those commits we had 245 file changes.
The final product had 974 total lines of code, as broken down by CLOC:
------------------------------------------------------------------- Language files blank comment code scale 3rd gen. equiv ------------------------------------------------------------------- Javascript 4 130 43 750 x 1.48 = 1110.00 CSS 1 26 4 167 x 1.00 = 167.00 HTML 1 0 0 57 x 1.90 = 108.30 ------------------------------------------------------------------- SUM: 6 156 47 974 x 1.42 = 1385.30 -------------------------------------------------------------------
If you have a minute, give it a shot at http://www.lazercatzthegame.com/.
Posted August 30th, 2010 - PermalinkI’ve been a KDE user for a long time now, and I love all the new changes (except the Aero snap thing, you can turn that off though). One thing I love is Kate. I usually have two or three Kate sessions open at once, borrowing code across projects or changing things in different modules.
My problem is that Kate now defaults to only one instance, so if I call Kate from the command line with a file name, it gets added to a running instance, not a new one. If I use the KRunner to start a session, it loads in place of the current session in a running instance. I understand the reasoning here, but I want to use it the way I always have.
Easy fix! Just always make sure it is called with kate -n
You can do this with a BASH alias,
alias kate='/usr/bin/kate -n'
or more thoroughly with a wrapper script like this one from a forum post:
1 2 | #!/bin/bash /usr/bin/kate -n $@ &> /dev/null & |
Easy fix!
Posted August 27th, 2010 - Permalink
“As programmers go, I’m fairly social. Which still means I’m a borderline sociopath by normal standards.”
- Jeff Atwood
On Working Remotely
Last week I put together a quick script to display a panorama I took in Colorado.
It was a one-off script and I didn’t think much of it until Naina Redhu left a comment asking about using it for multiple panorama’s.
Well, why not?
It didn’t take much to tweak it into a full fledged jQuery plugin. I just took the bit that made the panorama and tweaked it to use local references. While I was at it I removed the requirement for a pre-loader image in the markup. Have a look.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ( function ( $ ) { $.fn.panoramah = function () { return this.each( function ( index ) { // Localize the element var photo = $( this ); // Extract the relevant data from the rel attribute var panorama_width = photo.attr( 'rel' ).split( ':' )[0]; var panorama_url = photo.attr( 'rel' ).split( ':' )[1]; // Get the preloader var img = $( "<img src='' />" ); // Setup the onload callback img.load( function () { // Set the background to the image photo.css( 'background', "transparent url( '" + panorama_url + "' ) no-repeat" ); // Clear out the loading crap photo.html( "" ); // Set up the mouse monitoring photo.mousemove( function ( event ) { // Get the offset offset = Math.floor( ( panorama_width - photo.width() ) * ( ( event.pageX - photo.offset().left ) / photo.width() ) ) // Mind the overflows if( offset <= panorama_width - photo.width() ) { photo.css( 'background-position', '-' + offset + 'px 50%' ); } } ); } ); // Start the loading process img.attr( 'src', panorama_url ); } ); } } )(jQuery); |
Using it is pretty easy too, just set up your HTML like so:
1 2 3 4 5 | <div class="panorama"
rel="4201:Panorama-Cropped.sm.jpg"
style="height: 500px; width: 100%; border: 1px solid #444;">
Loading...
</div> |
Then make a collection and call panoramah() on it:
$( '.panorama' ).panoramah();
There’s a demo available here and you can keep up with any changes at Github.
Posted August 25th, 2010 - Permalink