<?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</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Sun, 06 Jul 2008 21:26:47 GMT</pubDate>
<item>
<title>(Other) Confluence table of contents</title>
<link>http://snipplr.com/view/7102/confluence-table-of-contents/</link>
<description><![CDATA[ <p>Creates a numbered table of contents showing the first 2 logical levels of the document.</p> ]]></description>
<pubDate>Thu, 03 Jul 2008 11:01:33 GMT</pubDate>
<guid>http://snipplr.com/view/7102/confluence-table-of-contents/</guid>
</item>
<item>
<title>(JavaScript) Conditionally assign a value to a variable</title>
<link>http://snipplr.com/view/6850/conditionally-assign-a-value-to-a-variable/</link>
<description><![CDATA[ <p>To assign a value to a variable only if some expression evaluates to true, I would usually do this:

var foo;
if (condition){
    foo = "success";
}


This is Douglas Crockford's idiom and it shortens the above from 4 lines to 1.

I have understood for a while that (expr1 &amp;&amp; expr2) evaluates to truth only if both conditions are true.  What I did not get before Crockford pointed it out in his book, was that &amp;&amp; doesn't simply return a boolean value -- it returns the result of the last expression that was evaluated.

So if both expressions evaluate to false, the result of first expression will be returned.  If only one expression evaluates true, the result of the false expression will be returned.  And if both expressions evaluate to truth, the result of the second expression is returned.</p> ]]></description>
<pubDate>Mon, 23 Jun 2008 08:44:59 GMT</pubDate>
<guid>http://snipplr.com/view/6850/conditionally-assign-a-value-to-a-variable/</guid>
</item>
<item>
<title>(Bash) grep for either of two strings</title>
<link>http://snipplr.com/view/6819/grep-for-either-of-two-strings/</link>
<description><![CDATA[ <p>Here's an example of using grep to filter for links that contain the string 'jpg' or 'gif'</p> ]]></description>
<pubDate>Fri, 20 Jun 2008 15:29:33 GMT</pubDate>
<guid>http://snipplr.com/view/6819/grep-for-either-of-two-strings/</guid>
</item>
<item>
<title>(Ruby) Post to Twitter from the shell</title>
<link>http://snipplr.com/view/6594/post-to-twitter-from-the-shell/</link>
<description><![CDATA[ <p>Put this in a file called twit.rb, then call as follows:
    ruby twit.rb username "my tweet"

Or you can include your password in the command like so 
    ruby twit.rb username:password "my tweet"

(note that this is hugely insecure as your password will wind up in your .history, not to mention being visible to shouldersurfers).

Also, I just noticed as I was posting this code, that there's a bug where if your tweet is too long and gets truncated, my script will claim you failed to post entirely.  I gotta go back and add logic to check the character count, but tbh I've never gone over 140 characters on the command line, tho I've posted daily with this script for the past several months.  Ymmv.</p> ]]></description>
<pubDate>Thu, 05 Jun 2008 09:23:47 GMT</pubDate>
<guid>http://snipplr.com/view/6594/post-to-twitter-from-the-shell/</guid>
</item>
<item>
<title>(JavaScript) List all class names used in a DOM tree</title>
<link>http://snipplr.com/view/6488/list-all-class-names-used-in-a-dom-tree/</link>
<description><![CDATA[ <p>Lists each CSS class name that is applied to an element within an HTML page.

Some applications suggested by this pattern are:
- List class names by frequency of use.
- List class names by what kind of element they are applied to.
- List class names that are only used once.</p> ]]></description>
<pubDate>Wed, 28 May 2008 17:31:41 GMT</pubDate>
<guid>http://snipplr.com/view/6488/list-all-class-names-used-in-a-dom-tree/</guid>
</item>
<item>
<title>(JavaScript) List all IDs in the DOM tree</title>
<link>http://snipplr.com/view/6487/list-all-ids-in-the-dom-tree/</link>
<description><![CDATA[ <p>List all the IDs on the page.</p> ]]></description>
<pubDate>Wed, 28 May 2008 17:27:18 GMT</pubDate>
<guid>http://snipplr.com/view/6487/list-all-ids-in-the-dom-tree/</guid>
</item>
<item>
<title>(JavaScript) Find Verbose IDs in the DOM</title>
<link>http://snipplr.com/view/6474/find-verbose-ids-in-the-dom/</link>
<description><![CDATA[ <p>Traverses the DOM tree and reports if any IDs are over 30 characters in length.  Doesn't check for doubled IDs because that's caught when validationg the HTML.</p> ]]></description>
<pubDate>Tue, 27 May 2008 17:08:12 GMT</pubDate>
<guid>http://snipplr.com/view/6474/find-verbose-ids-in-the-dom/</guid>
</item>
<item>
<title>(Bash) List commands in history, sorted by usage</title>
<link>http://snipplr.com/view/6135/list-commands-in-history-sorted-by-usage/</link>
<description><![CDATA[ <p>Thanks Ben!

Here's an example session:

May12 10:39:18 book> ~/Documents/n_s/tools/command-history.sh
162 quite
110 svn
107 ruby
61 curl
39 rwget
34 grep
33 cd
21 lwp-request
19 fg
17 ls</p> ]]></description>
<pubDate>Tue, 06 May 2008 15:24:05 GMT</pubDate>
<guid>http://snipplr.com/view/6135/list-commands-in-history-sorted-by-usage/</guid>
</item>
<item>
<title>(Other) Roll back a change in ClearCase</title>
<link>http://snipplr.com/view/5672/roll-back-a-change-in-clearcase/</link>
<description><![CDATA[ <p>The first command will revert  from version 10 to version 5, by "deleting" versions 6-10.  The second command rolls back to the version immediately before the most recent version.

If you don't check  out beforehand, the merge will be saved to a temp file (ClearCase will tell you the name of the temp file when it's created).</p> ]]></description>
<pubDate>Wed, 02 Apr 2008 18:23:47 GMT</pubDate>
<guid>http://snipplr.com/view/5672/roll-back-a-change-in-clearcase/</guid>
</item>
<item>
<title>(Bash) QuickBase add record from the command line</title>
<link>http://snipplr.com/view/5639/quickbase-add-record-from-the-command-line/</link>
<description><![CDATA[ <p>The field IDs (_fid_19) are specific to your QB instance.  See the API ref for how to figure out which field is which.

To get back the URL of the normal HTML confirmation page, add the argument -d "disprec=true"</p> ]]></description>
<pubDate>Mon, 31 Mar 2008 22:51:20 GMT</pubDate>
<guid>http://snipplr.com/view/5639/quickbase-add-record-from-the-command-line/</guid>
</item>
<item>
<title>(Bash) Get the length of a string on the command line with Ruby</title>
<link>http://snipplr.com/view/5584/get-the-length-of-a-string-on-the-command-line-with-ruby/</link>
<description><![CDATA[ <p>The following command prints 21.</p> ]]></description>
<pubDate>Thu, 27 Mar 2008 23:08:41 GMT</pubDate>
<guid>http://snipplr.com/view/5584/get-the-length-of-a-string-on-the-command-line-with-ruby/</guid>
</item>
<item>
<title>(Bash) LDAP/NTLM authentication on the command line with curl</title>
<link>http://snipplr.com/view/5578/ldapntlm-authentication-on-the-command-line-with-curl/</link>
<description><![CDATA[ <p>Note that curl will not follow redirects.  Will prompt interactively for password if the -u option is omitted.</p> ]]></description>
<pubDate>Thu, 27 Mar 2008 11:33:30 GMT</pubDate>
<guid>http://snipplr.com/view/5578/ldapntlm-authentication-on-the-command-line-with-curl/</guid>
</item>
<item>
<title>(Ruby) Regex replace</title>
<link>http://snipplr.com/view/5560/regex-replace/</link>
<description><![CDATA[ <p>Equivalent of the Perl code: url =~ s/foo/bar/</p> ]]></description>
<pubDate>Tue, 25 Mar 2008 14:09:21 GMT</pubDate>
<guid>http://snipplr.com/view/5560/regex-replace/</guid>
</item>
<item>
<title>(Ruby) Parse an XML document with REXML and print some of the text nodes</title>
<link>http://snipplr.com/view/5546/parse-an-xml-document-with-rexml-and-print-some-of-the-text-nodes/</link>
<description><![CDATA[ <p>Parses the XML file MY_FILE.xml, and prints the text from each record node's upload_list node, unless the upload_list node is empty.</p> ]]></description>
<pubDate>Mon, 24 Mar 2008 16:50:22 GMT</pubDate>
<guid>http://snipplr.com/view/5546/parse-an-xml-document-with-rexml-and-print-some-of-the-text-nodes/</guid>
</item>
<item>
<title>(Perl) lwp-request</title>
<link>http://snipplr.com/view/5196/lwprequest/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Mon, 25 Feb 2008 12:28:41 GMT</pubDate>
<guid>http://snipplr.com/view/5196/lwprequest/</guid>
</item>
<item>
<title>(Bash) wget -pkr</title>
<link>http://snipplr.com/view/5094/wget-pkr/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sat, 16 Feb 2008 21:42:46 GMT</pubDate>
<guid>http://snipplr.com/view/5094/wget-pkr/</guid>
</item>
<item>
<title>(Perl) Generate XHTML on the command line with XML::API::XHTML</title>
<link>http://snipplr.com/view/4971/generate-xhtml-on-the-command-line-with-xmlapixhtml/</link>
<description><![CDATA[ <p>Build a simple XHTML document, format it with Tidy and print the result to "temp.html."</p> ]]></description>
<pubDate>Sun, 10 Feb 2008 02:21:23 GMT</pubDate>
<guid>http://snipplr.com/view/4971/generate-xhtml-on-the-command-line-with-xmlapixhtml/</guid>
</item>
<item>
<title>(Bash) Validate XHTML with Tidy and/or OpenJade, just like the FF extension</title>
<link>http://snipplr.com/view/4970/validate-xhtml-with-tidy-andor-openjade-just-like-the-ff-extension/</link>
<description><![CDATA[ <p>Neither command will give any feedback unless invalid markup is found.</p> ]]></description>
<pubDate>Sun, 10 Feb 2008 02:14:45 GMT</pubDate>
<guid>http://snipplr.com/view/4970/validate-xhtml-with-tidy-andor-openjade-just-like-the-ff-extension/</guid>
</item>
<item>
<title>(Other) external hyperlink</title>
<link>http://snipplr.com/view/4937/external-hyperlink/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Thu, 07 Feb 2008 18:53:31 GMT</pubDate>
<guid>http://snipplr.com/view/4937/external-hyperlink/</guid>
</item>
<item>
<title>(Other) Confluence emoticons</title>
<link>http://snipplr.com/view/4931/confluence-emoticons/</link>
<description><![CDATA[ <p>List of emoticons for Confluence wiki.  Each of these emoticons will render a graphical symbol.</p> ]]></description>
<pubDate>Wed, 06 Feb 2008 22:18:03 GMT</pubDate>
<guid>http://snipplr.com/view/4931/confluence-emoticons/</guid>
</item>
</channel>
</rss>