Category Archives: Uncategorized

Disable Affiliate Links (VGLNK) on Disqus

Disqus is the internet’s favorite comment plug-in that helps publishers increase engagement and build loyal audiences. It is free and is used by million of websites. However, recently we noticed an issue with their “Affiliate Links” option that was causing any text similar to a domain name (i.e to be hyperlinked with this HTML […]

Delphi Scrollbox with Black Background on Windows XP

Problem: Delphi Scrollbox is completely black on Windows XP. Some Win XP users may experience strange behaviors with Scrollbar\Scrollbox. In particular they may see the background in black, example: To fix this issue just set ParentBackground to True on the Scroll component. If that still doesn’t work, try to put the Scrollbox inside a TPanel. […]

Simulate Multiple Monitors in VMWare guest

You can have one large host window with multiple monitors in the guest: 1) Power off the VM then go to VM > Settings > Hardware > Display 2) Select “Specify monitor settings”, and set “Number of monitors” to 2 or more. 3) Uncheck Autofit Guest by going to Edit > Preferences > Display. * […]

Delphi poScreenCenter and Dual Monitors

To correctly show your main form on dual monitors use poScreenCenter: So the main form is displayed on the center of the main monitor. Else the main form is displayed in the middle between the two monitors. More information on this link: Vcl.Forms.TPosition – RAD Studio API Documentation

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 […]