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 makeSafe(thisText, allowSpace){ | |
var w = "!@#$%^&*()+=[]\\\';,./{}|\":<>?"; | |
var s = 'abcdefghijklmnopqrstuvwxyz0123456789-'; | |
var x = new Array('àáâãäå', 'çč', 'èéêëě','š','ř','ž','á', 'ìíîï', 'ñ', 'ðóòôõöø', 'ùúûüů', 'ýÿ',' ','.'); | |
var r = new Array('a', 'c', 'e','s','r','z','a', 'i', 'n', 'o', 'u', 'y','-','-'); | |
if(allowSpace){ | |
s = s + ' '; | |
} | |
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
#x | |
{ | |
width: 300px; | |
height: 200px; | |
overflow-y: auto; | |
border: 1px solid #ccc; | |
} |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>TEST</title> | |
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script> | |
<style> | |
#foo { |
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() { | |
$.fn.sortList = function() { | |
var mylist = $(this); | |
var listitems = $('li', mylist).get(); | |
listitems.sort(function(a, b) { | |
var compA = $(a).text().toUpperCase(); | |
var compB = $(b).text().toUpperCase(); | |
return (compA < compB) ? -1 : 1; | |
}); | |
$.each(listitems, function(i, itm) { |
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
$.preloadImages = function() { | |
for(var i = 0; i<arguments.length; i++) { | |
$("<img />").attr("src", arguments[i]); | |
} | |
} | |
$(document).ready(function() { | |
$.preloadImages("hoverimage1.jpg","hoverimage2.jpg"); | |
}); |
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($) { | |
$.fn.extend( { | |
limiter: function(limit, elem) { | |
$(this).on("keyup focus", function() { | |
setCount(this, elem); | |
}); | |
function setCount(src, elem) { | |
var chars = src.value.length; | |
if (chars > limit) { | |
src.value = src.value.substr(0, limit); |
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 validateDate($date, $format = 'Y-m-d H:i:s') | |
{ | |
$d = DateTime::createFromFormat($format, $date); | |
return $d && $d->format($format) == $date; | |
} | |
var_dump(validateDate('2012-02-28 12:12:12')); # true | |
var_dump(validateDate('2012-02-30 12:12:12')); # false | |
var_dump(validateDate('2012-02-28', 'Y-m-d')); # true | |
var_dump(validateDate('28/02/2012', 'd/m/Y')); # true |
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
echo "\xEF\xBB\xBF"; // UTF-8 BOM |
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 | |
$out = iconv('utf-8', 'windows-1250//TRANSLIT', $out); | |
$filename = 'katalog-export___' . date('YmdHis') . '.csv'; | |
header('Content-Encoding: windows-1250'); | |
header('Content-type: text/csv; charset=windows-1250'); | |
header('Content-Disposition: attachment; filename=' . $filename); | |
//echo "\xEF\xBB\xBF"; // UTF-8 BOM |