Wednesday, October 10, 2012

Include jQuery in the Browser JavaScript Console

To play around with jQuery in your browser's JavaScript Console, copy and paste the following lines!
var jq = document.createElement('script');
jq.src = "http://code.jquery.com/jquery-latest.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
jQuery.noConflict();

Thursday, July 12, 2012

Using changelist for SVN

Changelist is useful for organizing your code changes when you're working on more than one projects. You can mark files with different changelist flags to keep them organized.

For example, we changed three files for ticket 66, and then commit them all together later:
$ svn changelist ticket66 a.py b.py c.py
Path 'a.py' is now a member of changelist 'ticket66'.
Path 'b.py' is now a member of changelist 'ticket66'.
Path 'c.py' is now a member of changelist 'ticket66'.
$ svn status
A       someotherfile.py
A       test/sometest.py

--- Changelist 'ticket 66':
A       a.py
A       b.py
A       c.py
$ svn commit --changelist ticket66 -m "Fixing ticket 66."
Adding         a.py
Adding         b.py
Adding         c.py
Transmitting file data ...
Committed revision 2.

Wednesday, May 9, 2012

Integer validation in JavaScript

function isInteger(val) {
    var intRegEx = /\D/g;
    return (!intRegEx.test(val));
}

Tuesday, March 20, 2012

Request the parent window to open a URL from an iframe with different domains

Sometime we are developing something within an iframe, but we want the parent window to refresh or open a URL. The code to use is:
top.location.href = URL;

Thursday, March 8, 2012

SVN commands

Create a patch
svn diff > ~/fix_ugly_bug.diff

Apply a patch
patch -p0 -i ~/fix_ugly_bug.diff

Monday, March 5, 2012

Text lineup using html span tag

<style type="text/css">
span {
  display: inline-block;
  width: 50px;
}
</style>

Tuesday, January 31, 2012