Skip to content

Instantly share code, notes, and snippets.

View joshrobb's full-sized avatar

Josh Robb joshrobb

  • Auckland, New Zealand
View GitHub Profile
using System;
using ExtensionMethods;
namespace Events
{
public static class DomainEvents
{
private static IEventHandlerResolver _handlerResolver;
public static bool IsInitialised()
using System;
using System.Web.Mvc;
using V2.Domain.Services;
using V2.Domain.Services.Messages;
using MvcContrib.Attributes;
using System.Linq;
namespace V2.Web.Controllers
{
public class RegistrationController : ControllerBase
using System;
using ExtensionMethods;
namespace Events
{
public static class DomainEvents
{
private static IEventHandlerResolver _handlerResolver;
public static bool IsInitialised()
public abstract class Thing
{
}
public interface IMarker {}
public interface IUseful<T> : IMarker where T : Thing
{
T DoSomething();
}
var Suteki = Suteki || {};
Suteki.new_eventBus = (function(){
var self = {};
var subscriptions = {};
var unsubscribeTokens = [];
var subscriptionPointers = [];
# 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,
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
/*
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 );
@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,
@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);