Skip to content

Instantly share code, notes, and snippets.

View quimcalpe's full-sized avatar

Quim Calpe quimcalpe

View GitHub Profile
@mindplay-dk
mindplay-dk / Container.php
Last active February 16, 2022 16:37
Minimal DI container
<?php
class Container
{
/** @var Closure[] */
private $factories = [];
/** @var array */
private $components = [];
@domenic
domenic / .bashrc
Last active September 1, 2015 17:50
.bashrc with GitHub PR function
pr () {
git fetch origin refs/pull/$1/head:refs/remotes/origin/pr/$1 --force
git checkout -b pr/$1 origin/pr/$1
git rebase master
git checkout master
git merge pr/$1 --ff-only
}
@quimcalpe
quimcalpe / player.rb
Last active December 20, 2015 10:09
RubyWarrior intermediate epic mode
##
# No custom level tricks
#
# Total Score: 804 + 181 = 985
# Your average grade for this tower is: S
#
# Level 1: S
# Level 2: A
# Level 3: S
# Level 4: S
@quimcalpe
quimcalpe / player.rb
Last active December 20, 2015 08:59
RubyWarrior beginner epic mode
##
# No custom level tricks
#
# Total Score: 544 + 107 = 651
# Your average grade for this tower is: S
#
# Level 1: S
# Level 2: S
# Level 3: S
# Level 4: S
<?php
class AcmeController implements ContainerAwareInterface
{
use ContainerAwareTrait;
use RedirectTrait;
public function indexAction()
{
return $this->redirect('some_route', [
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
anonymous
anonymous / gist:3753571
Created September 20, 2012 02:10
@ChristinGorman gave this talk at JavaZone: https://vimeo.com/49484333 It's quite good, short, energetic, enthusiastic,
intelligent, and completely misses the point.
While it's true that the code she produces is much better than the original, and is quite easy to understand; it fails one
critical test. It's not polite.
Polite code is like a well written newspaper article. It allows you to bail out early. A well written article has a
headline, a synopsis, and a set of paragraphs that begin with the high level concepts and get more and more detailed as you
read through the article. At any point you can decide: "I get it! I don't need to read further." Indeed, this is how most
people read newspapers or magazines. The articles are polite, because they allow you to get out quickly.