Replace HTML Attribute Using jQuery

March 11th, 2009  |  Published in Development  |  Comment

I had a small project that asked for a URL and a pixel-image to be tracked. Another requirement was to replace a certain string in it with a timestamp of some sort.

Read the rest of this entry »

Resize to a Specific Element’s Dimensions

November 26th, 2008  |  Published in Development  |  Comment

Here’s a snippet to resize a background image to the dimensions of an element. In this case, #bkgImage.

var resizeBkg = function() {
    var h = self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
    var w = self.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
    var e = document.getElementById('bkgImage');
    if (w > h) {
        e.width = w;
        e.height = w;
    } else {
        e.height = h;
        e.width = h;
    }
} 

Detect Operating System with JavaScript

August 12th, 2008  |  Published in Development  |  Comment

Here’s a snippet of JS code that might come in handy if you, let’s say, would like to filter out what type of content to display depending on your website user’s OS. A real-life example would be having a download link show up to user’s who have a client that was only published on Windows.

// This script sets OSName variable as follows:
// "Windows"    for all versions of Windows
// "MacOS"      for all versions of Macintosh OS
// "Linux"      for all versions of Linux
// "UNIX"       for all other UNIX flavors
// "Unknown OS" indicates failure to detect the OS

var OSName="Unknown OS";
if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";

document.write('Your OS: '+OSName);

Note: An alternate way can be found via PPK’s quirksmode.org

jQuery onLoad for Body-tag

April 15th, 2008  |  Published in Development

<script type="text/javascript">
$(document).ready(function() {
    someFunction();
    ...
});
</script>

To-do List in Google Calendar

May 15th, 2006  |  Published in Technology

It seems that I am finding Google Calendar (currently being referred to as gCal by technopiles) an alternative to Outlook lately. Even though I wish that Google would finish up implementing some kind of syncing between gCal and Outlook already. But luckily, there’s a “hack” that helps out in that side of things. I guess its enough to hold me down for a bit till something from Google comes about.

Anyways, one of the other things that I was hoping gCal to have was a simple to-do list(s), aka. Tasks for those Outlook-oriented people. As I was Blingo-ing for an integration of some kind of to-do list with gCal, this article was on top of the list by Matias Pelenur. It does the job using JS, GM and FireFox. Although at the moment, it only saves your to-do list per GM install; locally that is, per computer. But there are a couple of workarounds that can be done to make it store to services such as Amazon S3, gCal itself, etc. as noted by Matias.

Supposedly, Google mentioned the availability of an “Account Authentication Proxy for Web Applications” feature that will be intergrated with their gCal API in late April… this past April in fact. I guess we’ll just have to wait for an update on Matias about that, or from Google regarding their own home-blended to-do list integration with gCal.