Skip to content

Instantly share code, notes, and snippets.

View benmatselby's full-sized avatar

Ben Selby benmatselby

View GitHub Profile
@benmatselby
benmatselby / PhakeClass.php
Created December 31, 2010 11:27
Mocking of the __call function
<?php
class PhakeClass
{
public function __call($method, $args)
{
return '__call';
}
}
@benmatselby
benmatselby / xhprof-phpunit-config
Created March 28, 2011 18:52
Adding XHProf as a PHPUnit listener
<listeners>
<listener class="PHPUnit_Util_Log_XHProf" file="/usr/lib/php/PHPUnit/Util/Log/XHProf.php">
<arguments>
<array>
<element key="xhprofLibFile">
<string>/Users/ben/Sites/xhprof_lib/utils/xhprof_lib.php</string>
</element>
<element key="xhprofRunsFile">
<string>/Users/ben/Sites/xhprof_lib/utils/xhprof_runs.php</string>
</element>
@benmatselby
benmatselby / speed.php
Created April 19, 2011 02:44
Test to see which is quicker, explode or substring to find the last part of a php class name
<?php
// How many times to we want to iterate
$count = isset($argv[1]) ? $argv[1] : 1000;
// Which function are we wanting to test
if (isset($argv[2]) && in_array($argv[2], array('explodeVersion', 'substringVersion'))) {
$function = $argv[2];
} else {
$function = 'explodeVersion';
@benmatselby
benmatselby / DocBlox checkstyle
Created October 6, 2011 18:34
DocBlox checkstyle
<checkstyle version="1.3.0">
<file name="Some/File.php">
<error line="1" severity="error" message="Some kind of error" source="DocBlox.DocBlox.DocBlox"/>
<error line="2" severity="critical" message="Some kind of critical issue" source="DocBlox.DocBlox.DocBlox"/>
<error line="3" severity="notice" message="Some kind of notice" source="DocBlox.DocBlox.DocBlox"/>
<error line="4" severity="warning" message="Some kind of warning" source="DocBlox.DocBlox.DocBlox"/>
</file>
</checkstyle>
@benmatselby
benmatselby / Jenkins Plugins
Created June 2, 2014 10:13
Jenkins Plugins
Green Balls
Checkstyle
xUnit
HTML Publisher
Timestamper
AnsiColor
Cron Column
Build Monitor
@benmatselby
benmatselby / Setting hostname on a mac
Created June 2, 2014 10:15
Setting hostname on a mac
With all the machines I now use, and the fact I’m getting older and my memory is going, I needed to add hostname into my bash prompt for the first time, and came across a little issue on Apple’s Mac OS X Mountain Lion.
When I updated my PS1 setting I was getting:
```
(null):~
```
Not so good. I was also getting similar responses when I was running “hostname” on the command line.
@benmatselby
benmatselby / Installed Sublime Text Plugins
Last active October 14, 2023 20:11
Installed Sublime Text Plugins
**Currently used**
- Package Control (Turned on, now built into Sublime)
- Phpcs
- [Formatter](https://packagecontrol.io/packages/Formatter#configuration)
- [Markdown Edtiging](https://packagecontrol.io/packages/MarkdownEditing)
- [Python 3](https://packagecontrol.io/packages/Python%203)
- [python-back](https://packagecontrol.io/packages/python-black) - Can this be replaced with formatter?
- UnitTesting
@benmatselby
benmatselby / gist:3a5c44afab7be20a3b69
Last active August 29, 2015 14:23
Open terminal to a set of servers using apple script
on run argv
tell application "Terminal"
set profile to item 1 of argv
set platform to item 2 of argv
set serverCount to item 3 of argv
tell app "Terminal" to set current settings of first window to settings set profile
repeat with theIncrementValue from 1 to serverCount
@benmatselby
benmatselby / Cobra vscode debug config
Last active August 26, 2023 19:42
Cobra vscode debug config
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch file",
"type": "go",
"request": "launch",
@benmatselby
benmatselby / provider.tf
Last active April 11, 2021 10:41
Terraform GitHub Repo Admin
provider "github" {
token = var.github_token
owner = var.github_org
}