Skip to content

Instantly share code, notes, and snippets.

View hugoleodev's full-sized avatar
🎯
Focusing

Hugo Leonardo hugoleodev

🎯
Focusing
View GitHub Profile
@hugoleodev
hugoleodev / Action.php
Created July 11, 2012 12:57
Esquema de controllers + CRUD + Service Layer
<?php
namespace Core\Controller;
class Action extends \Zend_Controller_Action
{
/**
* EntityManager retornado
* @var \Doctrine\ORM\EntityManager
*/
protected $em;
@hugoleodev
hugoleodev / Crud.php
Created July 11, 2012 12:57
Classe abstrata de crud
<?php
/**
* Classe abstrata para funcionalidade de CRUD
* @author Daniel Lima <yourwebmaker@gmail.com>
* @example
* <code>
* <?php
* Module_Foo_Controller extexds Cilens_Controller_Crud
* {
* protected $_modelName = 'Foo';
@hugoleodev
hugoleodev / foo.php
Created July 11, 2012 12:57
Exemplo de uso de services
<?php
/**
* Uso ser service class sem service locator
*/
class CategoriaProdutoController extends Controller
{
public function excluirAction()
{
$id = $this->_getParam('id');
$service = new CategoriaProdutoService;
@hugoleodev
hugoleodev / Usuario-Sem-Mapping.php
Created July 11, 2012 12:58
Mapeamento de tabela "usuario" pelo Doctrine 2
<?php
/*
* Workshop Doctrine 2 + ZF1
*
*/
namespace Application\Entity;
/**
* Usuario
* @author Administrator
*/
<?php
namespace Application\Entity;
use Doctrine\ORM\Mapping as ORM,
Doctrine\Common\Collections\ArrayCollection;
/**
* User
* @ORM\Entity
* @author Administrator
@hugoleodev
hugoleodev / application.ini
Created July 11, 2012 19:17
Application.ini funcionando
[production]
; --------------------------
; PHP Specific Configuration
; --------------------------
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"

Sample PHP+Mongo app on Heroku

  1. Install any of the Mongo add-ons available at http://addons.heroku.com

  2. Vendor the Mongo driver with your application. You can download it here:

    https://github.com/wuputah/heroku-libraries/raw/master/php/mongo/mongo.so
    

    Add it to a folder like "ext".

@hugoleodev
hugoleodev / org.php.php-fpm.plist
Created November 17, 2012 01:52
Install Nginx + PHP-fpm + MySQL on Mac OS X Lion 10.7.2
# First install requirements for BREW
# http://mxcl.github.com/homebrew/
# https://github.com/mxcl/homebrew/wiki/installation
# Requirements
# - An Intel CPU 2
# - OS X 10.5 or higher
# - Command Line Tools for Xcode (https://developer.apple.com/downloads)
# or Xcode with X11 (http://itunes.apple.com/us/app/xcode/id448457090)
# - Java Developer Update (https://connect.apple.com/)
@hugoleodev
hugoleodev / innobackupex-restore.sh
Created November 23, 2012 18:20 — forked from dalecaru/innobackupex-restore.sh
Scripts to create and restore full and incremental backups (for all databases on server) using innobackupex from Percona.
#!/bin/sh
#
# Script to prepare and restore full and incremental backups created with innobackupex-runner.
#
# This script is provided as-is; no liability can be accepted for use.
#
INNOBACKUPEX=innobackupex-1.5.1
INNOBACKUPEXFULL=/usr/bin/$INNOBACKUPEX
TMPFILE="/tmp/innobackupex-restore.$$.tmp"
@hugoleodev
hugoleodev / hosts-dev
Created January 10, 2013 01:13
Configuração do apache para desenvolvimento customizado
# Ativar o modulo "mod_vhost_alias" do apache: sudo a2enmod vhost_alias
# Instalar o dnsmask: sudo apt-get install dnsmasq
# Adicionando ao final do arquivo "/etc/dnsmasq.conf" as seguintes linhas:
# listen-address=127.0.0.1
# address=/.dev/127.0.0.1
#
# Crie o arquivo de configuração do apache adcionandoas linhas a baixo
<VirtualHost *:80>
ServerAdmin webmaster@localhost