Skip to content

Instantly share code, notes, and snippets.

@mikeobrien
mikeobrien / gist:1411789
Created November 30, 2011 23:19
Dynamically creating rake tasks
# Function to create a parent and children tasks
def tasks(parent, children, &task)
task parent => children.keys
children.each do |key, value|
task.call key, value
end
end
# Create assembly info tasks for all projects
@mikeobrien
mikeobrien / Output
Created December 2, 2011 02:07
Parallelizing rake tasks
start task1 2011-12-01 20:59:43 -0500
start task2 2011-12-01 20:59:43 -0500
start task3 2011-12-01 20:59:43 -0500
end task2 2011-12-01 20:59:45 -0500
end task1 2011-12-01 20:59:45 -0500
end task3 2011-12-01 20:59:45 -0500
Completed parallel execution of tasks 1 through 3.
@mikeobrien
mikeobrien / Subject
Created December 10, 2011 02:40
Build duration in TeamCity email notification subject
Gribble CI v1.3.45.0 Succeeded (3:15)
@mikeobrien
mikeobrien / ChannelHandler.cs
Created December 13, 2011 02:03
System.ServiceModel.Dispatcher
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Dispatcher
{
using System;
using System.Diagnostics;
using System.ServiceModel;
using System.ServiceModel.Description;
@mikeobrien
mikeobrien / gist:1666841
Created January 24, 2012 00:19
Raw HID communication with Phidget 888 interface & temp sensor
using System;
using System.Collections.Generic;
using System.Linq;
using HidLibrary;
namespace Temperature
{
public class Program
{
static void Main()
@mikeobrien
mikeobrien / amd-modules.js
Created February 2, 2012 20:05
Making testing of amd modules easier...
window.define = function() {
var amd = window.amd = window.amd || {};
var scripts = document.getElementsByTagName("script");
var baseUrl;
if (!amd.modules) {
for (var i = 0; i < scripts.length; i++) {
var dataMain = scripts[i].getAttribute('data-base');
if (dataMain) {
var a = document.createElement('a');
a.href = dataMain;
@mikeobrien
mikeobrien / Registry.cs
Created February 15, 2012 03:40
Blowin up the asset pipeline yo!
Assets.Alias("jquery").Is("scripts/jquery/jquery-1.7.1.min.js")
.Alias("underscore").Is("scripts/underscore/underscore-min.js")
.Alias("backbone").Is("scripts/backbone/backbone-min.js")
.AssetSet("default").Is("jquery,underscore,backbone");
@mikeobrien
mikeobrien / Conventions.cs
Created February 17, 2012 16:41
RESTful exception handling
public class Conventions : FubuRegistry
{
public Conventions()
{
// ...
Policies.ConditionallyWrapBehaviorChainsWith<HandledExceptionBehavior>(x => x.BehaviorChain.Last() is JsonSerializer);
// ...
}
}
@mikeobrien
mikeobrien / main.js
Created February 18, 2012 01:50
Bootstrapping data with require.js
require(['data', 'app'], function(data, app) {
return app.start(data);
});
@mikeobrien
mikeobrien / gist:1857212
Created February 18, 2012 03:31
Enabling AMD support for underscore and backbone
define 'underscore', ['path/to/underscore.js'], -> _
define 'backbone', ['underscore', 'jquery', 'order!path/to/backbone.js'], -> Backbone