Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
#!/usr/bin/env bash | |
set -Eeuo pipefail | |
trap cleanup SIGINT SIGTERM ERR EXIT | |
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
usage() { | |
cat <<EOF | |
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |
# For each database: | |
ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; | |
# For each table: | |
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | |
# For each column: | |
ALTER TABLE table_name CHANGE column_name column_name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | |
# (Don’t blindly copy-paste this! The exact statement depends on the column type, maximum length, and other properties. The above line is just an example for a `VARCHAR` column.) |
{# | |
Source: http://dev.dbl-a.com/symfony-2-0/symfony2-and-twig-pagination/ | |
Updated by: Simon Schick <[email protected]> | |
Parameters: | |
* currentFilters (array) : associative array that contains the current route-arguments | |
* currentPage (int) : the current page you are in | |
* paginationPath (string) : the route name to use for links | |
* showAlwaysFirstAndLast (bool) : Always show first and last link (just disabled) | |
* lastPage (int) : represents the total number of existing pages |
<?php | |
// To the extent possible under law, I (Stephan Sokolow) waive all copyright and related or | |
// neighbouring rights to this code snippet. (Though it'd still be nice if you mention me) | |
// If we're running under `php -S` with PHP 5.4.0+ | |
if (php_sapi_name() == 'cli-server') { | |
// Replicate the effects of basic "index.php"-hiding mod_rewrite rules | |
// Tested working under FatFreeFramework 2.0.6 through 2.0.12. | |
$_SERVER['SCRIPT_NAME'] = str_replace(__DIR__, '', __FILE__); |
<?php | |
# Automated Deployments from Bitbucket/Github Service Hook | |
# Graciously borrowed from: http://brandonsummers.name/blog/2012/02/10/using-bitbucket-for-automated-deployments/ | |
date_default_timezone_set('America/Chicago'); | |
class Deploy { | |
/** | |
* A callback function to call after the deploy has finished. |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
web/bundles/ | |
app/bootstrap* | |
app/cache/* | |
app/logs/* | |
vendor/ | |
app/config/parameters.ini |
#!/usr/bin/env ruby | |
# Aside from removing Ruby on Rails specific code this is taken verbatim from | |
# mislav's git-deploy (http://github.com/mislav/git-deploy) and it's awesome | |
# - Ryan Florence (http://ryanflorence.com) | |
# | |
# Install this hook to a remote repository with a working tree, when you push | |
# to it, this hook will reset the head so the files are updated | |
if ENV['GIT_DIR'] == '.' |