Skip to content

Instantly share code, notes, and snippets.

View Potherca's full-sized avatar
🤔
I wonder what this button does…

Ben Peachey Potherca

🤔
I wonder what this button does…
View GitHub Profile
@Potherca
Potherca / Do not commit the `phpunit.xml` file.md
Last active July 10, 2024 09:28
Do not commit the `phpunit.xml` file
@Potherca
Potherca / pipeline-components-pulls.md
Last active July 5, 2024 12:17
Amount of pulls from docker hub for each of the gitlab pipeline-components.

It used to be hard to Base64 encode an image. Most often, a server-side component was used.

Nowadays, with FileReader readAsDataURL it can be easily done, 100% in the browser.

    const file =  // the contents of the image goes here

    const reader = new FileReader();

    reader.onload = (event) => {

Copy Button

This gist contains the recipe to make a copy button.

It is activated by adding data-js="copy" to an element and including the CSS and JS files.

<link rel="stylesheet" href="https://gist.pother.ca/33b4d10024f56ba0610f8e70477687cb/copy-button.css">
      <script async src="https://gist.pother.ca/33b4d10024f56ba0610f8e70477687cb/copy-button.js"></script>
Your Text Goes Here
@Potherca
Potherca / README.md
Last active June 14, 2024 10:37
Bookmarklet for Pinguin Radio

This gist contains JS code that can be used as a bookmarklet to change the new (awesome!) Pinguin Radio website to only display the audio player.

Before

Screenshot at 2023-03-15

After

Screenshot at 2023-03-15

@Potherca
Potherca / README.md
Last active June 5, 2024 07:46
Use `array_walk` instead of `foreach`.md -- Potherca's rules for creating more robust code in PHP
@Potherca
Potherca / README.md
Last active May 31, 2024 07:27
BASH script to clone all git repository in a Group on GitLab, or Organization on GitHub.

Introduction

Starting at a new employer always mean checking out various git repositories.

As the amount of repositories a company has grows, the time needed to clone all of those repositories also grows.

This script automates this task.

In order for this script to work, a personal access token is needed.

@Potherca
Potherca / README.md
Last active May 29, 2024 10:57
The search for a Regex to match BEM CSS class-names

The search for a Regex to match BEM CSS class-names

TL;DR

Use this regular expression to match BEM class-names:

^\.[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$