Skip to content

Instantly share code, notes, and snippets.

@Zillionx
Zillionx / Floating Cloud Background.markdown
Created October 11, 2015 21:34
Floating Cloud Background

Floating Cloud Background

A floating cloud background using CSS Transforms, negative animation delays, and a LESS loop for nth-child staggering.

A Pen by Shaw on CodePen.

License.

@Zillionx
Zillionx / makeUniqueString.php
Last active October 9, 2015 20:28
PHP - How to make a random unique string
<?PHP
function makeUniqueString ($length=16) // $lenght - string lenght
{
$salt = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345678';
$len = strlen($salt);
$makepass = '';
mt_srand(10000000*(double)microtime());
for ($i = 0; $i < $length; $i++) {
$makepass .= $salt[mt_rand(0,$len - 1)];
}
@Zillionx
Zillionx / capitalize_words.php
Last active October 4, 2015 20:13
Capitalize words with PHP function ucwords... crazy :)
<?PHP
/* http://php.net/manual/en/function.ucwords.php */
// ucwords works only if You add 'strtolower' to make the remaining characters lowercase...
// crazy!
$Fname = ucwords(strtolower("JOHN"));
$Lname = ucwords(strtolower("DOE"));
// John Doe
echo $Fname." ".$Lname;
@Zillionx
Zillionx / OSX_TCP_options.command
Last active November 21, 2017 03:48
OSX - Tuning the Network Stack TCP
## Quick fix for slow internet after update to OSX 10.11 "El Capitan"
## Changes are not permanent, just restart your mac if it doesn't work.
## write config
sudo su -
sysctl -w net.inet.tcp.doautorcvbuf=0
sysctl -w net.inet.tcp.doautosndbuf=0
sysctl -w net.inet.tcp.win_scale_factor=0
# net.inet.tcp.recvspace=1048576
# net.inet.tcp.sendspace=131072
@Zillionx
Zillionx / sum two fields.html
Created September 22, 2015 11:18
Sum two fields
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Sum Form</title>
<script>
function startCalc(){
interval = setInterval("calc()",1);
}
@Zillionx
Zillionx / show_hide_input.html
Last active September 11, 2015 21:16
How To Show And Hide Input Fields Based On Radio Button Selection
<html>
<!-- http://stackoverflow.com/questions/17621515/how-to-show-and-hide-input-fields-based-on-radio-button-selection -->
<head>
<script type="text/javascript">
function yesnoCheck() {
if (document.getElementById('yesCheck').checked) {
document.getElementById('ifYes').style.visibility = 'visible';
}
else document.getElementById('ifYes').style.visibility = 'hidden';
@Zillionx
Zillionx / OSMobileRedir.php
Last active August 29, 2015 14:24
PHP OS mobile detection with url redirect
/* Zilli 201102
To detect the OS mobile system on the client device,
match the value of $_SERVER[‘HTTP_USER_AGENT’],
then redirect to mobile url with the header php function.
*/
<?PHP
function mobileDevice()
{
$type = $_SERVER[‘HTTP_USER_AGENT’];
@Zillionx
Zillionx / OSMobileRedir.js
Last active August 29, 2015 14:24
Javascript OS mobile detection with url redirect
/* Zilli 201102
To detect the OS mobile system on the client device,
match the value of navigator.userAgent,
then redirect to mobile url with the location.replace value.
*/
if (navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
@Zillionx
Zillionx / OSredir.js
Last active July 3, 2017 09:13
Javascript OS client detection with url redirect
/* Zilli 201507
To detect the operating system on the client machine,
match the value of navigator.appVersion,
then redirect to OS url with the location.replace value.
*/
if (navigator.appVersion.match(/Mac/i)) {
location.replace("index-Mac.html");
}
else if (navigator.appVersion.match(/Win/i)) {
@Zillionx
Zillionx / OSdetect.js
Last active August 29, 2015 14:24
OS client javascript detection
/*
To detect the operating system on the client machine,
analyze the value of navigator.appVersion or navigator.userAgent.
This script sets the variable OSName to reflect the actual client OS.
*/
var OSName="Unknown OS";
if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";