Sublime Snippet Basics
Yesterday I covered some tips and tricks I’ve learned over the past few months of using Sublime. Something I didn’t touch on is Sublime’s Snippet architecture.
Yesterday I covered some tips and tricks I’ve learned over the past few months of using Sublime. Something I didn’t touch on is Sublime’s Snippet architecture.
I’ve been using Sublime Text 2 for probably two months now and in that time I’ve discovered tons of useful tricks. I figured I should start writing them down for anyone who might be interested. I’ll try to explain the bits that seem esoteric because there are a lot of cool commands which only work in certain contexts.
I’m just getting my ass kicked by Ruby tonight so I don’t have much to show. Trying to just get my metadata scraping to output something currently looks like this:
Really ugly code that still doesn’t work. My biggest problem with Ruby is that I don’t have very good debugging tools and that frustrates the shit out of me. I’m so used to the visual debuggers in the Chrome Dev tools that doing everything with p
or puts
is just soul-crushing.
Yeesh, I gotta stop writing so late at night… Last night I was trying to get my spider to follow all the links on the blog’s archive page and then sum up all the words from every post. Unfortunately I was way too tired to get that to actually work. Tonight I finished that step of the process but it required some ugly code and refactoring our unit tests. Without further adieu…
Having a horrible time getting anything to run tonight. The code from above is a continuation from yesterday’s post except this time we’re finding every link on the page, then following that link and spitting out its title. Using this formula you could build something entirely recursive which acts as a full blown spider.
Unfortunately getting this to integrate into the existing app is not working for me tonight. Coding anything after 11 pm is usually a bad call, so I’m going to shut it down and try again in the morning.
You should follow me on Twitter here.
Short post tonight because I spent so much time figuring out the code. It’s late and my brain is firing on about 1 cylinder so it took longer than I expected to get everything working.
The scraper that I’m building is supposed to work like a spider and crawl of the pages of my blog. I wasn’t sure what the best way to do that was so I started Googling and came up with Mechanize. There are other tools built on top of Mechanize, like Wombat, but since my task is so simple I figured I could just write everything I needed with Mechanize and Nokogiri. It’s usually a better idea to work with simple tools when you’re first grasping concepts so you don’t get lost in the weeds of some high powered framework.