Skip to content

Instantly share code, notes, and snippets.

View sheeep's full-sized avatar
🐑

Jim Schmid sheeep

🐑
View GitHub Profile

Keybase proof

I hereby claim:

  • I am sheeep on github.
  • I am sheeep (https://keybase.io/sheeep) on keybase.
  • I have a public key whose fingerprint is C6CE 0521 1371 6086 5140 1CCC 46B9 50ED AE5B DAB9

To claim this, I am signing this object:

@sheeep
sheeep / wizard.php
Created April 17, 2014 12:19
In case you ever need a string concatenation wizard.
<?php
class ƒ
{
protected $buffer;
public function ‚($inp)
{
$this->buffer .= $inp;
return $this;
}
<?php
namespace Acme\UserBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
class UserController extends Controller
{
<?php
namespace Acme\DemoBundle\EventListener;
use Oneup\UploaderBundle\Event\PostPersistEvent;
class UploadListener
{
public function onUpload(PostPersistEvent $event)
{
backend default {
.host = "127.0.0.1";
.port = "80";
}
sub vcl_recv {
if (req.http.Cache-Control ~ "no-cache") {
return (pass);
}
<?php
class Foo
{
public $data = array();
public function addToOffset()
{
$args = func_get_args();
$value = $args[0];
<?php
namespace Acme\DemoBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
class DemoController extends Controller
<?php
function call(callable $c) {
$c();
}
class A {
public static function b() {
echo "foo";
}
@sheeep
sheeep / sas.php
Last active December 18, 2015 02:39
Short Array Syntax (PHP5.4)
<?php
$fruits = array('apples', 'oranges', 'bananas'); // 5.3 like
$fruits = ['apples', 'oranges', 'bananas']; // alike the javascript notation
// associative array
$array = [
'foo' => 'bar',
'bar' => 'foo'
];
@sheeep
sheeep / traits4.php
Created June 5, 2013 10:43
Traits: Conflict resolution.
<?php
trait A { public function foo() { return 1; }}
trait B { public function foo() { return 2; }}
// fatal error
class C {
use A, B;
}