Add a dfff function for URLs #211

Closed
wants to merge 2 commits into
from

Projects

None yet

3 participants

@robcolburn

Comes in handy for me

@mathiasbynens mathiasbynens commented on the diff Jun 5, 2013
.functions
@@ -251,3 +251,21 @@ function gi() {
local IFS=,
eval npm install --save-dev grunt-{"$*"}
}
+
+# Compare two urls
+# Usage: `urldiff http://beta.example.com http://www.example.com`
+function urldiff () {
+ local file
+ local files=""
+ for url in "$@"
+ do
+ file="urldiff-"${url//[^a-zA-Z0-9]/}
+ files=$files" "$file
+ echo "downloading $url > $file"
+ lwp-request -m 'GET' $url > $file
@mathiasbynens
mathiasbynens Jun 5, 2013

Honest question: why lwp-request instead of just curl?

@robcolburn
robcolburn Jun 5, 2013

Honestly, I'm a bit of a shell-scripting novice, and I just copied the GET alias from this repo. :)

Is there a strong reason to go with curl instead? While lwp has perl-dependance and weaker performance, I like that it has prompting for http-auth credentials.

@hkdobrev

You can diff URLs by using vimdiff or vim -d.

Simply vim -d http://example.com/abc.html http://example.com/xyz.html.

Source: http://gingerjoos.com/blog/linux/vimdiff-the-cool-way-to-diff-for-vim-users (the bonus on the bottom of the article).

@mathiasbynens

Woo, I didn’t know about vim -d. Awesome!

Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment