Skip to content

Instantly share code, notes, and snippets.

@rutger1140
rutger1140 / .htaccess
Created October 8, 2014 15:30
Kirby CMS htaccess file - SEO optimized - 1000+ spam related IP blocks
# pass the default character set
AddDefaultCharset utf-8
php_flag short_open_tag on
ErrorDocument 404 /error
# Kirby .htaccess
# exclude panel from trailing slash removal
@Schrank
Schrank / install-ioncube
Created September 9, 2014 19:34
Install ioncube in puphpet
# Put this file into puphpet/files/exec-once/install-ioncube so it only executed once
# it loads ioncube, unzips it, move and add it to php.ini
echo "Loading ioncube"
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
echo "Unzipping ioncube"
tar xvfz ioncube_loaders_lin_x86-64.tar.gz
echo "Move ioncube to usr/local"
mv ioncube /usr/local
echo "Add ioncube to php.ini"
if ($_SERVER['REMOTE_ADDR']=='127.0.0.1') {
define('WP_ENV', 'local');
} elseif ($_SERVER['HTTP_HOST']=='develop.project.com') {
define('WP_ENV', 'develop');
} elseif ($_SERVER['HTTP_HOST']=='master.project.com') {
define('WP_ENV', 'develop');
} else {
define('WP_ENV', 'production');
}
@lordastley
lordastley / Atkinson dither in PHP
Created November 6, 2011 09:08
1-bit Atkinson dither in PHP with GD
<?php
$img = imagecreatefromjpeg('./delayclose.jpg');
imagefilter($img, IMG_FILTER_GRAYSCALE);
$width = imagesx($img);
$height = imagesy($img);
$img_arr = array();
// Parse image (can be combined with dither stage, but combining them is slower.)