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
// creates basic object structure, wraps routines together - can be compared to OOP class definition | |
var imageEffects = function () {} | |
imageEffects.prototype.loadImage = function (url, callback) { | |
var request = new XMLHttpRequest(); | |
request.open('GET', url, true); | |
request.onreadystatechange = function () { | |
// Makes sure the document is ready to parse. | |
var result = false; | |
if (request.readyState == 4) { |
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
// String insert method | |
String.prototype.insert = function (index, string) { | |
if (index > 0) { | |
// necessary fix | |
if (string.charCodeAt(0) == 13){ | |
string = "\n"; | |
} | |
var ret = this.substring(0, index) + string + this.substring(index, this.length); | |
return ret; | |
} else if (index == this.length) { |
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
// implementation of disabled form fields | |
var nowTemp = new Date(); | |
var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0); | |
var checkin = $('#dpd1').fdatepicker({ | |
onRender: function (date) { | |
return date.valueOf() < now.valueOf() ? 'disabled' : ''; | |
} | |
}).on('changeDate', function (ev) { | |
if (ev.date.valueOf() > checkout.date.valueOf()) { | |
var newDate = new Date(ev.date) |
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>HTML5 boilerplate – all you really need…</title> | |
<link rel="stylesheet" href="css/style.css"> | |
<!--[if IE]> | |
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> | |
<![endif]--> | |
</head> |
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
/*! | |
* jQuery lightweight plugin boilerplate | |
* Original author: @ajpiano | |
* Further changes, comments: @addyosmani | |
* Licensed under the MIT license | |
*/ | |
// the semi-colon before the function invocation is a safety | |
// net against concatenated scripts and/or other plugins |
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 curPageURL() { | |
$pageURL = "http"; | |
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} | |
$pageURL .= "://"; | |
if ($_SERVER["SERVER_PORT"] != "80") { | |
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; | |
} else { | |
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; | |
} |
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
... | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<script src="http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"></script> | |
<script> | |
// configuration structure | |
var config = { | |
pagenumber : 1, | |
activeclassname : 'active', // class used to mark active paging link | |
initialpage : 1, | |
sourceurl : '', // url to your data source |
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> | |
<head> | |
<meta charset="utf-8"> | |
<title>Bruteforce!</title> | |
</head> | |
<body> | |
<script> | |
var password = '89p8zk', | |
passwordLength = 4, |
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
/* | |
* validates slovak ID numbers | |
* | |
* @param string skIdNumber slovak ID number | |
* | |
* @return bool | |
*/ | |
function validateSkId (skIdNumber) { | |
if (skIdNumber == undefined || | |
skIdNumber.length < 1 || |
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
/* return pluralized form of input type, with respect to amount | |
* | |
* @param string type - defines type, possible values are: "hodina", "kus", "mesiac" | |
* @return string pluralized type in slovak language | |
*/ | |
function pluralizeAmountSlovak(type, amount){ | |
var dictionary = { | |
hodina : ['hodina', 'hodiny','hodín'], | |
kus : ['kus', 'kusy', 'kusov'], | |
mesiac : ['mesiac', 'mesiace', 'mesiacov'] |
OlderNewer