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
@Ocramius
Ocramius / active.md
Created April 7, 2016 16:38 — forked from paulmillr/active.md
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Mon, 01 Dec 2014 00:48:25 GMT till Tue, 01 Dec 2015 00:48:25 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user => user.followers > 508)
@Ocramius
Ocramius / pr.md
Created April 4, 2014 06:23 — forked from piscisaureus/pr.md

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:

<?php
interface CustomerRepository
{
public function isPremiumCustomer(CustomerId $customerId) : bool;
// ... more API (fetch collections, filter, etc):
public function findAllPremiumCustomer() : PremiumCustomersList;
public function findAllPremiumCustomerIds() : PremiumCustomersIdList;
}

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@Ocramius
Ocramius / Bootstrap.php
Last active December 20, 2015 05:29 — forked from vaurat/gist:6070898
<?php
use Doctrine\Common\Annotations\AnnotationRegistry;
use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\ODM\MongoDB\DocumentManager;
/* @var $loader \Composer\Autoload\ClassLoader */
$loader = require __DIR__.'/vendor/autoload.php';
<?php
/**
* So for example I have two tables "ab" and "cd". "ab" references "cd" table
*/
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="\App\Entity\Repository\Ab")
@Ocramius
Ocramius / options.php
Last active December 13, 2015 21:28 — forked from bakura10/options.php
<?php
return array(
'zfr_cron' => array(
'tasks' => array(
'factories' => array(
'remove_fake_accounts' => 'Application\Cron\RemoveFakeAccountsFactory'
)
)
)
<?php
//
// Measure the time to execute two thousand jobs ten times.
//
require_once __DIR__.'/../vendor/autoload.php';
function benchmark($resque, $count) {
$start = microtime(true);
for($i=$count;$i > 0;--$i) {
<?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)