Thursday, February 10, 2011

Blogging from the Terminal

So I guess this would count as my second post for today, but I just found something so incredibly cool that it'll knock all of your socks off. Okay, probably not. In any case, here goes:

So I was blogging from nano today (this involved my last post in the car) when I realized (after having posted) that nano does this really annoying thing where it adds in these line breaks at certain intervals in the text when word-wrap is turned off to allow for the word-wrap to appear to work. Why use word wrap? Mainly because it bugs me to continually type all on the same line and not be able to see what I was typing a bit further up on the page. But now it's adding line breaks. What do? Well, you see, I had actually developed a perl script to get rid of these pesky line breaks and retain the double-line breaks, and thankfully because of my packrat nature I was able to recover it. Helps to be a packrat, you know?

Later on, I actually started getting into pastebin, although I can't say I'm an avid fan of using it. I mainly just realized that I could use pastebin to embed source code on my blog. Why is that cool? Well, you see, I figured that eventually I'd get into posting code on my blog, and instead of creating my own blog and developping all of those features, I can just upload the code to pastebin and use an iframe to display it. Huzzah!! So just to show it off, here's the code I used to get rid of all of those extra newlines that were in the post that I just typed:



EDIT: Unfortunately, the API doesn't like the way I code (apparently I'm supposed to use curl, but I really don't want to...), so my code is actually currently being impeded by a captcha field.

No comments:

Post a Comment