Twitter feed example

Find the code on GitHub.

Posted in HTML, JavaScript | Leave a comment

Holi festival at Stanford

This gallery contains 13 photos.

Full version of the dance…

More Galleries | Leave a comment

Nina fait de la bicyclette !

Posted in Uncategorized | 1 Comment

Les princesses du dimanche matin

Posted in Dance | 1 Comment

Indian Dance Class

Posted in Dance, Music | Comments Off

Custom JavaScript String Functions

I’ve created some missing native JavaScript String function to trim, convert to camel case, to underscored and to dashed formats.

Here is the trim() function (gist page):

/**
 * trim: removes leading and trailing white space
 */
String.prototype.trim = function () {
	return this.replace(/^\s+|\s+$/g, "");
};

And the toCamelCase() function (gist page):

/**
 * toCamelCase: converts string to camel case
 */
String.prototype.toCameCase = function () {
	return this.replace(/^\s+|\s+$/g, "")
		.toLowerCase()
		.replace(/(\s[a-z0-9])/g, function ($1) {
			return $1.replace(/\s/, '').toUpperCase();
		})
		.replace(/\W/g, '');
};

And the toDashed() function (gist page):

/**
 * toDashed: converts string to dashed
 */
String.prototype.toDashed = function () {
	return this.replace(/^\s+|\s+$/g, "")
	.toLowerCase()
	.replace(/-/g, '')
	.replace(/(\s[a-z0-9])/g, function ($1) {
		return $1.replace(/\s/, '-');
	})
	.replace(/[^a-z0-9-]/g, '');
};

And finally, the toUnderscored() function (gist page):

/**
 * toUnderscored: converts string to underscored
 */
String.prototype.toUnderscored = function () {
	return this.replace(/^\s+|\s+$/g, "")
	.toLowerCase()
	.replace(/_/g, '')
	.replace(/(\s[a-z0-9])/g, function ($1) {
		return $1.replace(/\s/, '_');
	})
	.replace(/[^a-z0-9_]/g, '');
};
Posted in JavaScript, Tech | Tagged , , , | Comments Off

Irish Dancing

This one goes out to Tom and Claire.

Posted in Child's Mind, Fun with Family | Comments Off

Ballet Cleaners

Posted in Child's Mind, Humor | Comments Off

Showing selected drop-down option in WordPress archive select menu

I needed to show as selected, the option in the WordPress archives drop-down menu (<select>) corresponding to the current page address. One possibility was to alter the get_archives_link(…) function in the /wp-includes/general-template.php. Doing so meant the modification would get over written if WordPress were updated, so I opted to add a custom modifier in the functions.php file of the custom WordPress 3.0 theme I was creating.

Here’s my custom modifier function from my functions.php file:

function get_archives_option_mod ( $link_option ) {
   preg_match ("/value=[\'\"](.+?)[\'\"]/", $link_option, $url);
   $requested = "http://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}";
      if ($requested == $url[1]) {
         $link_option = str_replace("<option value=", "<option selected=\"selected\" value=", $link_option);
      }
      return $link_option;
   }
add_filter("get_archives_link", "get_archives_option_mod");
Posted in php, Tech | Comments Off

Le filles chantent Rudolf

Posted in Child's Mind | Comments Off