Skip to content

Instantly share code, notes, and snippets.

@MustafaMagdi
MustafaMagdi / Container.php
Last active January 6, 2025 13:07 — forked from tlikai/container.php
PHP Dependency Injection Container
<?php
/**
* Class Container
*/
class Container
{
/**
* @var array
*/
@hexblot
hexblot / EventSystem.php
Created October 27, 2016 14:24
A very simple event system for PHP Projects
<?php
/**
* A class to implement a simple event system in any PHP project.
*
* @author Nick Andriopoulos <[email protected]>
* @license https://www.apache.org/licenses/LICENSE-2.0
*/
/**
@wojteklu
wojteklu / clean_code.md
Last active April 29, 2025 11:05
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@tixastronauta
tixastronauta / facebook_leads.md
Last active April 7, 2025 17:35
Receiving Facebook Leads on a Webhook
@zachflower
zachflower / LinkedList.class.php
Last active April 15, 2021 18:33
PHP implementation of a singly linked list.
<?php
class Node {
public $data = NULL;
public $next = NULL;
public function __construct($data = NULL) {
$this->data = $data;
}
}
@DragonBe
DragonBe / Product.php
Created March 28, 2014 13:21
Example usage for ArrayAccess interface
<?php
class Product implements ArrayAccess
{
protected $_productId;
protected $_title;
protected $_price;
protected $_arrayAccess;
public function __construct($data = null)
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream