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 ( $ ) { | |
// What: a jQuery plugin for CSS3 transitions with animate() fallback | |
// Author: kiur@node.ee | |
// License: Public Domain | |
var CSS3_TRANS_SUPPORT = (function() { | |
var b = document.body || document.documentElement; | |
var s = b.style; | |
var p = 'transition'; |
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 parseRoute($route) { | |
$keys = array(); | |
if(strpos($route, '/') === false) { | |
return array( | |
'route' => $route, | |
'keys' => $keys | |
); | |
} |
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
exports.pathRegexp = function(path, keys, sensitive, strict) { | |
if (toString.call(path) == '[object RegExp]') return path; | |
if (Array.isArray(path)) path = '(' + path.join('|') + ')'; | |
path = path | |
.concat(strict ? '' : '/?') | |
.replace(/\/\(/g, '(?:/') | |
.replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?(\*)?/g, function(_, slash, format, key, capture, optional, star){ | |
keys.push({ name: key, optional: !! optional }); | |
slash = slash || ''; | |
return '' |
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 | |
class R { | |
static $handlers = array( | |
'GET' => array(), | |
'POST' => array() | |
); | |
public static function GET($route, $handler) { |
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 | |
/** | |
* .htaccess sisu: | |
* SSLVerifyClient require | |
* SSLVerifyDepth 3 | |
**/ | |
header("Content-Type: text/html; charset=utf-8"); |
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 spin(selector, degrees, duration, complete, frameDelay) { | |
var el = $(selector), | |
start = +new Date, | |
degrees = degrees || 720, | |
duration = duration || 2000, | |
complete = complete || function() {}, | |
frameDelay = frameDelay || 25, | |
cssProperty, framesPlayed = 0, lastRotation = 0; | |
if($.browser.webkit) cssProperty = '-webkit-transform'; | |
else if($.browser.msie) cssProperty = '-ms-transform'; |
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 | |
// Lihtne näide, kuidas ehitada külastajate arvu lugejat | |
// Laeme kõvakettalt faili, mis sisaldab kõikide külastajate IP aadresse | |
$faili_sisu = file_get_contents('kylastajad.txt'); | |
// Tekitame andmetest massiivi (failis on IP aadressid eraldatud püstkriipsuga) | |
$kylastajad = explode('|', $faili_sisu); | |
// Praegune IP aadress (külastaja oma) | |
$ip_aadress = $_SERVER['REMOTE_ADDR']; |
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 | |
// Kõige lihtsam sisselogimise näide, mis ei kasuta MySQL andmebaasi | |
// Alustame sessiooni. | |
// Sessioon võimaldab külastaja kohta andmeid salvestada, niikauaks kuni tal brauser lahti on. | |
session_start(); | |
// Kontrollime, ega just peaegu keegi sisse logida ei ole üritanud | |
if(isset($_POST['kasutajanimi']) && isset($_POST['parool'])) { |
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 translate(str) { | |
var map = { | |
a : '196920740401785', | |
b : '113544575430999', | |
c : '294715893904555', | |
d : '294660140569858', | |
e : '328415510520892', | |
f : '270221906368791', | |
g : '212614922155016', | |
h : '205633882856736', |
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 | |
/* | |
array_shift($arr) - eemaldab esimese elemendi arrayst ja tagastab selle (originaalne array muutub 1 võrra lühemaks) | |
array_pop($arr) - eemaldab viimase elemendi arrayst ja tagastab selle (originaalne array muutub 1 võrra lühemaks) | |
str_replace($a, $b, $tekst) - asendab $tekst sees olevad tähed, mis leiduvad $a arrays nendega, mis leiduvad $b arrays | |
str_ireplace($a, $b, $tekst) - teeb sama, kuid ignoreerib suurte ja väikeste tähtede vahet | |
ucfirst($tekst) - teeb $teksti esimese tähe suureks | |
strtolower($tekst) - teeb $teksti kõik tähed väikseks |
NewerOlder