Skip to content

Instantly share code, notes, and snippets.

View benrowe's full-sized avatar
😀
building things!

Ben Rowe benrowe

😀
building things!
View GitHub Profile
@benrowe
benrowe / Brewfile
Last active November 19, 2018 22:41
tap "eugenmayer/dockersync"
tap "go-delve/delve"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/core"
tap "homebrew/dupes"
tap "homebrew/php"
tap "homebrew/versions"
cask "java"
brew "awscli"
@benrowe
benrowe / TestConstructorCallsMethod
Created May 17, 2018 06:41
PHPUnit Test Examples
public function testConstructorCallsMethod()
{
$callMethod = 'init'
$mock = $this
->getMockBuilder(ClassToTest::class)
->disableOriginalConstructor()
->getMock();
$mock
->expects($this->once())
@benrowe
benrowe / Makefile
Last active June 16, 2020 01:55 — forked from prwhite/Makefile
Add a help target to a Makefile that will allow all targets to be self documenting
.PHONY: help
# COLORS
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
TARGET_MAX_CHAR_NUM=20
@benrowe
benrowe / .aliases
Last active July 10, 2023 03:26
Local machine config
alias dk_restart="osascript -e 'quit app \"Docker\"' && open -a Docker"
alias dkps="docker ps --format '{{.ID}} - {{.Names}} - {{.Status}} - {{.Image}}'"
alias dk="docker"
alias dkl="docker logs"
alias dklf="docker logs -f"
alias dki="docker images"
alias dks="docker service"
alias dkrm="docker rm"
alias dkrmi="docker rmi"
@benrowe
benrowe / .hyper.js
Last active October 27, 2017 04:15
Hyper Terminal Sync Settings
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',
@benrowe
benrowe / git-find-parent-branch.sh
Last active October 16, 2017 02:39
Based on the currently checked out branch, find where it branched from
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'
@benrowe
benrowe / readme.md
Last active February 27, 2018 00:33
composer and php 7 on unraid via docker

Install composer

  1. sudo nano /usr/local/bin/composer
  2. Add
    #!/bin/sh
    export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
    echo "Current working directory: '"$(pwd)"'"
    docker run --rm -v $(pwd):/app -v ~/.ssh:/root/.ssh composer/composer $@
    
  3. chmod +x /usr/local/bin/composer
@benrowe
benrowe / common.sh
Created February 9, 2016 23:08
common bash functionality for echo'ing
#!/bin/bash
# text colours
text_error='\033[0;31m'
text_success='\033[0;32m'
text_warning='\033[0;33m'
text_info='\033[0;34m'
text_default='\033[0m'
function e() {
@benrowe
benrowe / htmlentities.js
Created December 10, 2015 22:03
htmlentities for javascript
function htmlEntities(value)
{
return value.
replace(/&/g, '&').
replace(/</g, '&lt;').
replace(/>/g, '&gt;').
replace(/"/g, '&quot;');
}
@benrowe
benrowe / NullIfEmptyTrait.php
Created December 1, 2015 05:16
NullIfEmptyTrait for Laravel models
<?php
/**
* @author Ben Rowe <[email protected]>
*/
namespace App\Models;
/**
* Defines a list of model attributes that need to be handled as null fields