Skip to content

Instantly share code, notes, and snippets.

View joshrobb's full-sized avatar

Josh Robb joshrobb

  • Auckland, New Zealand
View GitHub Profile
@joshrobb
joshrobb / BloatedController.cs
Created June 14, 2011 12:41 — forked from robashton/BloatedController.cs
Partially Refactored controller
public class ReducedController : Controller
{
private readonly IContainProducts productRepository;
private readonly ISearchForProducts productsIndex;
private readonly IContainCustomers customerRepository;
private readonly IShipProducts productShipper;
private readonly ICoordinateSales salesCatalog;
public ReducedController(
IContainProducts productRepository,
$('area').hover( function () {
var $target = $(this).attr('alt') + '-over';
$('#events-map').addClass($target);
},
function () {
$("#events-map").removeClass().addClass($target);
});
@joshrobb
joshrobb / sc-dl.js
Created March 7, 2012 02:10 — forked from pheuter/sc-dl.js
Bookmarklet that generates download link for a Soundcloud upload
(function(d) {
var dl = d.createElement('a');
dl.innerText = 'Download MP3';
dl.href = "http://media.soundcloud.com/stream/"+d.querySelector('#main-content-inner img[class=waveform]').src.match(/\.com\/(.+)\_/)[1];
dl.download = d.querySelector('em').innerText+".mp3";
d.querySelector('.primary').appendChild(dl);
dl.style.marginLeft = '10px';
dl.style.color = 'red';
dl.style.fontWeight = 700;
})(document);
@joshrobb
joshrobb / My.Types.ps1xml
Created May 3, 2012 03:13 — forked from bradwilson/My.Types.ps1xml
My profile.ps1 (and several related scripts)
<Types>
<Type>
<Name>System.String</Name>
<Members>
<ScriptProperty>
<Name>ToBase64</Name>
<GetScriptBlock>
[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($this))
</GetScriptBlock>
</ScriptProperty>
@joshrobb
joshrobb / My.Types.ps1xml
Created May 14, 2012 01:49 — forked from bradwilson/My.Types.ps1xml
My profile.ps1 (and several related scripts)
<Types>
<Type>
<Name>System.String</Name>
<Members>
<ScriptProperty>
<Name>ToBase64</Name>
<GetScriptBlock>
[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($this))
</GetScriptBlock>
</ScriptProperty>
$snapins = Get-PSSnapin -Registered
$snapins | Add-PSSnapin
Get-Module -ListAvailable | Import-Module
Get-PSSnapin | Format-Table -autosize PSVersion, Name
Get-Module | Format-Table -autosize ModuleType, Name
function ff ([string] $glob) { get-childitem -recurse -include $glob }
@joshrobb
joshrobb / example_stack.js
Created May 26, 2012 10:23 — forked from tritonrc/example_stack.js
Example Dreadnot stack with Rails 3.2 and Heroku
var async = require('async')
var git = require('util/git')
var misc = require('util/misc')
exports.get_deployedRevision = function(args, callback) {
git.revParse(this.config.program_creator_dir, 'HEAD', function(err, stdout) {
callback(null, stdout.replace(/^\s+|\s+$/g, ''))
})
}
@joshrobb
joshrobb / gist:3857792
Created October 9, 2012 10:14 — forked from thehunmonkgroup/node-app
Redhat init script for managing a NodeJS app via forever
#!/bin/sh
##
## Redhat / Linux / LSB
##
# chkconfig: 345 85 15
# description: Startup script for Express / Node.js application with the \
## forever module.
##
## A modification of https://gist.github.com/1339289
##
@joshrobb
joshrobb / gist:4223815
Created December 6, 2012 11:25 — forked from bradwilson/gist:4215933
.gitconfig
[user]
name = Brad Wilson
email = dotnetguy@gmail.com
[alias]
amend = commit --amend
bl = blame -w -M -C
br = branch
cat = cat-file -t
co = checkout
df = diff --word-diff
@joshrobb
joshrobb / iis-parse.config
Last active January 8, 2017 12:36
logstash config for parsing IIS maximal logging
#tested using http://grokdebug.herokuapp.com/
input {
tcp {
type => "iis"
port => 3333
}
}
filter {