JavaScript Weirdness
I was just listening to the lightning talk by Gary Bernhardt from CodeMash 2012 and he brought up some really interesting (and funny) points about JavaScript.
For example:
» {} + [];
JavaScript: Clock Angle Problem
Earlier today I was presented with the problem of calculating the degrees between the hour hand and the minute hand of an analog clock. At first this seemed like a fairly complicated task, however after playing with it for a bit the solution became apparent. But now after looking up the answer on Google I feel really embarrassed on how easy the solution really is.
It’s amazing how complicated you can make a solution, when most of the time it can be solved so easily once you have the basic logic worked out.
Solution:
// h = 1..12, m = 0..59
function angle(h,m) {
hAngle = 0.5 * (h * 60 + m);
mAngle = 6 * m;
angle = Math.abs(hAngle - mAngle);
angle = Math.min(angle, 360 - angle);
return angle;
}
Socialite.js
JavaScript for implementing social sharing buttons asynchronously. Support for Twitter, Google+, Facebook and LinkedIn
The wooden spoon trick is even funnier in Icelandic. Friggin hilarious!!!
Alright, the video I shot and edited for @robcarona has finally been released.
This past weekend was a lot of fun, I had the opportunity to film and edit the music Video titled “Beautiful” for Rob Carona. It’s the first time I’ve had the opportunity to create a music video, and as a web developer the opportunities to explore other forms of creative expression are not as frequent as I would like. The shoot itself could have been better coordinated, as we did not have a story board and most of the shots where rather spontaneous. However, I don’t think you will be able to tell from looking at the video. I think it turned out excellent for a video that was shot, edited and produced in less than two days. I’m still recovering from the lack of sleep, but it was a very rewarding experience and look forward to doing it again sometime.
I will post the link to the YouTube video shortly.
Character is not made in a crisis, only exhibited
Recently I was working on a project where we needed to display a multi-select input. Very quickly it became apparent that the traditional select box would not work since the information we were presenting would need to be displayed in multiple columns and support pagination. The common sense answer was to display the information in a table however after some searching I realized there were no good plugins for selecting multiple table rows. The other requirement was to duplicate the functionality of a drop down and add in keyboard controls (shift click, ctrl click, etc.) so I set out to write my own.