One line PHP code to remove characters except numbers and letters

I found this few lines of PHP script useful to sanitize user input, it removes characters except numbers and letters:

$clean_code = preg_replace('/[^\w]/', '', $string);

Or this one:

$clean_code = preg_replace('/[^a-zA-Z0-9]/', '', $string);

Original post is here: https://coderwall.com/p/bn47ka/remove-all-characters-except-letters-and-numbers-in-php

HealthCon Responsive HTML5 Website Template

A responsive and excellence HTML5 website with slide-able style menu and sub menu feature for both mobile and desktop version.

Below image is the desktop version of this website template:

You can view it in action in this video:

Get this template from this link: https://creativeshop.ciihuy.com/product/healthcon-responsive-html5-website-template/

How to send POST request to another website from a PHP script

Let’s say we have a website like somewebsite.com and there is an input form, but we don’t want to submit that form from that website, instead we send POST request to that page from another website. Here is a handy PHP script to do so:

<?php

$url = 'https://somewebsite.com/';
$data = array('key1' => 'value1', 'key2' => 'vaue2');

$options = array(
    'http' => array(
        'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
        'method'  => 'POST',
        'content' => http_build_query($data)
    )
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { /* Handle error */ }

var_dump($result);

?>

Save Android Webview Content as PDF File

Hello everybody!

What you are seeing here is an Android app that shows a local html file inside a Web View.

Then on top of the web view there is a button to save web view contents as a pdf file.

Pdf file is saved localy after you tapped the button and you can open it using your favorite pdf viewer app in your phone.

How to make objects facing towards player in Unity

Some of elements in our game probably need to always face towards the player or player’s camera.

With this script we can make any object that this script attached on it, to look at a specific object, like player object or a camera.

How to open WebP images in Photoshop – WebP Photoshop Plugin

Finally this plugin solved my problem. Usually when I got a webp images downloaded from internet, I take a screenshot of the image and copy and paste it inside Photoshop.

But lucky me I found this plugin from this link: https://endurtech.com/how-to-open-webp-files-in-adobe-photoshop/

Extract the file, and find 32 or 64 plugin file, copy and paste it on your Photoshop plugin directory. Enjoy!

How to make and generateQR Code with JavaScript – Center Align the QR Code

This tutorial is answering a question about how to center align the qr code image generated by qrcode.js library on my previous video: https://www.youtube.com/watch?v=gLLd9YJOJgM&lc

And the answer is relatively easy, we can adjust the styling of the div containing qr code image to make it center aligned.

You can download the library from here: https://davidshimjs.github.io/qrcodejs/

qrcode.js library is very simple and useful JavaScript library that can help you generate qr code images easily.

You can dowload the source code here: https://drive.google.com/open?id=17ZczRpYNWun5IH32Xv9XXp-0b_gsbuwK

How to resize QR Code image generated by phpqrcode library

In this tutorial I will show you how to modify the phpqrcode library to generate more bigger and larger QR Code image.

By default if we generate a QR Code of short text or string, we will get a small QR Code image approximately less than 100 pixels. But we can multiply by any number we like.

How to make an HTML5 Note Taking Program

HTML5 is amazing to me it and I have fun to do coding with JavaScript because it runs on web browser just like that, so we don’t have to install anything, its just running on web browser.

In this tutorial I will share with you how to create a web program, this time, a note taking program.

By watching this tutorial you will know how to store note data, how to retrieve it back and how to delete each one of notes we saved.

We don’t use any database to make this note taking program, we only use what so-called Local Storage on web browser, so our notes are saved on web browser.