Skip to content

Instantly share code, notes, and snippets.

View dreadwarrior's full-sized avatar
📚
Currently totally into books 😊

Tommy Juhnke dreadwarrior

📚
Currently totally into books 😊
View GitHub Profile
@dreadwarrior
dreadwarrior / DropwizardToMicrometerBridge.java
Created July 14, 2022 10:04 — forked from jonmcewen/DropwizardToMicrometerBridge.java
Hacky bridge to grab dropwizard metrics and stick them into a micrometer registry. Add as a spring-boot Bean
package com.boohoo.esbdefused.metrics;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import com.codahale.metrics.Counter;
import com.codahale.metrics.Gauge;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.Meter;
import com.codahale.metrics.MetricRegistry;
@dreadwarrior
dreadwarrior / rollyourown.php
Created June 13, 2018 09:19 — forked from mathiasverraes/rollyourown.php
We don't need no DIC libs / we don't need no deps control
<?php
// Context: I'm trying to argue that DI (and DIC) are great, and DIC libs suck.
// Happy to be proven wrong!
final class Router {
private $dependencies;
public function __construct (Dependencies $dependencies) {
$this->dependencies = $dependencies;
// You might say that this is Service Locator, but it's not. This router is toplevel,
// and toplevel must have access to dependencies. After that it can all just bubble nicely using proper DI.

Test Doubles

There are five types:

  • Dummy
  • Stub
  • Spy
  • Mock
  • Fake
@dreadwarrior
dreadwarrior / gitproxy-socat
Created June 19, 2016 20:14 — forked from sit/gitproxy-socat
A simple wrapper around socat to use as a git proxy command
#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
# Requires that the proxy allows CONNECT to port 9418.
#
# Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run
# chmod +x gitproxy
# git config --global core.gitproxy gitproxy
#
# More details at http://tinyurl.com/8xvpny
@dreadwarrior
dreadwarrior / fcgiwrap_gitolite.conf
Last active August 29, 2015 14:26 — forked from alanbriolat/fcgiwrap_gitolite.conf
fcgiwrap setup for gitweb + gitolite
; Spawn fcgiwrap as the user owning the git repositories, with a socket writeable by nginx
[fcgi-program:fcgiwrap_gitolite]
command = /usr/sbin/fcgiwrap
user = gitolite
socket = unix:///var/run/supervisor/%(program_name)s.sock
socket_owner = gitolite:nginx
socket_mode = 0770
@dreadwarrior
dreadwarrior / watch.sh
Last active August 29, 2015 14:10 — forked from mikesmullin/watch.sh
#!/usr/bin/env bash
# script: watch
# author: Mike Smullin <mike@smullindesign.com>
# license: GPLv3
# description:
# watches the given path for changes
# and executes a given command when changes occur
# usage:
# watch <path> <cmd...>
#
@dreadwarrior
dreadwarrior / BaseController.php
Created January 18, 2012 13:43 — forked from naag/BaseController.php
Multiple argument validation in Extbase
<?php
class Tx_MyExt_Controller_BaseController extends Tx_Extbase_MVC_Controller_ActionController {
/**
* @see Tx_Extbase_MVC_Controller_ActionController::callActionMethod()
*/
protected function callActionMethod() {
$this->validateAll();
parent::callActionMethod();