This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
|-------------------------------------------------------------------------- | |
| Upload file | |
|-------------------------------------------------------------------------- | |
| On submit upload file to folder and return excel array | |
| | |
*/ | |
if($_POST){ | |
//helper and config variables |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Helper function to convert bigint to ip adress | |
function int2ip($intip){ | |
$ipVal = $intip; | |
$ipArr = array(0 => floor($ipVal/0x1000000) ); | |
$ipVint = $ipVal-($ipArr[0]*0x1000000); // for clarity | |
$ipArr[1] = ($ipVint & 0xFF0000) >> 16; | |
$ipArr[2] = ($ipVint & 0xFF00 ) >> 8; | |
$ipArr[3] = $ipVint & 0xFF; | |
$ipDotted = implode('.', $ipArr); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function udate($format, $utimestamp = null) { | |
if (is_null($utimestamp)) | |
$utimestamp = microtime(true); | |
$timestamp = floor($utimestamp); | |
$milliseconds = round(($utimestamp - $timestamp) * 1000000); | |
return date(preg_replace('`(?<!\\\\)u`', $milliseconds, $format), $timestamp); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(".btn-add-child").click(function() { | |
var newItem; | |
newItem = $("body .child.item.duplicate").clone().removeClass("duplicate"); | |
newItem.appendTo(".parent"); | |
$(".parent .child.item").show(); | |
return $(".btn-remove-child").click(function() { | |
return $(this).parent().remove(); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Date fix with some old browsers | |
if (!Date.now) { | |
Date.now = function() { | |
return new Date().valueOf(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function udate($format, $utimestamp = null) { | |
if (is_null($utimestamp)) | |
$utimestamp = microtime(true); | |
$timestamp = floor($utimestamp); | |
$milliseconds = round(($utimestamp - $timestamp) * 1000000); | |
return date(preg_replace('`(?<!\\\\)u`', $milliseconds, $format), $timestamp); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Simple SHELL script for Linux and UNIX system monitoring with | |
# ping command | |
# ------------------------------------------------------------------------- | |
# Copyright (c) 2006 nixCraft project <http://www.cyberciti.biz/fb/> | |
# This script is licensed under GNU GPL version 2.0 or above | |
# ------------------------------------------------------------------------- | |
# This script is part of nixCraft shell script collection (NSSC) | |
# Visit http://bash.cyberciti.biz/ for more information. | |
# ------------------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//on start | |
$('body').ajaxStart(function () { | |
$('#ajax-status').show().text("Loading..."); | |
}); | |
//on stop | |
$('body').ajaxStop(function () { | |
$('#ajax-status').fadeOut(); | |
}); | |
//on error | |
$('body').ajaxError(function (event, xhr, ajaxOptions, thrownError) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
type: "POST", | |
url: "url to the server processing code", | |
dataType: "json", | |
contentType: "application/json", | |
data: JSON.stringify({}), | |
success: function(response) { | |
//response is json data returned from server side url | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Get first key and value from an array | |
$first_value = reset($array); | |
$first_key = key($array); | |
?> |