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 / 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>
@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 / 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);
$('area').hover( function () {
var $target = $(this).attr('alt') + '-over';
$('#events-map').addClass($target);
},
function () {
$("#events-map").removeClass().addClass($target);
});
@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,
/*
Subject / EventLoopScheduler / CompositeDisposable are all from the Reactive Library for .Net 3.5.
Most of these classes are baked into .NET 4 AFAIK
*/
// Event loop and queue setup done in constructor
_sendQueue = new Subject<Action>();
var scheduler = new EventLoopScheduler( "EmailSender" );
var queueSubscription = _sendQueue.ObserveOn( scheduler ).Subscribe( action => action() );
_queueCleanup = new CompositeDisposable( queueSubscription, scheduler );
defaults write com.twitter.twitter-mac UserTimelineDerepeater -bool true
defaults write com.twitter.twitter-mac ScrollingMakesKeyAndOrdersFront -bool true
defaults write com.twitter.twitter-mac TypeAnywhereToTweet -bool true
defaults write com.twitter.twitter-mac HideInBackground -bool true
defaults write com.twitter.twitter-mac NormalComposeWindowLevel -bool false
defaults write com.twitter.twitter-mac ESCClosesComposeWindow -bool true
# How we store all time views across the entire system for http://gauge.es.
# All in one document that gets incremented using MongoDB $inc modifier in
# every track. The $inc increments t, year.t, year.month.t, year.month.day.t
# so we get to the day numbers. These are in EST, as we are in EST and these
# stats are just for us. :) Nothing amazing, but thought I would share.
#
# >> pp View.all_time
{
"_id" => "all_time",
"t" => 502352,
var Suteki = Suteki || {};
Suteki.new_eventBus = (function(){
var self = {};
var subscriptions = {};
var unsubscribeTokens = [];
var subscriptionPointers = [];
public abstract class Thing
{
}
public interface IMarker {}
public interface IUseful<T> : IMarker where T : Thing
{
T DoSomething();
}