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
Bacon = require 'Bacon' | |
_ = require 'underscore' | |
$ = require 'jquery' | |
# Reference: http://unixpapa.com/js/key.html | |
# IE = IE keycodes (webkit, IE) | |
# MZ = Mozilla keycodes (gecko) | |
# Opera = Opera keycodes (opera) | |
# US locale specific. About as well as can be done without browser detection. |
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
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |
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 | |
if ((($_FILES["file"]["type"] == "image/gif") | |
|| ($_FILES["file"]["type"] == "image/jpeg") | |
|| ($_FILES["file"]["type"] == "image/pjpeg")) | |
&& ($_FILES["file"]["size"] < 20000)) | |
{ | |
if ($_FILES["file"]["error"] > 0) | |
{ | |
echo "Error: " . $_FILES["file"]["error"] . "<br />"; | |
} |
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
--Do not remove this if you are using-- | |
Original Author: Remiz Rahnas | |
Original Author URL: http://www.htmlremix.com | |
Published date: 2008/09/24 | |
Changes by Nick Fetchak: | |
- IE8 standards mode compatibility | |
- VML elements now positioned behind original box rather than inside of it - should be less prone to breakage | |
Published date : 2009/11/18 |
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
$load = sys_getloadavg(); | |
if ($load[0] > 80) { | |
header('HTTP/1.1 503 Too busy, try again later'); | |
die('Server too busy. Please try again later.'); | |
} | |
/* | |
This is a function which returns three samples of the “load” on a system. Load is the number of processes in the system run queue. The 3 items in the array are the average load for the past 1, 5 and 15 minutes. The PHP Manual shows a great usage of this: | |
*/ |
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
//for a number of classes to load automatically | |
//We can define the following function in our file | |
function __autoload($class_name) | |
{ | |
$path = str_replace("_", "/", $class_name); | |
require_once $path.".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
if(navigator.appName=="Microsoft Internet Explorer" ) { | |
return false; | |
} | |
else { | |
return this.init(canvasId,displayRadius,skinId,showSecondHand,gmtOffset); | |
} |
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
//Use the fourth argument as false | |
echo htmlentities($foo, ENT_COMPAT, 'UTF-8',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
<? | |
$dsn = 'mysql:dbname=test;host=hostname'; | |
$user = 'username'; | |
$password = 'Password'; | |
try { | |
$dbh = new PDO($dsn, $user, $password); | |
echo "Connected"; | |
} catch (PDOException $e) { | |
echo 'Connection failed: ' . $e->getMessage(); | |
} |
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 | |
$sum = function($a,$b){ | |
return $a+$b; | |
}; | |
echo $sum(2,5); | |
?> |
OlderNewer