Archive for the ‘Tools’ Category

j (or z) and gr (git root) For Command Line Awesomeness

October 25th, 2011 by Aaron N.

Here’s a little command line utility I use the hell out of:

https://github.com/rupa/z

Basically, this script tracks the directories you cd into on the command line and builds a rank order of their locations. Here’s a chunk of mine (with some fake directory names to protect the innocent):

8.93693 /Users/aaron/Development/mootools-development
17.5369 /Users/aaron/Development/foo
36.132 /Users/aaron/Development/bar
36.6632 /Users/aaron/Development/i/like/cookies
52 /Users/aaron/Development/what/do/we/have/here
97.5176 /Users/aaron/Development
270.192 /Users/aaron/Development/clientcide/Source/Interface
483.024 /Users/aaron/Development/clientcide/Source

If I type “z Source” I’ll automatically jump to that last line because it’s the highest ranked entry that matches that string. “z interface” will take me to the line above it. “z Devel” will take me to the line above that. It’s remarkably smart; it’s very rare that I end up somewhere other than what I want to be, even when I only use one or two characters from the location I’m after (“z clientcide” takes me to clientcide/Source, which may not be what I wanted).

Note: Originally it was called “j” (https://github.com/rupa/j) and I got so used to using that alias that I have “j” aliased to this script. z is the more recent implementation.


Oh, and here’s another one:

alias gr='[ ! -z `git rev-parse --show-cdup` ] && cd `git rev-parse --show-cdup || pwd`'

That command (gr) will take me to the root of any git repo I’m in.

-a

Developing MooTools with my Dev App

June 25th, 2011 by Aaron N.

My last few posts have covered the development sandbox I’ve been working on for the last few months. I thought I’d take the time to crank out a screencast of what it does and how you use it.

This video walks through the MooTools Development application. More about it here:

If you’d like to see the text a bit clearer, I suggest you download the source movie at Vimeo.

Firebug 1.4 Alpha – Worth It

May 4th, 2009 by Aaron N.

I had a nice email exchange with one of the guys on the Firebug team recently. Basically, I miss Firebug 1.2 w/ Firefox 2.0, but Firefox 3 has some features I really don’t want to live without. In our email conversation, I shared a laundry list of issues that I’ve observed Firebug 1.3 doing that make my life less awesome.

Anyway, one of the suggestions I got was to upgrade to the alpha version of Firebug 1.4 and, I gotta say, it’s worth it. It’s not quite as solid as things were back on Firefox 2, but it’s way better than Firebug 1.3.

You can grab the latest builds here: http://getfirebug.com/releases/firebug/1.4/?C=M;O=A (My Firebug friend recommends the most-recent, currently 1.4a22).

MooBugger – the MooTools JavaScript Console

January 13th, 2009 by Aaron N.

This is actually kind of old news, but it’s something that never really got released. Valerio and I spent a few weeks a while back putting together a bookmarklet that would give you a Firebug-style JavaScript console for browsers without Firebug (IE, Safari, etc).

It supports console.log statements in the various formats that Firebug supports (“console.log(‘foo: %s, bar: %o’, foo, bar);”) and is really useful for debugging your code in non-Firebug browsers. I like to use it in conjunction with X-RAY to solve layout issues, too.

To use it, all you need to do is drag the link on the bookmarklet page into your bookmarks and then click it on any page to bring up the console (I.E. you have to right click and choose “Add to Favorites”).

You can see it in action on the test page.

Note: If you have Firebug installed and enabled, it doesn’t do anything.

Aptana Support for MooTools

January 5th, 2009 by Aaron N.

Over on the MooTools google group, Lori (who works for Aptana) posts:

Hi gang

Last week I finally added support for MooTools 1.2.1 to Aptana Studio — apologies for the delay. To get the updated plugin, do the following:

  1. First, if you do not have it already, get Aptana Studio (http://www.aptana.com/studio). It’s free.
  2. In Aptana Studio, open the Plugins Manager by choosing Window > Show View > Other… > Aptana Standard Views > Plugins Manager.
  3. In the Plugins Manager, select MooTools 1.2.1 and click the green + icon at the top right of the panel to install.
  4. In the Updates dialog box, expand the tree until you see the available “Aptana Support for MooTools” plugins. Select Aptana Support for MooTools 1.2.1.00001 and click Next.
  5. In the Install dialog box, accept the terms of the license agreement and then click Next.
  6. In the Verification dialog box, click Install.
  7. In the next Install dialog box, click Finish.
  8. Aptana Studio will begin downloading the MooTools 1.2.1 plugin.
  9. Click Yes when you’re prompted to restart.

I’ve tested plugin installation with Aptana Studio 1.2 and 1.2.1; let me know if you have any problems. If you’re using an earlier version of Studio, you may need to upgrade (again, it’s free!) in order to
install the MooTools 1.2.1 plugin.

If you need to post questions for her you should probably do so on the thread.

Why You Should Consider Releasing Code

December 31st, 2008 by Aaron N.

I posted the other day about Ian Collins’ Moo-ish Template, a scaffold for putting together your own JavaScript library organized as MooTools does (and as I do for Clientcide). But let me tell you why I think you should.
Read the rest of this entry »

MooTools for Greasemonkey

December 3rd, 2008 by Aaron N.

Over on the MooTools Google group, David Nolen (of ShiftSpace) writes:

For those of you who are GreaseMonkey hackers I’ve created a fork of MooTools Core on GitHub that can be loaded into a GreaseMonkey script via @require. We’ve been using this fork for our open source meta/hack/web project ShiftSpace. You’ll need need to have ruby and the json ruby gem installed on your machine in order to build the mootools-core.js file.

Of course there may be issues, if you run into trouble let us know.

Get it here:
http://github.com/swannodette/mootools-core/tree/master

The Clientcide Test Framework

October 27th, 2008 by Aaron N.

MooTools ships with a copy of JSSpec and a suite of tests that validate much of the core functionality of the MooTools framework. The Clientcide libraries include tests for this suite that we use to validate our work (you can see those here).

These tests are great at determining tests that can be validated instantly by a computer. Does 2 + 2 = 4? If not, something is wrong. But they don’t do such a good job when the result is asynchronous (like with Ajax) or when the test requires user interaction (like dragging). Did the item fade in? Can you drag this? If you submit this form does the result load below? These kinds of tests don’t work in a test suite like JSSpec.

So I’m releasing the Clientcide Test Framework that does just this. It allows you to quickly author a test and any accompanying html that goes with it and then pose questions to the tester that they must answer yes or no to.

For example, let’s say we wanted to test our FormValidator class. The test file for it would look like this:

{
	tests: [
		{
			title: "Form.Validator",
			description: "Validates that a form's inputs are correct.",
			verify: "Fill out the form as described and submit it. Were errors reported correctly?",
			before: function(){
				new FormValidator('foo', {
					serial: false,
					onFormValidate: function(passed, form, event){
						event.stop();
						if (passed) alert('form validated');
						else alert('form did NOT validate');
					}
				});
			}
		}
	]
}

Then we’d have an accompanying html file with a form it that would validate (I won’t paste it here).

This allows developers to write a quick test and develop code against it in a “clean” environment. The test framework has a “vanilla” iframe with almost no javascript in it by default (basically only a few methods used by the test framework). When the user loads a set of tests, the iframe loads the dependent scripts and then displays the tests for the user to run.

The other bit of useful integration is the script.json convention used in MooTools. Basically, in MooTools, there’s a file called scripts.json that lists each file in the library and it’s dependencies. This enables things like our downloads builder. The test framework uses this file to load the dependencies for a given test, and, in turn, the test allows you to verify that the scripts.json file is accurate and that the correct dependencies are being loaded.

Thought the test framework is written in MooTools (1.2.1), the test environment itself is completely vanilla. Other than the scripts.json convention, which anyone can use, it is not specific to MooTools in any way.

The suite is entirely authored in JavaScript, which means that it can be deployed anywhere, allowing you to write tests that interact with back-end server-side code. It can also be run from the deskt

The framework comes with an example set of scripts and tests for those scripts. These don’t use MooTools at all. You can read more about how to use the framework on it’s readme page and see the tests in action on the tests pages.

You can see Clientcide’s tests as well, which are a better indication of how the framework might be used.

The framework is available for download via Googl’es svn services:

http://code.google.com/p/clientside-test-framework

jsBin – a better pastebin

October 9th, 2008 by Aaron N.

A very nifty take on community js debugging. Check out jsBin.com. via Ajaxian (full post):

Pastebins have become an important part of sharing code with colleagues. Sites such as Pastebin & Pastie.org are extremely popular because they’re easy to use and very effective in letting people compare notes on source code, especially in a support setting.

Remy Sharp wanted to take the pastebin concept a step further, past the static posting of code. His idea, which he tossed around for 6 months, finally came to fruition in the form of JS Bin, a new pastebin site with a twist:

JS Bin is a form of paste bin, but with a twist. It allows you to also include the HTML and CSS to provide context to your pasty. As such, it means you can actually run the JavaScript and pass this on to a colleague to help to debug.

This is a great idea as it lets you troubleshoot your code while seeing immediate results. The feature list is well thought out as well.

Anyone read the book yet?

September 18th, 2008 by Aaron N.

Ok. I’m dying to know. Who has read the MooTools book (or at least flipped through it)? I need some feedback here!

P.S. Anyone who writes a review on Amazon (positive or negative so long as it’s honest) gets top priority for the next change request they send in (sorry, that’s the best bribe I could come up with).