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 | |
// In a model, far far away.... there was some DRY action | |
function doesComplexWork($id, $conditions) { | |
return "Complex shenanigans"; | |
} | |
function doesMoreComplexWork($id) { | |
return "More Complex shenanigans"; | |
} |
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
# NOTE | |
# .htaccess files are an overhead, this logic should be in your webserver config if poss | |
# Changing webserver (lighttpd, nginx) will probably improve site response times more than these tweaks | |
# Here goes any other rules you, your framework, or whatever app you're using needs | |
FileETag All | |
# if it's not a php file (and it's a real file, in the webroot) | |
<FilesMatch "\.(?!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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] | |
</IfModule> |
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 check_path(path) | |
local rv = path | |
if (not file_info(path, "is_file")) then | |
rv = nil | |
local html_file = path .. ".html" | |
if (file_info(html_file, "is_file")) then | |
rv = html_file | |
else | |
-- handle directory indeces | |
-- we first check if we have a dir and than look for an index.html |
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 cleanstring($input = '', $seperator = '-') { | |
$pattern = '\x00-\x1f\x26\x3c\x7f-\x9f\x{d800}-\x{dfff}\x{fffe}-\x{ffff}'; | |
$pattern .= preg_quote(' \'"/?!<>.$/:;?@=+&%\#', '@'); | |
$return = preg_replace('@[' . $pattern . ']@Su', $seperator, $input); | |
return trim(mb_strtolower(preg_replace('/' . $seperator. '+/', $seperator, $return), 'UTF-8'), $seperator); | |
} |
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
#!/usr/bin/php | |
<?php | |
if (!defined('TMP')) { | |
define('TMP', getcwd() . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR); | |
} | |
$file = getcwd() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'database.php'; | |
if (!is_readable($file)) { | |
echo "Can't find database config at : $file\n"; | |
die(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
<?php | |
/** | |
* This script will attempt to sycronize table structures in a multisite wordpress install | |
* | |
* Crete a backup before running this script | |
*/ | |
$host = $dbname = $username = $password = ''; | |
require 'connection_settings.php'; | |
$prefix = substr(basename(__FILE__), 0, -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
:let len = strlen(substitute(str, ".", "x", "g")) | |
:let foo = "a string" |
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
# Set another default user than root for security reasons | |
# local development - use yourself | |
user andy wheel; | |
# As a thumb rule: One per CPU. If you are serving a large amount | |
# of static files, which requires blocking disk reads, you may want | |
# to increase this from the number of cpu_cores available on your | |
# system. | |
# | |
# The maximum number of connections for Nginx is calculated by: |
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
[18:11][andy@work:~/www/apps/skel(master)]$ cake mi_db backup | |
Welcome to CakePHP v1.3.8 Console | |
--------------------------------------------------------------- | |
App : skel | |
Path: /home/andy/www/apps/skel | |
--------------------------------------------------------------- | |
Running backup | |
generating /home/andy/www/apps/skel/config/schema/backups/default_110726-1810.sql | |
[18:11][andy@work:~/www/apps/skel(master)]$ |
OlderNewer