“Je n’ai fait celle-ci plus longue que parce que n’ai pas eu le loisir de la faire plus courte.”
— Blaise Pascal, 1657

(Source: en.wikiquote.org)

Gundo - Visualize your Vim Undo Tree

From the homepage:

“You know that Vim lets you undo changes like any text editor. What you might not know is that it doesn’t just keep a list of your changes — it keeps a goddamed tree of them.
Gundo is a plugin to make browsing this ridiculously powerful undo tree less painful.”

Definitely exceeded my expectations and is becoming one of my favorite plugins. Building in a diff view is genius.

Gundo on Bitbucket

Gundo - Visualize your Vim Undo Tree

From the homepage:

“You know that Vim lets you undo changes like any text editor. What you might not know is that it doesn’t just keep a list of your changes — it keeps a goddamed tree of them.

Gundo is a plugin to make browsing this ridiculously powerful undo tree less painful.”

Definitely exceeded my expectations and is becoming one of my favorite plugins. Building in a diff view is genius.

Gundo on Bitbucket

Format XML/JSON on the command line

codeshal:

Hot.

curl http://something/xml | xmllint —format -

And to format JSON on the command line

curl http://something/json | python -mjson.tool


Curl Login & Upload (Batch Script)

curl "http://example.com/logon" ^
	--data-urlencode "rememberMe=true" ^
	--data-urlencode "email=test@example.com" ^
	--data-urlencode "password=foobar" ^
	--cookie "cookies.txt" ^
	--cookie-jar "cookies.txt" ^
	--location ^
	--verbose ^
	> "login_result.html"

FOR /R C:\temp\img\ %%G IN (*.*) DO ^
curl "http://example.com/upload" ^
	--form "Id=1337" ^
	--form "Description=Scripted Upload" ^
	--form "associatedFile=@%%G;type=image/jpeg" ^
	--cookie "cookies.txt" ^
	--cookie-jar "cookies.txt" ^
	--location ^
	--verbose ^
	> "upload_result.html"

Concise alternative to javascript switch

PandaUploader.getHttpStatusText = function(statusCode) {
    return {
        400: "Bad Request",
        401: "Unauthorized",
        404: "Not Found",
        412: "Precondition Failed",
        415: "Unsupported Media Type",
        500: "Internal Server Error"
    }[statusCode*1]
};

The *1 forces statusCode to a number and looks up the corresponding string value in the json object.

Via Panda Stream Uploader on Git

jQuery Waiting Dots - A simple alternative to GIFs

Example: Click me!

// Adds dots ... while the element has the waiting class
jQuery.fn.waitingDots = function(waitingClass, maxDots, onComplete) {

	var e = $(this);
	var term = e.val() || e.text();
	e.addClass(waitingClass);

	var count = 0;
	var numDots = maxDots || 3;

	var interval = setInterval(function() {
		if (!e.hasClass(waitingClass)) {
			clearInterval(interval);
			onComplete.apply(e);
		}
		else {
			var newText = term + " .".take(count);
			e.val(newText).text(newText); // Update text
			count < numDots ? count++ : count = 0;  // Update counter
		}
	}, 400);

};

Example of Use:

$('#button').click(function(e) {
	
	var button = this;

	$(button).text("Saving ");

	setTimeout(function() {
		$(button).removeClass("waiting");		
	},5000);

	$(button).waitingDots("waiting", 4, function(e) {
		$(button).text("Yay, it worked!");
	});

	e.preventDefault();
});

Note: Requires take() function, available here.

Javascript Take()

// Adds "x".take(3) == "xxx"
String.prototype.take = function(num) {
    return new Array(num + 1).join(this);
}

[ Python & Ruby Log ]
Author: Jason R Seney

Key: [+ good] [- bad] [~ indifferent]

_____( Python )____

+ Exellent scientific computation libraries
- No syntatic markup, just indents
+ Tons of built in functionality
+ Consise code
+ Easy imports
+ Has automatic enumeration with ” for i in array: “
~ Many functions are global for type “casting”
ex: str(x) where x=4 , len(myList) where myList = [1,2,3]


_____( Ruby )_____

+ Interactive mode usefull for quick tests of code
+ AWSOME Regex support! Sooo easy to use and get back references
ex. “This is a test”.match(/(\w+) (\w+)) puts x[0] puts x[1]
- No support for incrementors/decrementors ( “n++” or “—i” etc)
- Can use {} or “do … end” or “if … end” which leads to inconsistancy
- Uses blocks instead of for(int i=0; i