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

My git frequent commands

I’m writing this only for my own usage, so I have a place to find them when I need them. Do all of the following from within the local git project folder.

Initializing a repository

git init
git add *
git commit -m 'initial commit'

Then create your repository on Github: my_repo_name with my_user_account

git remote add origin git@github.com:my_user_account/my_repo_name.git
git push origin master

Checking what is not yet committed:

git status -s

Adding all new/updated files:

git add *

Adding a file by name:

git add /path/to/file

Committing the additions:

git commit -m 'comment for this commit'

Pushing the updates:

git push

Updating a local repository with remote content:

git remote update

Another useful one to delete remote files that were deleted locally:

for i in `git status | grep deleted | awk '{print $3}'`; do git rm $i; done
Posted in git, Tech | Tagged | Comments Off

Backwards Witch

Posted in Child's Mind, Music | Comments Off