Quick Ruby scripts
I've been attempting to more frequently write little fun scripts to help with tasks. A while back I learned about the __END__ keyword and DATA. In a ruby file, anything after __END__ becomes a comment. And each line is stored in a variable DATA. You can use this to do some pretty cool things. I've been using it to parse random strings.
Recently I needed to verify that all the images referenced css files were correct. I created this little script where I could paste my css in the file after __END__, parse out each instance of url('xyz'), and save them as <img src="xyz"> to a new html file where I can open and see whether they're all loading or not. And with a bunch of css files all I had to do was paste the css, run the file, and refresh my page.blog comments powered by Disqus