This file contains hidden or 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
var cats = ['tech','politics','tech','politics','spirituality']; | |
cats.filter(function(v,i){return cats.indexOf(v) == i}) // will return ["tech", "politics", "spirituality"] |
This file contains hidden or 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
AddType application/x-httpd-php .html | |
# Some server would require the following | |
#AddHandler php-script .html |
This file contains hidden or 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> | |
<style> | |
iframe { position: fixed; border: none; height: 100%; top: 0; } | |
</style> | |
<!--<script src="jquery.js"></script>--> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(window).load(function(){ |
This file contains hidden or 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 (get_magic_quotes_gpc()) { | |
function strip_array($var) { | |
return is_array($var)? array_map("strip_array", $var):stripslashes($var); | |
} | |
$_POST = strip_array($_POST); | |
$_SESSION = strip_array($_SESSION); | |
$_GET = strip_array($_GET); | |
} |
This file contains hidden or 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 | |
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT"); | |
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); | |
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); | |
header("Cache-Control: post-check=0, pre-check=0", false); | |
header("Pragma: no-cache"); | |
?> |
This file contains hidden or 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
# http://stackoverflow.com/questions/354763/common-mysql-fields-and-their-appropriate-data-types | |
INT(11) for anything that is either an ID or references another ID | |
DATETIME for time stamps | |
VARCHAR(255) for anything guaranteed to be under 255 characters (page titles, names, etc) | |
TEXT for pretty much everything else. | |
VARCHAR(255) for emails | |
TIMESTAMP for dates, tracking creation or changes | |
DECIMAL(3,2) (unsigned) for 5-star rating value |
This file contains hidden or 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 | |
/** | |
* The base configurations of the WordPress. | |
* | |
* This file has the following configurations: MySQL settings, Table Prefix, | |
* Secret Keys, WordPress Language, and ABSPATH. You can find more information | |
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing | |
* wp-config.php} Codex page. You can get the MySQL settings from your web host. | |
* | |
* This file is used by the wp-config.php creation script during the |
This file contains hidden or 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 | |
// PHP Logical operators: The difference between OR vs ||, AND vs && | |
// Key concept #1: "||" and "&&" have greater precedence than "=", "OR", "AND" | |
// http://php.net/manual/en/language.operators.precedence.php | |
// Key concept #2: PHP logical operators are short-circuit | |
// http://en.wikipedia.org/wiki/Short-circuit_evaluation | |
// http://php.net/manual/en/language.operators.logical.php |
This file contains hidden or 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 | |
mysql_connect(localhost,$user,$password) or die( “Unable to connect”); | |
/* | |
if ($from && $to && $msg) { | |
sendMail(); | |
} | |
*/ | |
$from && $to && $msg && sendMail(); |
This file contains hidden or 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
#!/bin/bash | |
#start | |
#----------------------------------------------------------------------- | |
find /srv/backup/daily/databases/ -name '*.gz' -mtime +7 | xargs rm -f; | |
find /srv/backup/daily/websites/ -name '*.gz' -mtime +7 | xargs rm -f; | |
# Are Weekly Backups Implemented? | |
# find /srv/backup/weekly/ -name '*.gz' -mtime +30 | xargs rm -f; | |
#----------------------------------------------------------------------- | |
#end |