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.
#!/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
#########################################
## 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

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

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 / listener.php
Created August 29, 2012 19:54
Example of triggering another dispatch event in ZF2
<?php
use Zend\Mvc\Router\RouteMatch;
// Listener on dispatch.error event
$listener = function ($e) {
$app = $e->getTarget();
$events = $app->getEventManager();
$event = clone $e;
$matches = new RouteMatch(array('controller' => 'Some\Controller\Alias'));
$event->setRouteMatch($matches);
@weierophinney
weierophinney / composer.json
Created June 4, 2020 14:27
Sample minimalist "mezzio" application (really just Stratigility + Mezzio routing)
{
"require": {
"laminas/laminas-stratigility": "^3.2",
"mezzio/mezzio-fastroute": "^3.0",
"laminas/laminas-diactoros": "^2.3",
"laminas/laminas-httphandlerrunner": "^1.2"
}
}
@weierophinney
weierophinney / SoapController.php
Created February 12, 2014 16:46
Example of creating a SOAP controller for handling both WSDL and SOAP requests in ZF2.
<?php
namespace Soap\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\Soap\AutoDiscover as SoapWsdlGenerator;
use Zend\Soap\Server as SoapServer;
class SoapController
{
@weierophinney
weierophinney / CallbackStream.php
Last active October 23, 2020 14:16
Examples of streams you can use for alternate output styles in PSR-7
<?php
/**
* @copyright Copyright (c) 2015 Matthew Weier O'Phinney (https://mwop.net)
* @license http://opensource.org/licenses/BSD-2-Clause BSD-2-Clause
*/
namespace Psr7Examples;
use Psr\Http\Message\StreamableInterface;
@weierophinney
weierophinney / zf2-workflow.txt
Created September 14, 2012 20:01
proposed workflow
We rename "master" to "develop"
We rename "release" to "master"
Thus "master" stays the default branch, which means most PRs will be made
against it.
Bugfixes are merged to:
- master
- develop
Features are merged to:
- develop
When develop looks like the next minor or major version:
@weierophinney
weierophinney / Dockerfile
Created November 1, 2018 22:00
Getting ext-tidy to work on alpine-based PHP images
# 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