Skip to content

Instantly share code, notes, and snippets.

View humbertodosreis's full-sized avatar

Humberto dos Reis Rodrigues humbertodosreis

View GitHub Profile
<?php
use Zend\Db\Sql\Select;
// basic table
$select0 = new Select;
$select0->from('foo');
// 'SELECT "foo".* FROM "foo"';
<?php
class Model_Acl extends Zend_Acl {
public function __construct() {
// define Roles
$this->addRole(new Zend_Acl_Role('guest')); // not authenicated
$this->addRole(new Zend_Acl_Role('member'), 'guest'); // authenticated as member inherit guest privilages
$this->addRole(new Zend_Acl_Role('admin'), 'member'); // authenticated as admin inherit member privilages
server {
listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
root /home/example/public;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name dev.apigility.com;
# ************************************
# Vhost template in module puppetlabs-apache
# Managed by Puppet
# ************************************
<VirtualHost *:80>
ServerName awesome.dev
## Vhost docroot
DocumentRoot "/var/www/awesome/web"
server {
listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
root /home/example/public;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name dev.apigility.com;
@humbertodosreis
humbertodosreis / SoapClientTimeout.class.php
Created December 16, 2015 02:45 — forked from RobThree/SoapClientTimeout.class.php
PHP SoapClient with timeout
<?php
//Drop-in replacement for PHP's SoapClient class supporting connect and response/transfer timeout
//Usage: Exactly as PHP's SoapClient class, except that 3 new options are available:
// timeout The response/transfer timeout in milliseconds; 0 == default SoapClient / CURL timeout
// connecttimeout The connection timeout; 0 == default SoapClient / CURL timeout
// sslverifypeer FALSE to stop SoapClient from verifying the peer's certificate
class SoapClientTimeout extends SoapClient
{
private $timeout = 0;
private $connecttimeout = 0;
@humbertodosreis
humbertodosreis / gist:362917b6024987fcf28993438e9dd6e5
Created July 4, 2017 22:46 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
phpcs.standard = WordPress
phpcs.tabWidth = 4
phpcs.encoding = utf-8
ftp.host = ftp.example.com
ftp.port = 21
ftp.username = username
ftp.password = password
ftp.project.dir = /subdomains/docs/httpdocs/${project.name.safe}
ftp.dir = ${ftp.project.dir}/${project.version}
@humbertodosreis
humbertodosreis / data.php
Created August 17, 2017 21:35 — forked from sraboy/data.php
An updated server-side processing script for DataTables
<?php
/*
* Script: DataTables server-side script for PHP and MySQL
* Copyright: 2016 - Steven Lavoie
* Copyright: 2012 - John Becker, Beckersoft, Inc.
* Copyright: 2010 - Allan Jardine
* License: GPL v2 or BSD (3-point)
*/
namespace Common\Utilities;
@humbertodosreis
humbertodosreis / ForcedLogoutListener.php
Created November 29, 2017 19:27 — forked from slavafomin/ForcedLogoutListener.php
Logging user out of Symfony 2 application using kernel event listener
<?php
namespace App\Security;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;