Dec 18, 2010 • 10:50pm

category: frontend

tags: javascript, jQuery

Explaining jQuery: Part 2b, even more init function!

ok, starting up again. at line 130
if ( match && (match[1] || !context) ) {
So, match will exist if selector matches any part of that regex.

Dec 14, 2010 • 1:11am

category: frontend

tags: javascript, jQuery, regex

Explaining jQuery: Part 2a, more init function

quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/

The first part "^" matches the start of a string.

What's next?

(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)

Dec 12, 2010 • 3:05pm

category: frontend

tags: javascript, jQuery

Explaining jQuery: Part 2, the init function

When we left of last time we had the structure of the code that would get jQuery started. We had the constructor function, but it called an init function that wasn't written yet. On line 99, we see the expression:
jQuery.fn = jQuery.prototype = {

	...
};

jQuery.fn.init.prototype = jQuery.fn;
Whenever a new object is created, a object to be it's prototype is selected, and it inherits all of that objects properties. In this line, jQuery.fn is set equal to a reference to jQuery's prototype object.

Dec 5, 2010 • 12:03pm

category: frontend

tags: javascript, jQuery

Explaining jQuery: Part 1, Structure

Recently I was challenged to implement the .find() function of jQuery in pseudo code. I was stumped and kind of embarrassed. How could I not know how to write the most basic function of a library that I use almost every single day?

I spent all day yesterday digging into the acutal jQuery code to see how it worked.

The jQuery core is all executed inside an anonymous self-executing function that takes the window object as a parameter to keep it all sandboxed.

Nov 18, 2010 • 11:12pm

category: backend

tags: bash, command line, for loop, hacking

Baby's First Command Line For Loop

The more I get used to doing things in the command line, the more I love it! Seriously, once you get the hang of it it's just faster than doing a bunch of clicking around with your mouse.

Anyway I wanted to change the extensions of every .html file in a folder to .php


for file in *.html
> do
> mv ${file} `basename ${file} .html`.php
> done

Nov 16, 2010 • 7:05pm

category: frontend

tags: css3, html, selectors, wildcards

Wildcards in attribute selectors

While I was working on the theme for this site, I realized that I wanted to keep the navigation as flexible as possible; I didn't want to hardcode the nav. Still, I wanted to use image replacement on the links. I looked in the node.tpl.php and I saw this kooky function call printing out the primary navigation.

<?php print theme(array('links__system_main_menu', 'links'), $primary_links, array('id' => 'nav'));?>

Yikes! Not something that I wanted to dig through.

Nov 16, 2010 • 7:00pm

category: backend

tags: apache, backend, mysql, unix

Playing with mysql!

In order to get this site up, I'm building the theme on my local machine. Unfortunately, I forgot the username/password for my local copy of drupal, and I can't send myself an email to change it.

No worries though, I was a cs major. I should be able to just go into mysql and figure out what it was.

Genius time.. except that I don't remember the root password.. (which I found out I don't really need.. but.. here is how I fixed that problem)