Skip to content

Instantly share code, notes, and snippets.

View robashton's full-sized avatar
🍻
drinking

His Excellence Sir Professional of Rob upon Ashtonburyshirester robashton

🍻
drinking
View GitHub Profile
@robashton
robashton / BloatedController.cs
Created June 13, 2011 16:32
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,
@robashton
robashton / blah.js
Created June 17, 2011 09:56
Example
System.Windows.Application.prototype._ctor$1 = function (nativeTypeIndex) {
System.Object.prototype._ctor.call(this);
System.Windows.Application._current = this;
var intPtr = System.IntPtr.Zero;
intPtr = $asm02.MS.Internal.XcpImports.CreateObjectByTypeIndex(nativeTypeIndex);
this.m_nativePtr = new $asm02.MS.Internal.NativeObjectSafeHandle();
this.m_nativePtr.NativeObject = intPtr;
$asm02.MS.Internal.ManagedPeerTable.Add$0(intPtr, this);
this._coreTypeEventHelper = new $asm02.MS.Internal.CoreTypeEventHelper();
var type = (JSIL.GetType(this));
[TestFixture]
public class When_the_selection_manager_has_its_search_results_updated
{
private FakeSearchService searchService;
private SelectionManager selectionManager;
[TestFixtureSetUp]
public void ArrangeAndAct()
{
searchService = new FakeSearchService()
@robashton
robashton / test.cs
Created August 4, 2011 13:04
Contrived example test for ronan
[TestFixture]
public class When_a_user_submits_a_form
{
[Test]
public void An_email_is_sent_to_his_boss()
{
var form = new FormBuilder()
.WhichFullyValidates()
.ForUser(DefaultUser)
.Build();
@robashton
robashton / test.cs
Created August 4, 2011 13:13
Re-work of the contrived example, too hurried
[TestFixture]
public class When_a_user_submits_a_form
{
[Test]
public void An_email_is_sent_to_his_boss()
{
var form = new FormBuilder()
.WhichFullyValidates()
.ForUser(DefaultUser)
.Build();
@robashton
robashton / cqrs.txt
Created September 27, 2011 11:37
CQRS is not complicated
CQRS is not complicated - complex architectures are complicated, and they're complicated because we make them complicated
-------------------
CQRS is not a complicated architecture, CQRS just means maintaining a healthy division of responsibilities between reads and writes across your system - that is, having the reads in your system executed in a thin clean manner appropriate to the views you want to retrieve, and your writes going through all the crazy logic you need such as validation, updating queues, third party systems, processing business rules - whatever.
CQRS can be achieved by using a document database like Raven or Couch - using your documents as a write store, using your indexes as a query store. It can be achieved with your favourite ORM (Even better if you can actually use that O and that M and get some good old OO going) - if you want to use your objects for encapsulating business logic and go directly to the the queries to project the data you need for views (HQL, SQL directly, SPROCS, whate
@robashton
robashton / coffeescience.coffee
Created October 13, 2011 09:14
An aeroplane induced science project
new QueryBuilder()
.Where(blog -> blog.Author == "Rob")
.Select(blog -> {
Title: blog.Title,
Content: blog.Content
})
.GetQuery()
@robashton
robashton / The game
Created December 11, 2011 03:02
game.js
var engine = new EngineBuilder('colour')
.nearestPoint(8.0)
.sceneWidth(640)
.sceneHeight(480)
.backgroundColour(10, 10, 150)
.build();
var world = engine.world();
var scene = new Scene(world);
while true ;
do
scrot '%s.png' -e 'mv $f ~/files/elapse/input'
sleep 10
done
while true ;
do
scrot '%s.png' -e 'mv $f ~/files/elapse/input'
sleep 10
done