Skip to content

Instantly share code, notes, and snippets.

@Zillionx
Zillionx / pets.top
Created March 7, 2017 02:32
ChatScript topic example
topic: ~pets (dog cat pet animal bird fish snake)
?: ( << you like snake >>)
I love pythons except ^"Python" (the programming language)
?: ( << you ~like ~animals >>)
I love all animals.
t: Do you have any pets?
@Zillionx
Zillionx / Shrink_OSX_VirtualDisk.sh
Last active May 22, 2016 07:24
Shrinking virtual disks on OSX VMWare fusion via CLI
#!/bin/sh
# remove vm snapshots
# change your path /path_to_your/disc.vmdk
#
# source: http://snipurl.com/maggini_vmdisc_osx
cd '/Applications/VMware Fusion.app/Contents/Library'
# defrag
./vmware-vdiskmanager -d path_to_your/disc.vmdk
@Zillionx
Zillionx / Select_ShowDiv.html
Last active December 2, 2015 21:19
Show Div when selectedIndex Property != 0
<!doctype html>
<!-- http://www.w3schools.com/jsref/prop_select_selectedindex.asp -->
<html>
<head>
<meta charset="UTF-8">
<title>tst</title>
<script type="text/javascript">
function ShowDiv() {
if (document.getElementById('Country').selectedIndex != 0 ) {
document.getElementById('Show').style.display = 'block';
@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 / 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)