<?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/String</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Thu, 23 May 2013 11:29:59 GMT</pubDate>
<item>
<title>(Bash) test that pwgen does not produce duplicate words</title>
<link>http://snipplr.com/view/45623/test-that-pwgen-does-not-produce-duplicate-words/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sat, 11 Dec 2010 15:20:34 GMT</pubDate>
<guid>http://snipplr.com/view/45623/test-that-pwgen-does-not-produce-duplicate-words/</guid>
</item>
<item>
<title>(Bash) Grep for files that do not match a pattern</title>
<link>http://snipplr.com/view/16699/grep-for-files-that-do-not-match-a-pattern/</link>
<description><![CDATA[ <p>The -L option lists files that do *not* contain a line matching the pattern given.</p> ]]></description>
<pubDate>Mon, 06 Jul 2009 16:37:12 GMT</pubDate>
<guid>http://snipplr.com/view/16699/grep-for-files-that-do-not-match-a-pattern/</guid>
</item>
<item>
<title>(Perl) Fuzzy string matching with Perl</title>
<link>http://snipplr.com/view/16365/fuzzy-string-matching-with-perl/</link>
<description><![CDATA[ <p>Fuzzy string matches with Jarkko Hietaniemi's String::Approx module.

**Get approximate matches, close to what you want.**  This is great for when you have filenames that might contain misspellings, extra underscores or other typos and mistakes.  Also great for searching for files when there are several different naming conventions used within a project.

Mainly I am concerned with being able to match strings that have underscores inserted (or deleted) in arbitrary places.  But the result I came up with here, does a pretty good job of matching when there are all sorts of typos, without picking up *too* many false positives.</p> ]]></description>
<pubDate>Sat, 27 Jun 2009 01:09:08 GMT</pubDate>
<guid>http://snipplr.com/view/16365/fuzzy-string-matching-with-perl/</guid>
</item>
<item>
<title>(JavaScript) Alter an existing, hard-coded onclick function</title>
<link>http://snipplr.com/view/10273/alter-an-existing-hardcoded-onclick-function/</link>
<description><![CDATA[ <p>Get the existing hardcoded function, convert it to a string, edit the string.
Then strip the string down to just the function body, re-instantiate the string into a function, and assign it back to the onclick handler.

The code here is extremely site-specific.  Here's what the original onclick function I was working against looked like:

    new Ajax.Request('/publications?categories%5B%5D=1,2,3', {asynchronous:true, evalScripts:true, method:'get', parameters:'authenticity_token=' + encodeURIComponent('6b670face4ca93ce4bf53def7685d8663780b7d9')}); return false;

The code below just changes the query string in the first parameter.  The idea being that you have a bunch of checkboxes with IDs like foo-1, foo-2, and you want that query pram to reflect the number thats appended to the end of each checkbox's ID.  

Not that you want to do that :)  But hey, these kinds of situations sometimes come up in production.   Anyway, the **interesting bit** is JavaScript's ability to **break a function down into a string, edit the string, and then re-instantiate the string as a new function,** possibly overriding the original.

Functions as data: Mmmm... Lispy.

Tested only in Firefox 3 but should work in any browser.</p> ]]></description>
<pubDate>Thu, 04 Dec 2008 19:12:10 GMT</pubDate>
<guid>http://snipplr.com/view/10273/alter-an-existing-hardcoded-onclick-function/</guid>
</item>
<item>
<title>(Bash) Alias a command and save it in .profile</title>
<link>http://snipplr.com/view/7400/alias-a-command-and-save-it-in-profile/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sat, 19 Jul 2008 13:03:50 GMT</pubDate>
<guid>http://snipplr.com/view/7400/alias-a-command-and-save-it-in-profile/</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>(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>(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>(JavaScript) keys: get an array of all property names in an object</title>
<link>http://snipplr.com/view/2841/keys-get-an-array-of-all-property-names-in-an-object/</link>
<description><![CDATA[ <p>do the same thing as the Perl "keys" subroutine</p> ]]></description>
<pubDate>Mon, 11 Jun 2007 08:56:49 GMT</pubDate>
<guid>http://snipplr.com/view/2841/keys-get-an-array-of-all-property-names-in-an-object/</guid>
</item>
<item>
<title>(JavaScript) Trim trailing white space</title>
<link>http://snipplr.com/view/2840/trim-trailing-white-space/</link>
<description><![CDATA[ <p>Trim whitespace at the end of a line</p> ]]></description>
<pubDate>Mon, 11 Jun 2007 08:55:47 GMT</pubDate>
<guid>http://snipplr.com/view/2840/trim-trailing-white-space/</guid>
</item>
<item>
<title>(JavaScript) Accept a parameter that is /either/ a DOM element /or/ the ID of a DOM element.</title>
<link>http://snipplr.com/view/2710/accept-a-parameter-that-is-either-a-dom-element-or-the-id-of-a-dom-element/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Thu, 24 May 2007 13:40:48 GMT</pubDate>
<guid>http://snipplr.com/view/2710/accept-a-parameter-that-is-either-a-dom-element-or-the-id-of-a-dom-element/</guid>
</item>
</channel>
</rss>