jump to navigation

Email Regular Expression June 10, 2006

Posted by Lucanos in : programming, php, javascript, snippet , 1 comment so far

I found a site which had a very good regular expression to test email addresses, at http://www.codetoad.com/asp_email_reg_exp.asp.

However, one slight modification to their original test, which has been annoying me a bit as of late, is the addition of the plus symbol “+” as an acceptable character in the middle of the username section.

A terrific tool to test Regular Expressions is available at http://www.cuneytyilmaz.com/prog/jrx/. Well worth a visit.

The reason I have been using the “+” symbol and been running into lesser validators, is because GMail allows you to tack on tags behind your username to help you sort and manage your email inbox.

So I can subscribe to a newsletter with the address “lucanos+newsletter@gmail.com” (as “lucanos” is my GMail username) and then setup my GMail inbox rules so those emails are handled in a specific way.

It’s also a good way to identify sites which are selling your address, or spamming/ all you do, if required to provide an email address, is create one in the format “GMailUsername+SiteDomain@gmail.com“. Then, if I get spam to that specific email address I know where they got it from, as the culprit’s name will be included in the destination address.

Pretty tricky, hey?

DeviantART - Full-Viewer March 25, 2006

Posted by Lucanos in : programming, javascript, greasemonkey , 1 comment so far

If you have 17 inches, why not use all of it?“™

This GreaseMonkey userscript changes all links inside DeviantART.com and DeviouslyArtistic.com so that they point at the full-resolution image, rather than at the smaller preview page. Very handy when you are looking through alot of deviantions, as it cuts your clicks down by up to 50%! I created this userscript in August 2005. It was my first userscript, and, as such, started with a very simple, very clunky, very… inefficient way to perform the required actions. This script has been updated a number of times since then, fixing little glitches here and there.

UPDATE (2006/05/26):

Apparently, the option to always view images at Full-View is available as a preference for registered users (when logged in). To set this option go to Settings->Browsing and it’s there on the top left side “Open Deviations” - set it to “Zoomed In”. But, for non-subscribers, this script may still prove handy. But, still, deviantART is a community which is very rewarding to be a member of, so, if you enjoy it, Become A Deviant!

Version History:

How It Does What It Does:

  1. Create an array of all links on the page, using XPath.
  2. Identify the “Zoom Out” button, if present on the page
  3. Evaluate each of the links in turn.
  4. If the following conditions are matched, a replace is done changing “/deviation/” to “/view/” within the link’s href attribute.
    • If there is no “Zoom Out” button OR the current link is not the “Zoom Out” button.
    • If the current link does not end with “/scrap”

Enjoy!

DeviantART - Random Love January 16, 2006

Posted by Lucanos in : programming, javascript, greasemonkey , add a comment

Have you spread some Random Love today?“™

Share The Love!
This script adds buttons directing the user to A Random Deviant and/or a A Random Deviation to the main toolbar at the top of the screen (just beside the Shop button).

Version History:

How It Does What It Does:

  1. Finds the Toolbar (using an XPath).
  2. Creates the Random Buttons (including Base64 encoded icons - they’re embedded in the script)
  3. Inserts them after the Shop Icon
  4. Changes their titles (A workaround, still figuring the cause there…)

Enjoy!

Will-Get Widgets - Konfabulator (Yahoo! Widgets) December 16, 2005

Posted by Lucanos in : programming, javascript, greasemonkey , add a comment

Who says you have to go through B to travel from A to C?“™

After enduring the less-than-perfect interface provided by the Yahoo! Widgets Repository, (which involves a redirecting page to download the widget file, which invariably redirects you to the begining of the collection after each download) for more than I could handle (5 minutes), I decided that a GreaseMonkey solution was warranted.

Version History:

How It Does What It Does:

This script reads each of the links on any page within the Yahoo! Widgets galleryand, upon finding a link to the despised redirect page, changes it to point to the actual download page which the redirect page fires off.

Enjoy!

DeviantART - Print Upload v0.1 November 11, 2005

Posted by Lucanos in : programming, javascript, greasemonkey, deviantART, Print Upload , add a comment

Which piece of art do you want to commercialise today?“™

This GreaseMonkey userscript adds a link to your deviations (only visible to you - the deviation owner) allowing for the quick and easy, well, easier, uploading of deviations into the deviantART Store.

Version History:

How It Does What It Does:

  1. Looks for the “Send To Scraps” Button (which indicates that the shown Deviation is both yours and not (yet) a Scrap, as such it is eligible to offer via the store.
  2. Checks whether the “Buy Prints” button is shown. If not then it can be assumed that you haven’t yet uploaded prints.
  3. Locates the relevant section of the source code.
  4. Inserts the required code to produce the button and associated “div”s.
  5. Profit!

Enjoy!

Photobucket - Customisable Thumbnail Size November 8, 2005

Posted by Lucanos in : programming, javascript, greasemonkey , 1 comment so far

This GreaseMonkey userscript allows the user to specify their own thumbnail size for Photobucket.com.
NOTE: This script operates by accessing the full-resolutions of the images being processed and then squeezing them into the requested size on screen. As such this script is rather bandwidth-demanding, and is not recommended for people with bandwidth limits/slow connections.

Version History:

Configuration:

  1. In Firefox go to “Tools“.
  2. Select “Manage User Scripts“.
  3. Select “Photobucket.com Thumbnail Resizer“.
  4. Click the “Edit” Button.
    Your computer will open the Userscript file using your default HTML editor.
  5. In the coding find the line:
    var RequestedLongestEdge = “320“; // in pixels
  6. Modify the number in this line (in this case 320) to reflect your desired length for the longest edge (this measure is in pixels).
  7. Save the file.
  8. Reload your Photobucket page.

How It Does What It Does:

  1. Access the Array of Images
  2. Loop through them looking for images with filenames starting “th_” (which appears to be what Photobucket does to designate thumbnails
  3. Remove the “th_” if present (makes the thumbnail the original file)
  4. Determine the orientation of the image
  5. Make the longest side (width if landscape, height if portrait) the specified length

Enjoy!