<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr - noah</title>
<link>http://snipplr.com/users/noah/tags/simple</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Wed, 15 Feb 2012 06:37:30 GMT</pubDate>
<item>
<title>(HTML) Bookmarklet Template: turn any snippet of JavaScript code into a Bookmarklet</title>
<link>http://snipplr.com/view/22806/bookmarklet-template-turn-any-snippet-of-javascript-code-into-a-bookmarklet/</link>
<description><![CDATA[ <p>[Will](http://twitter.com/wschenk) originally showed me how easy it is to transform random JS snippets into bookmarklets.  Once you set up the HTML, just view it in Firefox, and then drag the link to your bookmarks toolbar.

The basic form is 

&amp;lt;a href="javascript:CODE;void 0;"&amp;gt;NAME&amp;lt;/a&amp;gt;

Where `CODE` is any arbitrary JavaScript code, and `NAME` is the name you want the bookmarklet to have once it has been added to the Firefox toolbar.

And of course *don't use the javascript: protocol* in your HTML pages -- although it's (only!) OK for bookmarklets.</p> ]]></description>
<pubDate>Mon, 09 Nov 2009 17:34:49 GMT</pubDate>
<guid>http://snipplr.com/view/22806/bookmarklet-template-turn-any-snippet-of-javascript-code-into-a-bookmarklet/</guid>
</item>
<item>
<title>(Perl) Grab linked files from a list of web pages</title>
<link>http://snipplr.com/view/3126/grab-linked-files-from-a-list-of-web-pages/</link>
<description><![CDATA[ <p>## how to use

`perl grabit.pl urls_for_download.txt`

Expects as argument the name of a file containing a newline-delimited list of URLs:

    http://example.com/coolstuff
    http://example.com/coolstuff/fun
    http://example.com/videos/explosions

When invoked, launches an interactive shell that asks what type of file should be downloaded.  Then downloads all the files that are linked from each of the listed Web pages.

Note that the location of the download folder is hard-coded to `c:/windows/desktop/grabit/` so you may want to change that before trying.

This script is also [available on Github](http://github.com/textarcana/scrapers/blob/643e6e7cb349fa94cbc3fc88e1d55c7b6a262d11/grabit.pl)

## Wait! Do you know about WGet and Curl?

This script is legacy.  People seem to like it (hey, I still use it) but today I would probably not write my own tool to download multiple files off remote sites.

Instead I would likely just use a command-line Web browser like [WGet](http://lifehacker.com/software/top/geek-to-live--mastering-wget-161202.php 'Gina Trapani of Lifehacker, on the way of the WGet ninja') or Curl.  [LWP-Request would also do the trick](http://snipplr.com/view/4063/download-linked-jpegs-from-a-web-page-on-the-command-line/)

## do not comment your code like this!

For a great explanation of the rather baroque commenting style I was using circa 2001, see [Steve Yegge's excellent article on code style: *Portait of a n00b.*](http://steve-yegge.blogspot.com/2008/02/portrait-of-n00b.html)  

Of course, when I sit down to write a Perl script today, I [use POD](http://snipplr.com/view/18611/perl-pod-embedded-documentation-example/) to format and publish my comments.</p> ]]></description>
<pubDate>Tue, 03 Jul 2007 22:31:30 GMT</pubDate>
<guid>http://snipplr.com/view/3126/grab-linked-files-from-a-list-of-web-pages/</guid>
</item>
<item>
<title>(JavaScript) Toggle the className of a DOM element</title>
<link>http://snipplr.com/view/2600/toggle-the-classname-of-a-dom-element/</link>
<description><![CDATA[ <p>Imagine an element that has two states, represented by two CSS classes named 'expanded' and 'contracted.'  This code toggles between the two states in the simplest possible fashion.</p> ]]></description>
<pubDate>Fri, 04 May 2007 08:45:52 GMT</pubDate>
<guid>http://snipplr.com/view/2600/toggle-the-classname-of-a-dom-element/</guid>
</item>
<item>
<title>(JavaScript) Calculate net paycheck</title>
<link>http://snipplr.com/view/2517/calculate-net-paycheck/</link>
<description><![CDATA[ <p>Given my base pay and an optional pre-tax 401k contribution percentage, calculate my net pay.  Assumes US income tax of 27%.  All results will be approximate (the browser is not a reliable calculator)!</p> ]]></description>
<pubDate>Mon, 23 Apr 2007 14:01:42 GMT</pubDate>
<guid>http://snipplr.com/view/2517/calculate-net-paycheck/</guid>
</item>
</channel>
</rss>
