Skip to content

Instantly share code, notes, and snippets.

@fprochazka
fprochazka / LookoutControl.php
Created October 15, 2010 10:41
LookoutControl - Control with fake life cycle
<?php
namespace Kdyby\Control;
use Nette;
use Nette\String;
class LookoutControl extends Nette\Application\Control
@loonies
loonies / 1_phpunit-api.md
Last active January 19, 2024 07:34
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this-&gt;anything()
@wowo
wowo / PHPUnit way to mock Doctrine2 Entity Manager.php
Created November 1, 2011 20:22
PHPUnit's way to mock Doctrine2 Entity Manager
<?php
class AbstractManagerBase extends \PHPUnit_Framework_TestCase
{
protected function getEmMock()
{
$emMock = $this->getMock('\Doctrine\ORM\EntityManager',
array('getRepository', 'getClassMetadata', 'persist', 'flush'), array(), '', false);
$emMock->expects($this->any())
->method('getRepository')
@enumag
enumag / Timer.php
Created February 11, 2012 20:00
PHP Timer
<?php
class Timer {
public static $time = array();
public static $last;
public static function start($name = NULL) {
static $i = 0;
@niepi
niepi / osx_php_homebrew.setup.md
Created February 28, 2012 13:23
OSX PHP Homebrew Setup

install php

with mysql pgsql intl support

$ brew install php --with-apache --with-mysql --with-pgsql --with-intl

set php timezone in php ini

date.timezone = Europe/Vienna
@NoxArt
NoxArt / BasePresenter.php
Created March 21, 2012 07:03 — forked from vojtech-dobes/BasePresenter.php
Annotation support for multiplied Nette components
<?php
use Nette\Application\UI;
use Nette\Reflection\Method;
class BasePresenter extends UI\Presenter
{
/** @var array datasets for Multipliers */
@lambder
lambder / partial.coffee
Created March 23, 2012 10:14
Partial function application in CoffeeScript
Function::partial = (part_args...) -> \
fun = @ \
(args...) -> fun.apply(@, [part_args..., args...])
f = (a,b) -> "#{a} >>>> #{b}"
f 'A', 'B' # outputs: 'A >>>> B'
pf = f.partial "XXX"
@mishak87
mishak87 / FacebookPresenter.php
Created May 5, 2012 17:31
Fix for facebook was not playing along with nette sessions
<?php
namespace UserModule;
use FixFacebook;
class FacebookPresenter extends AbstractSignPresenter
{
public function actionLogin()
@paulmillr
paulmillr / active.md
Last active July 15, 2024 10:55
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 Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

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 =&gt; user.followers &gt; 1000)
@mishak87
mishak87 / Router.php
Created May 24, 2012 12:01
Router for API REST like methods
<?php
namespace ApiModule;
use Nette,
Nette\Application\Request;
class Router extends Nette\Object implements Nette\Application\IRouter
{