How to make a responsive full screen background image in HTML5

Bringing an image to a web page is easy as we can use <img src… tag. But what if we want to use an image as a background image? It is also easy. You can search for it on internet. But, there is more, how to make this background image in full screen mode, center fixed, filling the screen, with maintained aspect ratio, I mean not stretched? The answer is this few lines of css codes:

Lorem Ipsum Cakes – Free Order Via WhatsApp HTML5 Template

Hello everyone. This is a Free HTML website template that I’ve made it recently for one of my projects.

Let’s say we are selling cakes. People can order their cakes by filling this order form, and then the order message is being sent via WatsApp.

Feel free to modify the code and change my number to your number.

Open this link to see the demo: https://ciihuy.com/downloads/loremipsumcakes/

How to integrate AdMob banner into iOS web app in Xcode

This blog post is all about how to make an iOS app that completely displaying an HTML5 web app, I mean this app will run local html files with its assets such as JavaScript, css, fonts, images etc.

Plus, this blog post demonstrates how to integrate AdMob Banner Ad into this web app. So when you run the app, AdMob banner ad will be displayed at the bottom of the app.

Let’s start it. First, make new iOS Xcode project. Then download AdMob for iOS to include it to your project.

Watch this video to see exactly how to do it:

How to list all files in a directory and read each of them in PHP

This code snippet is useful to me when I need to read all files inside a directory and showing it on web browser in PHP:

<?php
header('Content-type: text/plain; charset=utf-8');
$dir = "1"; //this is a folder containing files we want to read.
$files = scandir("$dir");
foreach($files as $key=>$value){
	if(!in_array($value, array(".", ".."))){
		echo "Found this file: " . $value . "<br>Begin reading...";
		$currentfile = fopen($dir . "/" . $value, "r") or die("Unable to read the file!");
		echo fread($currentfile, filesize($dir . "/" . $value));
		echo "Reading finished.";
	}
}

Switchable “Camera Follows a Player” accross mutliple scenes in Unity

This is a Unity package file, if you download it and import it on your empty Unity project, you will see a demonstration about a camera that follows an object, and this camera (it’s position) is switchable, you can click a button to switch between multiple camera positions and angles. Plus there are two buttons to open two empty scenes, but when you open it the player object and cameras will be there too.

The purpose of this demonstration is to show you how an object like player, camera, etc can be used on multiple scenes without reloading them in each scenes, by adding one line script to make those objects undestroyable when you change scenes.

How to switch between camera positions and angles in Unity by C# script

The script inside this package allows you to switch between camera positions so you can switch between camera angles and positions easily with single click button.

In this example, there were 3 camera positions that we can switch between them. In this video I also tried to add another camera position (the 4th position).

You will also be able to adjust camera switching speed to be fast or slow.

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);

?>