Category Archives: Uncategorized

PHP Check if a File is an Office 2007 Document by MIME Content Type

Simple PHP function to check if a file is an Office 2007 document by filtering the content type: function isOfficeDocumentByMIMEContentType($str) { //   $array = array( "application/msword", //doc "application/msword", //dot "application/vnd.openxmlformats-officedocument.wordprocessingml.document", //docx "application/vnd.openxmlformats-officedocument.wordprocessingml.template", //dotx "application/", //docm "application/", //dotm "application/", //xls "application/", //xlt "application/", //xla "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", //xlsx "application/vnd.openxmlformats-officedocument.spreadsheetml.template", //xltx "application/", //xlsm "application/", //xltm "application/", //xlam "application/", […]

Determine if user is on mobile device with Javascript

Easiest way to determine if user is on mobile device with javascript: if (/Mobi/i.test(navigator.userAgent) == true || /Android/i.test(navigator.userAgent) == true ) { // Mobile device detected }if (/Mobi/i.test(navigator.userAgent) == true || /Android/i.test(navigator.userAgent) == true ) { // Mobile device detected }

Show Google AdSense based on User’s Device

Let’s say I want to show Google AdSense after the .header class for non-mobile devices (desktops, laptops, etc), and show Google AdSense before a form on mobile devices only. Here is the jQuery code example: // Show Google AdSense after the .header if device is not mobile if (/Mobi/i.test(navigator.userAgent) == false && /Android/i.test(navigator.userAgent) == false […]

OptinMonster and jQuery 3.2.1 Slim (Issue)

Looks like that OptinMonster does not load the campaign if you use jQuery 3.2.1 Slim version. To fix this, I have used the normal jQuery (minified) .js file like this: <script src=""></script><script src=""></script> And then I made sure OptinMonster does not load jQuery 1.12.2: <script>var om_load_jquery = false;</script><script>var om_load_jquery = false;</script> After the above trick […]

PHP Google reCAPTCHA v2

First you need to create the Google reCAPTCHA v2 key for your website. This is the HTML form example that shows the reCAPTCHA: * Replace YOUR_SITE_KEY_HERE with your site key * <form action="" method="post"> <div class="form-group" style="max-width: 303px;"> <input type="email" name="email" placeholder="Enter email here…" class="form-control" required email> </div> <div class="form-group"> <div class="g-recaptcha" data-sitekey="YOUR_SITE_KEY_HERE"></div> </div> <button […]

Get Photos and Videos from Instagram in PHP

Example PHP function to get the image and video url from Instagram: function get_instagram_image_url($url) { $result = array();   if(preg_match(‘/^https\:\/\/www\.instagram\.com\//is’, $url)) {   $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); $data = curl_exec($ch); curl_close($ch);   if(preg_match(‘/property\=\"og\:image\"\s+content\=\"(.+?)\"/is’, $data, $matches)) { $imageurl = trim($matches[1]);   if($imageurl) { if(preg_match(‘/property\=\"og\:video\"\s+content\=\"(.+?)\"/is’, $data, $matches)) { $videourl […]

Disable spell check on HTML text fields

Disable spell check, auto correct, auto capitalize on HTML text fields: <textarea autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">Sample Nuit</textarea><textarea autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">Sample Nuit</textarea> Disable spell check on HTML text fields: <textarea spellcheck="false">Sample Nuit</textarea><textarea spellcheck="false">Sample Nuit</textarea> Disable autocomplete on HTML text fields: <textarea autocomplete="off">Sample Nuit</textarea><textarea autocomplete="off">Sample Nuit</textarea> Disable auto correct on HTML text fields: <textarea autocorrect="off">Sample Nuit</textarea><textarea […]

Delphi 10 Berlin System.Hash MD5 SHA1 SHA2 Hash

You can create string and file hashes with System.Hash APIs: System.Hash – RAD Studio API Documentation Examples calculating string hashes: function GetStrHashMD5(Str: String): String; var HashMD5: THashMD5; begin HashMD5 := THashMD5.Create; HashMD5.GetHashString(Str); result := HashMD5.GetHashString(Str); end;   function GetStrHashSHA1(Str: String): String; var HashSHA: THashSHA1; begin HashSHA := THashSHA1.Create; HashSHA.GetHashString(Str); result := HashSHA.GetHashString(Str); end;   function […]

Standard ISO paper sizes, DPI and images size

List of DPI and image size in pixels for standard ISO paper sizes: A4 DPI and Image Size Type DPI Size (pixels) A4 300 DPI 3507×2480 A4 200 DPI 2338×1653 A4 150 DPI 1753×1240 A4 72DPI 841×595 A3 DPI and Image Size Type DPI Size (pixels) A3 300 DPI 4960×3507 A3 200 DPI 3307×2338 A3 […]

Download Google Chrome Full Standalone Offline Installer

Here are official links to download Google Chrome Full Standalone offline installer: Google Chrome Standalone Offline Installer (32-bit) Google Chrome Standalone Offline Installer (64-bit) If you need to install Google Chrome for all user accounts use these links: Google Chrome Offline Installer for All User Accounts (32-bit) Google Chrome Offline Installer for All User Accounts […]