The StripHtml function strips all the HTML tags in the passed string but preserves the ones specified in the PreserveTags array.
Inverse Hex Colors
With this function you can get the inverse of a color passed into as a hex value.
Array of States and Their Coordinates
An array of state abbreviations and their approximate GPS coordinates.
Extract Age from Birth Date
A Ruby function for extracting one’s age by passing in the birth date as a parameter.
Count Words In String
The simplest way to count words in a string using Ruby and regular expressions by splitting the string at each space.
Shorten a string with complete words
The Excerpt() function takes in a string and shortens it to the desired amount of characters, but without cutting into the middle of a word.
Mask All Credit Card Digits But Last Four
Mask all the credit card number digits with asterisks except the last 4, for security purposes. The function works for all types of cards (Visa, MasterCard, Amex, Discovery, etc.)
Array of States and their Abbreviation
An array of states and their two letter abbreviation written in Ruby, useful for populating dropdown lists.
Pronounceable Random Password Generator
This piece of code generates a random password of the specified length, but mixes the two sets of letters so that a pronouncable password is being generated.