Skip to content

Instantly share code, notes, and snippets.

@odan
odan / factory.php
Last active August 14, 2017 14:26
Dependency Injection with PHP
<?php
class Configuration
{
private $settings = [];
public function __construct(array $settings)
{
$this->settings = $settings;
}
@odan
odan / slim4-cors-with-preflight-request.md
Last active May 18, 2020 21:01
Slim 4 - CORS with preflight request
@odan
odan / mock-flysystem-with-vfsStream.md
Last active July 2, 2020 12:02
Creating a mocked local filesystem adapter with vfsStream

Creating a mocked local Flysystem adapter with vfsStream

Note: In this example I doesn't use the flysystem Memory or Null adpater, because the Memory adapter doesn't implement the getPathPrefix method, like the AbstractAdapter does. For this reason I use the Local adapter in LOCK_NB mode in combination with vfsStream to simulate the filesystem in-memory.

Setup

composer require mikey179/vfsstream --dev
@odan
odan / php-oracle.md
Last active November 13, 2020 20:03
XAMPP - Oracle Driver Setup (v12)
@odan
odan / php-pdo-mysql-crud.md
Last active December 8, 2020 23:24
Basic CRUD operations with PDO and MySQL
@odan
odan / rest_quick_reference.md
Last active September 1, 2021 20:06
REST, RESTful API Quick Reference
@odan
odan / Slim 4 Tutorial.md
Last active January 15, 2022 11:22
Slim 4 Tutorial
@odan
odan / mock-ramsey-uuid.md
Last active February 16, 2022 16:53
Mock Ramsey\Uuid

Mock Ramsey\Uuid

The mock trait

<?php

namespace App\Test\Traits;

use Ramsey\Uuid\Generator\RandomGeneratorInterface;

Removing a Commit From Github

If you accidentally committed something you shouldn’t have, and pushed it to Github, there are still ways to delete or modify it.

You can do an interactive rebase, which is useful if the commit isn’t the most recent one. If the commit was, for example, 12 commits ago, you can rebase from then, remove the offending commit, and save.

git rebase -i HEAD~12