Skip to content

Instantly share code, notes, and snippets.

View wdalmut's full-sized avatar
💭
Fantasy Land

Walter Dal Mut wdalmut

💭
Fantasy Land
View GitHub Profile
@wdalmut
wdalmut / db-resource-zf1.php
Created June 25, 2012 12:38
Use fetch for ZF1 (fetchAll creates a big array)
<?php
$db = $model->getDbAdapterForCompany();
$stmt = $db->query('SELECT * FROM ' . $table);
while($row = $stmt->fetch(Zend_Db::FETCH_OBJ)) {
// ...
}
@wdalmut
wdalmut / .gitignore
Created July 3, 2012 08:39
Pimple getting started
vendor
composer.phar
log
.settings
.buildpath
.project
@wdalmut
wdalmut / config.m4
Created July 6, 2012 13:36
Example of PHP extension
dnl lines starting with "dnl" are comments
PHP_ARG_ENABLE(simplemvc, whether to enable Rlyeh extension, [ --enable-simplemvc Enable simple-mvc extension])
if test "$PHP_SIMPLEMVC" != "no"; then
dnl this defines the extension
PHP_NEW_EXTENSION(simplemvc, php_simplemvc.c view.c, $ext_shared)
dnl this is boilerplate to make the extension work on OS X
@wdalmut
wdalmut / .htaccess
Created July 9, 2012 08:14
Maintenance with .htaccess
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(css|jpg|png)$
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1$
RewriteCond %{REMOTE_ADDR} !^10\.64\.98\.201$
#RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
#RewriteRule ^.*$ /system/maintenance.html [L]
RewriteRule ^.*$ /maintenance.html [L]
@wdalmut
wdalmut / composer.json
Created July 26, 2012 07:09
Composer 4 Zend Framework 2 - dev
{
"minimum-stability": "dev",
"repositories": [
{
"type": "composer",
"url": "http://packages.zendframework.com/"
}
],
"require": {
"zendframework/zend-di": "2.0.*",
@wdalmut
wdalmut / .gitignore
Created July 26, 2012 16:46
ZF2 DiC - Zend Cache Object
composer.phar
vendor
@wdalmut
wdalmut / .gitignore
Created July 29, 2012 07:54
Pimple DiC - Zend Cache Object
vendor
composer.phar
@wdalmut
wdalmut / jsmin.php
Created August 21, 2012 16:55
Refactor JSMin for personal usage
<?php
/**
* JSMin.php - modified PHP implementation of Douglas Crockford's JSMin.
*
* <code>
* $minifiedJs = JSMin::minify($js);
* </code>
*
* This is a modified port of jsmin.c. Improvements:
*
@wdalmut
wdalmut / DBusNotifier.php
Created September 2, 2012 09:22
DBus notifier from sismo
<?php
/*
* This file is part of the Sismo utility.
*
* (c) Fabien Potencier <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
@wdalmut
wdalmut / a_log_database.sql
Created September 12, 2012 13:31
Just a Zend\Log\Logger on MySQL
CREATE DATABASE a_log_database;
USE a_log_database;
CREATE TABLE IF NOT EXISTS `log_table_name` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`priority` int(11) NOT NULL,
`priorityName` varchar(45) NOT NULL,
`message` varchar(255) NOT NULL,