Skip to content

Instantly share code, notes, and snippets.

View davidreuss's full-sized avatar

David Reuss davidreuss

View GitHub Profile
ctags-exuberant -f ./tags -h ".php" \
-R --exclude="\.hg" --totals=yes --tag-relative=yes \
--PHP-kinds=+cf --regex-PHP='/abstract class ([^ ]*)/\1/c/' \
--regex-PHP='/interface ([^ ]*)/\1/c/' \
--regex-PHP='/(public \|static \|abstract \|protected \|private )+function ([^ (]*)/\2/f/' \
--exclude="*.js"
@davidreuss
davidreuss / gitolite-config-current.conf
Created August 17, 2010 10:29
current gitolite-config
# For documentation on format of this file go to:
# http://github.com/sitaramc/gitolite/blob/master/conf/example.conf
# Peytz
@peytz = jage-peytz jakr-peytz
# PZ
@pointzero = hema chmo thbr stof
# Admins
@davidreuss
davidreuss / test_network.sh
Created June 9, 2010 12:28
test network bandwidth without waisting disk
dd if=/dev/zero bs=4096 count=1048576 | ssh user@host.tld 'cat > /dev/null'
( echo -e "HTTP/1.0 200 Ok\n\r"; tail -f error_log; ) | nc -lp 1234
ntpdate -v -b in.pool.ntp.org
<?php
class My_Plugin_Fubar extends Zend_Controller_Plugin_Abstract {
public function preDispatch(Zend_Controller_Request_Abstract $request) {
$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();
$assembled = $router->getCurrentRoute()->assemble(array(
'controller' => $request->getControllerName(),
'action' => $request->getActionName()
), true, null, true);
@davidreuss
davidreuss / route_extension.php
Created March 8, 2010 11:58
extension route attempt in zend framework - this fails as every parameter is checked for each route :(
<?php
$def = new Zend_Controller_Router_Route(
':module/:controller/:action/*',
array(
'module' => 'public',
'controller' => 'index',
'action' => 'index'
)
);
<?php
class FooController extends Zend_Controller_Action {
public function init() {
$ctx = $this->_helper->getHelper('AjaxContext');
$ctx->addActionContext('render', 'html')
->initContext();
}
public function renderAction() {
@davidreuss
davidreuss / ActionMapper.php
Created February 10, 2010 23:10
bringing extensions to zend framework mvc
<?php
class My_Controller_Plugin_ActionMapper extends Zend_Controller_Plugin_Abstract {
public function preDispatch() {
$request = $this->getRequest();
list ($action, $format) = explode('.', $request->getActionName());
if ($format) {
$request->setParam('format', $format);
$request->setParam('action', $action);
@davidreuss
davidreuss / tv_dir_cleanup.sh
Created February 6, 2010 18:07
script for cleaning up files in download directory
#!/bin/zsh
[ -z "$1" ] && {
echo "What directory do you want me to look in?"
exit 1
}
[ -d "$1" ] || {
echo "'$1' doesn't look like a directory"
exit 1