Skip to content

Instantly share code, notes, and snippets.

View phatboyg's full-sized avatar

Chris Patterson phatboyg

View GitHub Profile
@phatboyg
phatboyg / ActorBehaviorExample.cs
Created November 28, 2011 22:59
Example of applying behavior to an actor
class Cleaner_version_of_defining_actor_behavior
{
public void Some_method_in_your_code()
{
// create the actor instance, passing the state and an initializer
// in this case, applying the initial behavior of to the actor
ActorRef agent = Actor.New<MyState>(x => x.Apply<DefaultBehavior>());
// now messages can be sent to the actor to make it do things
// we will use a stateless actor for that interaction
@phatboyg
phatboyg / Program.cs
Created February 23, 2012 22:45
Working Both Handler and Consumer
namespace ConsoleApplication12
{
using System;
using MassTransit;
class Program
{
static void Main(string[] args)
{
Bus.Initialize(sbc =>
@phatboyg
phatboyg / MyExample.java
Created March 27, 2012 03:20
Using Java Executors for scheduling timeouts on operations
import java.util.concurrent.*;
class MyCallable implements Callable<Integer>
{
int limit;
public MyCallable(int limit)
{
this.limit = limit;
}
@phatboyg
phatboyg / mac.gitconfig
Created April 13, 2012 14:08
Git Configuration
[user]
name = Chris Patterson
email = chris@phatboyg.com
[core]
autocrlf = false
[alias]
ci = commit
undo = reset --hard
up = pull origin master
@phatboyg
phatboyg / notes.txt
Created April 13, 2012 15:27
Git Usage
git fetch origin
git checkout develop
git rebase origin/develop
-- this pulls any commits from the server (origin) to my local repository
-- checks out (switches to...) my local develop branch
-- aligns my develop branch to the origin/develop branch (cleans up history)
If I had an existin feature branch...
@phatboyg
phatboyg / DoublePumped_Specs.cs
Created April 18, 2012 03:41
Not the greatest way to put two state machines on the same state
// Copyright 2011 Chris Patterson, Dru Sellers
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
@phatboyg
phatboyg / First.cs
Created July 6, 2012 18:46
SignalR MT Integration Post
public class Location :
Hub
{
public Task GetLocation(string truckId)
{
Task task = null;
Bus.Instance.PublishRequestAsync(new GetLocation { TruckId = truckId }, x =>
{
task = x.Handle(message => {});
x.SetTimeout(30.Seconds());
@phatboyg
phatboyg / AppendText.cs
Created July 18, 2012 15:54
Benchmarque Blog Post Code
public interface AppendText
{
string Append(params string[] args);
}
@phatboyg
phatboyg / PhatBoyG-FontsAndColors.vssettings
Created July 25, 2012 18:52
Visual Studio 2010 Color Schema (w/R# settings)
<UserSettings>
<ApplicationIdentity version="10.0"/>
<ToolsOptions>
<ToolsOptionsCategory name="Environment" RegisteredName="Environment"/>
</ToolsOptions>
<Category name="Database Tools" RegisteredName="Database Tools"/>
<Category name="Environment_Group" RegisteredName="Environment_Group">
<Category name="Environment_FontsAndColors" Category="{1EDA5DD4-927A-43a7-810E-7FD247D0DA1D}" Package="{DA9FB551-C724-11d0-AE1F-00A0C90FFFC3}" RegisteredName="Environment_FontsAndColors" PackageName="Visual Studio Environment Package">
<PropertyValue name="Version">2</PropertyValue>
<FontsAndColors Version="2.0">
@phatboyg
phatboyg / IProxyAsyncResult.cs
Created July 26, 2012 23:11
Method Async Proxy
using System;
public interface IProxyAsyncResult<T> :
IAsyncResult
{
T Result { get; }
}