Skip to content

Instantly share code, notes, and snippets.

View Ocramius's full-sized avatar
🔬
In your repositories, watching your code. Always watching.

Marco Pivetta Ocramius

🔬
In your repositories, watching your code. Always watching.
View GitHub Profile
<?php
namespace Application\Proxy;
use Zend\ServiceManager\ServiceManager as ZSM;
class ServiceManager extends ZSM
{
protected $proxy = null;
@Ocramius
Ocramius / README
Created October 14, 2012 12:49 — forked from jaytaph/README
Simple multi VM system
Simple multi VM system.
* Use "vagrant up" to install 3 vagrant boxes.
* Use "Vagrant ssh master|node1|node2" to ssh into the respective VM
* Most vagrant commands will need the additional nodename to work ("vagrant reload node1" for example)
return array(
'controllers' => array(
'initializers' => array(
function ($instance, $serviceManager) {
$sm = $serviceManager->getServiceLocator();
if ($instance instanceof EntityManagerAwareInterface) {
if($sm->has('doctrine.entitymanager.orm_default')) {
$instance->setEntityManager($sm->get('doctrine.entitymanager.orm_default'));
}
}
<?php
// module/Album/Module.php
namespace Album;
use Album\Model\AlbumTable;
use Zend\Mvc\ModuleRouteListener;
class Module
{
@Ocramius
Ocramius / pr.md
Created September 18, 2012 15:22 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@Ocramius
Ocramius / Client.class.php
Created July 23, 2012 09:30 — forked from yiseli/Client.class.php
Doctrine - Empty proxy object values
<?php
namespace Model\Entities;
use Doctrine\Common\Collections\ArrayCollection;
class Client extends Entreprise
{
function __construct($id = null, $nom = null) {
parent::__construct($id, $nom);
}
@Ocramius
Ocramius / module.config.php
Created June 26, 2012 16:32 — forked from SocalNick/module.config.php
ZF2 Sample Application Configuration for compiled Di
<?php
return array(
// Other component configuration (i.e. router, controller, view_manager
'di' => array(
'definition' => array(
'runtime' => array(
'enabled' => false,
),
@Ocramius
Ocramius / di.create-definitions.php
Created June 26, 2012 16:32 — forked from SocalNick/di.create-definitions.php
ZF2 Di definition compiler
<?php
// in ZF2 project, place this in ./bin directory
chdir(dirname(__DIR__));
$zf2Path = (getenv('ZF2_PATH') ?: 'vendor/ZendFramework/library');
require_once $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
require_once $zf2Path . '/Zend/Loader/StandardAutoloader.php';
use Zend\Loader\AutoloaderFactory;
use Zend\Loader\StandardAutoloader;
@Ocramius
Ocramius / Entity.php
Created June 24, 2012 15:55
Annotations in ZendFramework 2 and Doctrine
<?php
namespace BlitzEvent\Entity;
use Doctrine\ORM\Mapping as ORM;
use Zend\Form\Anotation;
/**
*
* @ORM\Entity(repositoryClass="BlitzEvent\Repository\Event")
@Ocramius
Ocramius / zscroll.html
Created June 5, 2012 07:47 — forked from cers/zscroll.html
Scrolling along the Z-Axis
<html>
<head>
<title>Scrolling along the Z-Axis</title>
<!--
Example from http://eng.wealtfront.com
Assumes browser window is sized at a height of 400px (the size of the black box).
-->
<style>
body{height:600px;}
#viewport {