Skip to content

Instantly share code, notes, and snippets.

@gbirke
gbirke / cmds.txt
Created May 1, 2020 22:02
custom rofi menu with tab-separated text file, cut and awk
ls_home>show home> ls ~
ranger> > ranger
config_nvim>Configure NVim> vim -c "cd ~/.config/nvim" ~/.config/nvim/init.vim
# vim: set list listchars:tab=>- noexpandtab tabstop=15
~
@gbirke
gbirke / factory-callable.php
Last active April 29, 2020 08:50
Dependency inversion of PHP factories with callables
<?php
// This example shows:
// 1) How to invert the dependency of initialization of factories in dependent
// modules by giving a callable. This will defer the initialization of the
// dependency.
// 2) How to use a closure inside of a class as a callable. Notice how accessing
// "$this->presenter" gives the current presenter, not the one that was stored
// when the closure was created.
@gbirke
gbirke / .drone.yml
Last active September 10, 2020 17:54
Notes from my experimentation with Drone CI
---
kind: pipeline
type: docker
name: default
steps:
- name: deploy
image: wikimediade/fundraising-ansible-deploy
pull: never # Until we publish the image
user: ansible
@gbirke
gbirke / dependencies.md
Last active June 7, 2019 13:43
A Wikibase interactive MUD

Node dependencies:

  • wikibase-sdk
  • bluereq
  • vorpal
@gbirke
gbirke / test.md
Last active September 12, 2018 09:54
testing hashes in syntax highlighting

Follow these steps:

if [ -f test ]; then
  echo "exists!"
else 
  echo "missing!"
fi
@gbirke
gbirke / fdeploy.sh
Last active May 13, 2019 13:36
WMDE Fundraising deployment shell menu
#!/bin/bash
HEIGHT=15
WIDTH=40
CHOICE_HEIGHT=4
TITLE="Deploy fundraising apps"
MENU="Choose one of the following options:"
OPTIONS=(T "Fundraising Frontend TEST "
L "Fundraising Frontend LAIKA SKIN"
@gbirke
gbirke / php_feature_toggle_review.md
Last active June 11, 2018 08:39
Overview of PHP feature toggle libraries

Overview of PHP feature toggle libraries

Ordered by personal preference, while thinking about using them for https://github.com/wmde/FundraisingFrontend

Pro:

  • Common checks based on user/environment/date are already defined.
  • Provides logging/audit
  • Allows caching of feature sets so feature config does not need to be read on every request
  • Uses PHP 7
@gbirke
gbirke / update_all.sh
Created February 19, 2018 14:54
Update a mediawiki installation from git repositories
#!/bin/sh
echo "Updating core"
git pull
composer update
for e in extensions/*; do
if [ -d "$e" ]; then
cd $e
echo "Updating $(pwd)"
@gbirke
gbirke / svg-background-test.html
Created December 29, 2017 09:24
Testing SVG background images
<!DOCTYPE html>
<html>
<head>
<title>SVG-Test</title>
<style>
.foo {
background:url('Thank-you-2017-background-900.svg') no-repeat top center;
background:url('https://upload.wikimedia.org/wikipedia/commons/9/9b/Thank-you-2017-background-1200.svg') no-repeat>
background-size: cover;
height:300px;
@gbirke
gbirke / count_error_severities.jq
Last active August 31, 2019 15:21
jq example files
reduce inputs as $obj (
{};
if $obj.severity == "E" then
. + {
($obj.severity): (.[$obj.severity] + 1)
}
else
.
end
)