Skip to content

Instantly share code, notes, and snippets.

View weierophinney's full-sized avatar
⏯️

Matthew Weier O'Phinney weierophinney

⏯️
View GitHub Profile
@weierophinney
weierophinney / logseq-up.sh
Last active March 29, 2023 18:57
Logseq launcher. This will launch Logseq if it isn't already, and otherwise raise it on the current workspace, pinned to the right side of the screen.
View logseq-up.sh
#!/bin/bash
# Launch Logseq and/or raise it.
#
# In all cases, it raises it on the current workspace, and positions it on the
# right half of the screen. Change the logic in get_width(), get_height(), and
# get_geometry() to change positioning and size.
#
# I bind this to <Super><Ctrl>-l, which allows me to launch it at any time.
get_width() {
@weierophinney
weierophinney / concatenate_with_commas.sh
Created October 21, 2022 13:54
Concatenate a list of strings using a comma in Bash
View concatenate_with_commas.sh
#########################################
## Concatenate a list of arguments with commas
##
## Outputs:
## Outputs all arguments as a single string, concatenated with commas
#########################################
concatenate_with_commas() {
local concatenated=""
local string
@weierophinney
weierophinney / README.md
Last active April 11, 2022 19:42
Adding Renovate to Laminas, Mezzio repositories
View README.md

Updating Laminas/Mezzio repositories to prepare for Renovate-Bot

Per discussion during the February 2022 Laminas Technical Steering Committee meeting, we have a plan for adding Renovate to automate the following in Laminas and Mezzio repsitories:

  • Automatically update composer.lock each night, without a pull request.
  • On test failures following ^^, open a PR.
  • Automatically widen ranges for new major releases in composer.json and create a PR.
  • Separate patches for laminas/* upgrades, as well as other repositories.

To do this, we need to do the following in each repository:

@weierophinney
weierophinney / laminas-gha.md
Last active April 24, 2021 15:14
How to prepare a PR to add the GHA CI workflow to Laminas/Mezzio/Laminas API Tools repos
View laminas-gha.md

PRs should do the following:

  • Remove the CHANGELOG.md file (we will be doing changelogs in the milestone descriptions, and those get propagated to tags and release notes)

  • Add the workflow file:

    mkdir -p .github/workflows ; cd  .github/workflows ; wget https://gist.githubusercontent.com/weierophinney/9decd19f76b7d9745c6559074053fa65/raw/6ffb33e59796cfec569405139aa65da9396ea5cd/continuous-integration.yml
@weierophinney
weierophinney / composer.json
Created June 4, 2020 14:27
Sample minimalist "mezzio" application (really just Stratigility + Mezzio routing)
View composer.json
{
"require": {
"laminas/laminas-stratigility": "^3.2",
"mezzio/mezzio-fastroute": "^3.0",
"laminas/laminas-diactoros": "^2.3",
"laminas/laminas-httphandlerrunner": "^1.2"
}
}
@weierophinney
weierophinney / Dockerfile
Created November 1, 2018 22:00
Getting ext-tidy to work on alpine-based PHP images
View Dockerfile
# DOCKER-VERSION 1.3.2
FROM php:7.2-cli-alpine3.8
# Compile-time dependencies
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.6/community' >> /etc/apk/repositories
RUN apk update && \
apk add --no-cache 'tidyhtml-dev==5.2.0-r1'
# Install the extension
@weierophinney
weierophinney / UserCollection.php
Created June 5, 2018 18:53
Example of casting an array of entities to a collection
View UserCollection.php
<?php
namespace App\Entity;
use ArrayIterator;
class UserCollection extends ArrayIterator
{
}
@weierophinney
weierophinney / index.html
Created May 31, 2018 22:31
Prototype for auto-populating the component dropdown and making it searchable.
View index.html
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Choices example</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
@weierophinney
weierophinney / RemoveDevPrefixMiddleware.php
Created September 14, 2017 19:23
Demonstrates stripping a path prefix prior to routing.
View RemoveDevPrefixMiddleware.php
<?php
use Interop\Http\ServerMiddleware\DelegateInterface;
use Interop\Http\ServerMiddleware\MiddlewareInterface;
use Psr\Http\Message\ServerRequestInterface;
class RemoveDevPrefixMiddleware implements MiddlewareInterface
{
private $prefix;
@weierophinney
weierophinney / Module.php
Created August 17, 2017 20:02
Demonstrates a zend-mvc listener that short-circuits, and how to register it
View Module.php
<?php
// In a module class somewhere...
use Zend\EventManager\LazyListener;
use Zend\Mvc\MvcEvent;
class Module
{
public function onBootstrap(MvcEvent $e)
{