This file contains 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
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME}\.php -f | |
RewriteRule ^(.*)$ $1.php |
This file contains 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 slugify($text,$strict = false) { | |
$text = html_entity_decode($text, ENT_QUOTES, 'UTF-8'); | |
// replace non letter or digits by - | |
$text = preg_replace('~[^\\pL\d.]+~u', '-', $text); | |
// trim | |
$text = trim($text, '-'); | |
setlocale(LC_CTYPE, 'en_GB.utf8'); |
This file contains 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 | |
/** | |
* easy image resize function | |
* @param $file - file name to resize | |
* @param $string - The image data, as a string | |
* @param $width - new image width | |
* @param $height - new image height | |
* @param $proportional - keep image proportional, default is no | |
* @param $output - name of the new file (include path if needed) | |
* @param $delete_original - if true the original image will be deleted |
This file contains 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 array_utf8_encode($dat) | |
{ | |
if (is_string($dat)) | |
return utf8_encode($dat); | |
if (!is_array($dat)) | |
return $dat; | |
$ret = array(); | |
foreach ($dat as $i => $d) |
This file contains 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 ceiling($number, $significance = 1) | |
{ | |
return ( is_numeric($number) && is_numeric($significance) ) ? (ceil($number/$significance)*$significance) : false; | |
} |
This file contains 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 watermark_image($target, $wtrmrk_file, $newcopy) | |
{ | |
// Load the stamp and the photo to apply the watermark to | |
$stamp = imagecreatefrompng($wtrmrk_file); | |
$im = imagecreatefromjpeg($target); | |
// Set the margins for the stamp and get the height/width of the stamp image | |
$marge_right = 10; | |
$marge_bottom = 10; |
This file contains 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
function daysBetween(one, another) { | |
return Math.round(Math.abs(one - another) / 8.64e7); | |
} | |
// usage | |
a = daysBetween(new Date(date1), new Date(date2)) |
This file contains 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
function getUriParam(name){ | |
if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(location.search)) | |
return decodeURIComponent(name[1]); | |
} | |
// usage -> url: http://localhost/index.html?id=1 | |
var a = getUriParam('id'); |
This file contains 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
function removeDuplicates(originalArray, prop) { | |
var newArray = []; | |
var lookupObject = {}; | |
for(var i in originalArray) { | |
lookupObject[originalArray[i][prop]] = originalArray[i]; | |
} | |
for(i in lookupObject) { | |
newArray.push(lookupObject[i]); |
This file contains 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
$(document).ready(function(){ | |
$("#search").keyup(function () { | |
var value = this.value.toLowerCase().trim(); | |
$("table tr").each(function (index) { | |
if (!index) return; | |
$(this).find("td").each(function () { | |
var id = $(this).text().toLowerCase().trim(); | |
var not_found = (id.indexOf(value) == -1); | |
$(this).closest('tr').toggle(!not_found); |
OlderNewer