How To Strip Windows Newlines in PHP

Author: , February 21st, 2018

$text = str_replace(“\r”, “”, $text);

How To Convert from mysql_ to mysqli_ in WordPress Plugins Easily

Author: , August 24th, 2016

As PHP deprecates old functions, sometimes code maintenance changes become required for long-running sites. As of PHP 5.5, the MySQL functions are deprecated and are removed in PHP 7! I recently had to convert multiple sites to mysqli PHP functions because a new server was running PHP 5.6 and the old server was on PHP […]

How To Easily Convert From Centigrade/Celsius to Fahrenheit

Author: , August 8th, 2016

The standard formula (F = 9/5C + 32) is not that easy to use. To create an easy estimate, simply double the Centigrade temp, then subtract the first digit of that result from the result, then add 32. The resulting estimate should not be more than 1 degree Fahrenheit off. Exact method yields a conversion […]

How To Create a PDF from Multiple Image Files on the Command Line

Author: , June 6th, 2016

convert myFile*.jpg myFile.pdf convert myFile*.png myFile.pdf

How To Convert UNIX Timestamps to Date using PHP CLI

Author: , August 15th, 2015

For a quick visual check to see what the human-readable date is based on a UNIX timestamp integer: php -r ‘print date(“r”,1483228799);’ php -r ‘print strtotime(“1 Jan 2015″) – 1;’

How To Batch Create Thumbnails Using mogrify

Author: , August 7th, 2013

I used the ImageMagick mogrify command to batch-create over 14,000 thumbnails easily. Since the default operation is to overwrite the originals, I chose to write the output files into a different directory with the -path option. Note the greater-than sign (>) after the 100×100 dimensions. This flag tells mogrify to only shrink images that have […]

How To Batch Convert MS Word doc to docx

Author: , June 28th, 2013

Many thanks to Robert Russell for his excellent conversion tip! I have recorded the procedure below in case that post ever goes away… Download the two required installation packages from Microsoft: Microsoft Office Migration Planning Manager Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint File Formats Install both packages. Specify a place to install […]

How To Convert HTML Entity Codes To Plain Text

Author: , April 10th, 2012

Using Perl: use HTML::Entities; my $plainText = decode_entities(‘Put text to convert here’); Using PHP: $plainText = html_entity_decode(‘Put text to convert here’,ENT_QUOTES,’UTF-8′);

How To Convert Fonts For Cross-Browser Compatibility

Author: , May 31st, 2011

A client wanted specific fonts on their website, and of course, the provided fonts did not work on IE. What a shocker. So I did some research, and found the most amazing site that does easy font conversion for free. Drumroll, please… It is called Font Squirrel, and all you need to do is upload […]

How To Get VIM to Create HTML from PERL

Author: , October 14th, 2009

:let html_use_css = 1 :let html_no_pre = 1 :let html_use_encoding = “utf-8″ Use the “:TOhtml” user command. It is defined in a standard plugin. “:TOhtml” also works with a range and in a Visual area: > :10,40TOhtml After you save the resulting file, you can view it with any HTML viewer, such as Netscape. The […]