Skip to content

Instantly share code, notes, and snippets.

View dtryon's full-sized avatar

Davin Tryon dtryon

View GitHub Profile
@dtryon
dtryon / gist:1911166
Created February 25, 2012 22:21
first crack at a module in node.js
var DateFormatter = {
format: function(d) {
var d_date = d.getDate();
var d_month = d.getMonth();
d_month++;
var d_year = d.getFullYear();
var a_p = '';
var d_hour = d.getHours();
@dtryon
dtryon / gist:1911175
Created February 25, 2012 22:24
better date formatter module
exports.format = function (d) {
var d_date = d.getDate();
var d_month = d.getMonth();
d_month++;
var d_year = d.getFullYear();
var a_p = '';
var d_hour = d.getHours();
if (d_hour < 12)
@dtryon
dtryon / gist:1911183
Created February 25, 2012 22:26
use dateFormatter module
var dateFormatter = require('../utilities/dateFormatter.js');
app.get('/page', function(req, res){
var d = new Date();
console.log(dateFormatter.format(d));
// prints out 25/2/2012 1:06 AM
...
@dtryon
dtryon / gist:1940063
Created February 29, 2012 11:11
Config for WCF activiy and message logging
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information,ActivityTracing"
propagateActivity="true">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging">
@dtryon
dtryon / gist:2067179
Created March 18, 2012 00:49
first nodeunit test
var target = require('../modules/dateFormatter');
exports.dateShouldPrintCorrectly = function(test){
// given
var date = new Date('25 Dec, 1995 23:15:00');
// when
var result = target.format(date);
// then
@dtryon
dtryon / gist:2067231
Created March 18, 2012 00:55
nodeunit output
dateFormatterTest
✔ dateShouldPrintCorrectly
OK: 1 assertions (9ms)
jumble@jumble-Inspiron-600m:~/Documents/Dev/Node/Projects/clog/src$
@dtryon
dtryon / gist:2244284
Created March 29, 2012 22:14
Simple event
using System;
public class OnLoadTest
{
static void Main()
{
Page page = new Page();
//Wire up the event delegate
page.Load += new Page.OnLoadHandler(MyHandler);
@dtryon
dtryon / gist:2244355
Created March 29, 2012 22:23
Simple action event
using System;
public class OnLoadTest
{
static void Main()
{
Page page = new Page();
//Wire up the event delegate
page.Load += new Action<object, EventArgs>(MyHandler);
@dtryon
dtryon / gist:2350610
Created April 10, 2012 11:20
NSB publish
public interface IDidSomething
{
int UserID { get; set; }
DateTime EventDate { get; set; }
}
public class Publisher
{
public IBus Bus { get; set; }
@dtryon
dtryon / gist:2350649
Created April 10, 2012 11:26
Simple IBus with Action<T>
public interface IBus
{
void Publish<T>(Action<T> action);
}