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 / README.md
Last active November 14, 2023 13:51
"Incremental" vs. "Iterative"
@Potherca
Potherca / README.md
Last active October 20, 2023 20:40
PHP Split file with multiple classes into separate files.

Split a file with mulitple classes into separate files.

Installation

git clone git@gist.github.com:594adece80ad1e9ddbce0b207db8ed0c.git split-file
cd split-file
composer install

Usage:

@Potherca
Potherca / example.js
Created October 13, 2023 14:11
set search params on an URL in javascript
const url = new URL(document.location)
const search = new URLSearchParams()
const options = {
"foo": "hello",
"bar":"world"
}
Object.entries(options).forEach(([key, value]) => {
@Potherca
Potherca / README.md
Last active October 13, 2023 13:11
An automated HTML element overview page. https://gist.pother.ca/0a04271c143bc51862a6cc40a0a74b2f

HTML Element Reference

There are some great resources out there that document HTML elements.

Such as HTML Elements on MDN and htmlreference.io.

However, for me, most of these resources are either too exhaustive (like MDN) or too brief (like htmlreference.io).

What I want is a list of all available HTML elements, to get an idea of what the element is, without having to click through to another page. But also with enough information to know what the element is used for and how it is used.

@Potherca
Potherca / README.md
Last active August 29, 2023 14:36
Five laws of l̶i̶b̶r̶a̶r̶y̶ ̶s̶c̶i̶e̶n̶c̶e̶ software applications.

Five laws of library science

[The Five laws of Library Science][1] is a theory that S. R. Ranganathan proposed in 1931, detailing the principles of operating a library system.

  • Books are for use.
  • Every person his or her book.
  • Every book its reader.
  • Save the time of the reader.
  • A library is a growing organism.
@Potherca
Potherca / jwk_with_phpseclib_test.php
Created July 17, 2023 10:28 — forked from sicet7/jwk_with_phpseclib_test.php
Use JWK from JSON with the lcobucci/jwt library through phpseclib. Credit to @whatTool for helping with the implementation
<?php
//REQUIREMENTS!
//"phpseclib/phpseclib": "^3.0"
//"lcobucci/jwt": "^5.0"
require_once __DIR__ . '/vendor/autoload.php';
$json = '{
"keys": [
{

This gist contains the recipe to make a copy button.

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

<link rel="stylesheet" href="https://gist.pother.ca/33b4d10024f56ba0610f8e70477687cb/copy-button.css"&gt
<script async src="https://gist.pother.ca/33b4d10024f56ba0610f8e70477687cb/copy-button.js"></script&gt
<pre data-js="copy">Your Text Goes Here</pre>
@Potherca
Potherca / Anti Pattern Checklist.md
Last active June 13, 2023 10:11
Anti Pattern Checklist (based on wikipedia article) https://gist.pother.ca/2e5817a37b1229ea1930/

Anti Patterns Checklist

In order to help developers and managers gain insight into the plethora of things that can go wrong at different levels in a software project, this list (taken from wikipedia https://en.wikipedia.org/wiki/Anti-pattern) offers a quick print-and-fill questionaire that can aid in discussion and education.

The crude jQuery used to strip down the wiki page is included in this gist.

Live view at: https://gist.pother.ca/2e5817a37b1229ea1930/

Local Web Worker

Under normal circumstances, a Web Worker should be passed a URL of the script to execute. However, a local function can also be used

This is done by converting a function to a string, converting that string to a Blob, and converting that Blob to an Object URL.

Code

The code to do this would look a bit like this:

@Potherca
Potherca / README.md
Last active May 11, 2023 13:41
Markdown Template for Daily Scrum meetings

Daily Scrum Template

When taking part of a Daily Scrum as Scrum Master, I find it handy to take notes. This makes sure I can hand over the role, if need be. It also means I don't have to rememeber everything as I can look things up in my notes later.

Below is the structure I use as format or "template" for taking notes.

Some things of importance: