Skip to content

Instantly share code, notes, and snippets.

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
@odan
odan / soap-xmldsig.md
Created June 1, 2021 14:23
Sign SOAP messages with xmlseclibs

Sign SOAP messages with xmlseclibs

Requirements

  • PHP 7.4+
  • OpenSSL

Generating Public and Private Keys

First we have to create a private key for signature creation, and a public key for verification.

@odan
odan / nginx-php-windows-setup.md
Last active May 4, 2024 02:16
Nginx and PHP Setup on Windows

Nginx and PHP Setup on Windows

For local development you could also use Nginx with PHP as an replacement for XAMPP.

Install Nginx

@odan
odan / mysq_uuid_v4.md
Last active January 12, 2024 01:11
Generating UUID v4 in MySQL

Generating UUID v4 in MySQL

SELECT
  LOWER(
    CONCAT(
      # 1th and 2nd block are made of 6 random bytes
      HEX(RANDOM_BYTES(4)),
      '-',
 HEX(RANDOM_BYTES(2)),
@odan
odan / Slim 4 Tutorial.md
Last active January 15, 2022 11:22
Slim 4 Tutorial
@odan
odan / twitter-images.md
Last active March 25, 2023 11:26
Twitter images

Twitter Images (2020)

  • Header photo: 1500 x 500 px

  • Profile photo: 400 x 400 px

  • Tweet image: Recommended: 1200 x 628

  • Image types include: JPG, GIF or PNG.

Source

@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 / 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;
@odan
odan / slim4-cors-with-preflight-request.md
Last active May 18, 2020 21:01
Slim 4 - CORS with preflight request