(Source: en.wikiquote.org)
(Source: en.wikiquote.org)
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.
I now feel like I’ve been coding JS in the stone age all these years… Definitely a must have for any devs familiar with with C# LINQ, or anyone looking to work with a lot of collections on front end.
Example:
var jsonArray = [
{ "user": { "id": 100, "screen_name": "d_linq" }, "text": "to objects" },
{ "user": { "id": 130, "screen_name": "c_bill" }, "text": "g" },
{ "user": { "id": 155, "screen_name": "b_mskk" }, "text": "kabushiki kaisha" },
{ "user": { "id": 301, "screen_name": "a_xbox" }, "text": "halo reach" }
]
// ["b_mskk:kabushiki kaisha", "c_bill:g", "d_linq:to objects"]
var queryResult = Enumerable.From(jsonArray)
.Where(function (x) { return x.user.id < 200 })
.OrderBy(function (x) { return x.user.screen_name })
.Select(function (x) { return x.user.screen_name + ':' + x.text })
.ToArray();
// shortcut! string lambda selector
var queryResult2 = Enumerable.From(jsonArray)
.Where("$.user.id < 200")
.OrderBy("$.user.screen_name")
.Select("$.user.screen_name + ':' + $.text")
.ToArray();Hot.
curl http://something/xml | xmllint —format -And to format JSON on the command line
curl http://something/json | python -mjson.tool
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"
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.
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.
// 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