Skip to content

Instantly share code, notes, and snippets.

Avatar
🧑‍💻
Writing React applications

Ben Selby benmatselby

🧑‍💻
Writing React applications
View GitHub Profile
@benmatselby
benmatselby / provider.tf
Last active Apr 11, 2021
Terraform GitHub Repo Admin
View provider.tf
provider "github" {
token = var.github_token
owner = var.github_org
}
@benmatselby
benmatselby / Cobra vscode debug config
Last active Jan 4, 2021
Cobra vscode debug config
View 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 / gist:3a5c44afab7be20a3b69
Last active Aug 29, 2015
Open terminal to a set of servers using apple script
View gist:3a5c44afab7be20a3b69
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
View Installed Sublime Text Plugins
Package Control - The one plugin to rule them all. This Plugin helps you install all of the plugins mentioned below and is the goto place for Sublime Text 2 Plugins
Phpcs - PHP_CodeSniffer and php -l integration. More details can be found here
phpDocumentor - Generate documentation using phpdoc from within the editor. More details can be found here
Pman – Access to the php manual from within Sublime Text. More details can be found here
Jenkins Dashboard – Pull back Jenkins Dashboard data
DocBlockr - Helps to write Doc Block based comments above and beyond what the editor provides
Git - Excellent Git Plugin for Sublime Text 2, supports many of the features you use daily
Sublime Github – Nice Github integration, mainly used for gist integration
Side Bar Enhancements - Enhances the sidebar of Sublime Text 2
XML Indent – Does what it says
View 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.
View Jenkins Plugins
Green Balls
Checkstyle
xUnit
HTML Publisher
Timestamper
AnsiColor
Cron Column
Build Monitor
View 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 / speed.php
Created Apr 19, 2011
Test to see which is quicker, explode or substring to find the last part of a php class name
View speed.php
<?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 / xhprof-phpunit-config
Created Mar 28, 2011
Adding XHProf as a PHPUnit listener
View xhprof-phpunit-config
<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 / PhakeClass.php
Created Dec 31, 2010
Mocking of the __call function
View PhakeClass.php
<?php
class PhakeClass
{
public function __call($method, $args)
{
return '__call';
}
}