Development

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 »

Bash Completion, Along with SVN and Git Tab Completion

February 9th, 2009  |  Published in Development  |  Comment

Time is precious. I installed these utilities to save some of it:

I install bash-completion via MacPorts on my Macs.

sudo port install bash-completion

I then saved this svn-completion script to locally, and did a sudo cp:

sudo cp bash_completion /opt/local/etc/bash_completion.d/svn-completion.sh

Note: “bash_completion” is the file linked on “svn-completion script“. I hope that avoids confusion.

Last but not least, I then installed the git-completion script. I first checked the version of Git I have via MacPorts which happens to be 1.6.0.5.[1] I then saved and untarred the Git tarball of the version I have locally. Then did another sudo cp of the actual git-completion script to the same directory where my svn-completion.sh is located at:

sudo cp git-1.6.0.5/contrib/completion/git-completion.bash /opt/local/etc/bash_completion.d/git-completion.sh

After that, I added the following to to my .profile (or .bash_profile):

# for bash-completion
if [ -f /opt/local/etc/bash_completion ]; then
    . /opt/local/etc/bash_completion
fi
source /opt/local/etc/bash_completion.d/svn-completion.sh
source /opt/local/etc/bash_completion.d/git-completion.sh

Either restart your Terminal, or re-execute your .profile, and that would do it.

For more info on Git completion, check out this article by Kamal Fariz (bitfluent).

  1. Got it by using git version. []

Git Info – Almost Like “svn info”

February 9th, 2009  |  Published in Development  |  Comment

I have been trying to find something like svn info but for Git. Luckily, I stumbled upon Duane Johnson’s script. Here’s git-info.sh:

#!/bin/bash

# author: Duane Johnson
# email: duane.johnson@gmail.com
# date: 2008 Jun 12
# license: MIT
#
# Based on discussion at http://kerneltrap.org/mailarchive/git/2007/11/12/406496

pushd . >/dev/null

# Find base of git directory
while [ ! -d .git ] && [ ! `pwd` = "/" ]; do cd ..; done

# Show various information about this git directory
if [ -d .git ]; then
  echo "== Remote URL: `git remote -v`"

  echo "== Remote Branches: "
  git branch -r
  echo

  echo "== Local Branches:"
  git branch
  echo

  echo "== Configuration (.git/config)"
  cat .git/config
  echo

  echo "== Most Recent Commit"
  git --no-pager log --max-count=1
  echo

  echo "Type 'git log' for more commits, or 'git show' for full commit details."
else
  echo "Not a git repository."
fi

popd >/dev/null

I made an alias in my .profile to make it a bit more accessible:

alias gi='. /Users/$USER/git-info.sh'

Clearfix Revisited

January 30th, 2009  |  Published in Development  |  Comment

The new style rules I’m using:

.clear:after {
    content:" ";
    display:block;
    height:0;
    clear:both;
    visibility:hidden;
    font-size:0;
}
.clear { display: inline-block; }
/* Hides from IE-mac \*/
* html .clear { height:1%; }
.clear { display:block; }
/* End hide from IE-mac */

For more information on the update, have a read over at Jeff Starr’s Perishable Press article. If you are completely new to this technique, it originated from this article.

vBulletin and Internet Explorer 8 Compatibility

January 21st, 2009  |  Published in Development

If you are experiencing some display issues in IE8 with your vBulletin-based forums (and/or general sites), you might want to try adding the following meta-tag in your HEAD section:

<head>
    ...
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
    ...
</head>

You may get more info about this meta-tag and issues that might be connected with IE8’s strictness at the IEBlog, and/or via this Microsoft Support article.