Skip to content

Instantly share code, notes, and snippets.

View colindecarlo's full-sized avatar

Colin DeCarlo colindecarlo

  • Guelph, Ontario, Canada
View GitHub Profile
<?php
class Numberset
{
public function __construct($min, $max, $numbers = null)
{
$this->min = $min;
$this->max = $max;
// shhhh, don't tell anyone
<?php
class Numberset
{
// class definition
public function odd()
{
$this->numbers = array_filter($this->numbers, function ($number) {
return $number % 2;
<?php
class Numberset
{
protected $min;
protected $max;
protected $numbers;
<?php
class Aggregator
{
protected $data = null;
public static function create()
{
$instance = new static;
$instance->load();
<?php
class Employee
{
protected $salary;
public function __construct($salary)
{
$this->salary = $salary;
}
@colindecarlo
colindecarlo / gist:0975cf71266e0acbc8c0
Last active December 20, 2015 04:02
Illuminating Legacy Applications
Inheriting a legacy application can be a very intimidating position to find yourself in. Being constantly
haunted by the decisions of the "Original Developer" can lead any rational person to the conclusion that a
ground up rewrite is the only way out. But rewrites are anything but rational, they're the wrong decision
almost every time so why take the risk?
This talk will offer attendees a practical approach to incrementally integrating the various Illuminate packages
from the Laravel Framework into virtually any legacy application all the while keeping it live and in production.
Learn to take that hostile, embarrassing application from a mess of functions, SQL injections and global state to
something you can actually be proud of.
$matches->filter(function ($matchResult) use ($hashes) {
$matchResult->remove($hashes);
return $matchResult->isEmpty();
});
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkJUAJ27UM6L8mhVCw8//O+DGk0D4MdmoAqJFxFcQYla8oF66hlJqoeTyZNnt7z0If+4f0POAoGJczppKZvzBQ+yUbh1YzYhTpS1XpYpig64hDi6R11+xf8spWgwZJc2IbgLNzSsrJk4khHzLmftIOV9OpeQblkWMf0H7WyP/e4xZNm2iaoHopIVgJwv1XWF8FOChP7b6y2ZdsEWnUkuTsW61uPdvAubOw/g3/C+nLrUg79CW+pwyjnBrATEWzjPdtADjjiID5EVKB7KuKXXk/eYGNUx9UO9AzxVTzP7oIkONmBCebEPA+ZOQIcqfspTYLHJN6omYHdAf4rDUKfsHl [email protected]
<?php
function array_is_subset($superset, $subset)
{
if (count($superset) < count($subset)) {
return false;
}
$candidates = $superset;
$found = 0;
1. Objects in PHP have methods which are referred to as 'magic methods'. Name these methods and
describe thier individual functions.
2. PHP Objects support single inheritance, what keyword is used to define the inheritance
relationship and describe some key effects inheritance has.
3. PHP objects support property and method visibility. What are the keywords used to describe
visibility and describe how each keyword affects the property or method.
4. What is a Trait in PHP? What effect does a Trait have on a PHP class that uses it?