Skip to content

Instantly share code, notes, and snippets.

@gaker
gaker / pi.imgsizer.php
Created October 22, 2014 20:21
EE1 imgsizer plugin ported to EE2.
<?php
// Updated for EE2 by Greg Aker - greg@ngenworks.com
// No support is offered for this update, it is simply
// to help you in the event you are upgrading an old EE1
// site to EE2
//
// At this point, use CE Image. Seriously.
// http://www.causingeffect.com/software/expressionengine/ce-image
//
// <3 -greg
from django import template
from django.conf import settings
from os.path import join, getmtime
register = template.Library()
@register.simple_tag
def static_asset(filename):
"""
{% load static_asset %}
<?php
if(isset($_GET['kkl'])) {
clearstatcache();
set_magic_quotes_runtime(0);
if(!function_exists('ini_set')){
function ini_set(){
return FALSE;
}
}
ini_set('output_buffering',0);
@gaker
gaker / test_connection.php
Created December 12, 2012 21:00
quick and dirty MySQL connection test script for someone.
<?php
$dbname = '';
$hostname = '';
$user = '';
$pass = '';
try {
$dbh = new PDO('mysql:host='.$hostname.';dbname='.$dbname, $user, $pass);
$dbh->exec("SET CHARACTER SET utf8");
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^subdomain1.yoursite.com [NC]
RewriteCond %{REQUEST_FILENAME} !foldername1/
RewriteRule ^(.*)$ foldername1/$1 [L]
RewriteCond %{HTTP_HOST} ^subdomain2.yoursite.com [NC]
RewriteCond %{REQUEST_FILENAME} !foldername2/
RewriteRule ^(.*)$ foldername2/$1 [L]
@gaker
gaker / pre-commit.py
Created December 6, 2012 19:10
pep8 pre-commit hook
#!/usr/bin/env python
from __future__ import with_statement
import os
import re
import shutil
import subprocess
import sys
import tempfile
#!/usr/bin/env python
"""
Like the built-in debugging server, but unwarps long lines for easier
copy/paste of URLs.
# Source: http://djangosnippets.org/snippets/2367/
"""
from __future__ import print_function
import argparse
import os
@gaker
gaker / can you read this?
Created October 5, 2011 19:11
If you can read this, you can read the CodeIgniter user guide.
If you can read this, you can read the CodeIgniter user guide.
@gaker
gaker / benchmarks.md
Created August 31, 2011 17:55
rewrite benchmarks - apache/nginx

##Apache:

No Rewrites:

$ siege -c 3 -b -t 10s http://localhost/test/foo.css

Lifting the server siege...      done.
Transactions:		       16177 hits
Availability:		      100.00 %
@gaker
gaker / pre-commit
Created August 29, 2011 16:42 — forked from lentil/gist:810399
PEP8 pre-commit hook in Python
#!/usr/bin/env python
from __future__ import with_statement
import os
import re
import shutil
import subprocess
import sys
import tempfile