Skip to content

Instantly share code, notes, and snippets.

View andrewabest's full-sized avatar

Andrew Best andrewabest

View GitHub Profile
@andrewabest
andrewabest / SubmissionOne.md
Last active August 29, 2015 14:07
DDD Brisbane 2014 Submissions

X-ray Goggles

Abstract

Are you a product owner? Do you have a product out in the wild, but can't answer who is using what features? Are you a developer? Are you currently developing a product but can't tell your product owner or boss which bugs are occurring out in the wild most frequently? Do you dabble in support? Can you provide the development team with deep information regarding defects your customers are screaming at you about? When someone says to you 'it's slow', and you of course respond with 'which part?' and the unquenchable fountain of insight that is your product owner / tester / end user says 'the whole thing' - do you have any data you can point to?

You need to know what is going on in your products from day one, and finding out shouldn't involve pushing out new builds to add more Trace.WriteLines / StopWatch.StartNews or logging onto various azure cloud service instances to pore over text log files. Lets take a look at some of the tooling and services available to us today and build a

@andrewabest
andrewabest / AppendFileHash.cs
Created December 16, 2014 04:25
Cache Busting in MVC local
public class AppendFileHash : IBundleTransform
{
public void Process(BundleContext context, BundleResponse response)
{
foreach (var file in response.Files)
{
using (var fs = File.OpenRead(HostingEnvironment.MapPath(file.IncludedVirtualPath)))
{
var hash = new SHA256Managed().ComputeHash(fs);
var version = HttpServerUtility.UrlTokenEncode(hash);
@andrewabest
andrewabest / gource.bat
Created December 18, 2014 23:36
Gource
// 3s/day
c:\temp\gource\gource.exe -o out.ppm -r 25 -s 3 -a 1 --colour-images --hide filenames
c:\temp\ffmpeg\bin\ffmpeg -y -b 3000K -r 60 -f image2pipe -vcodec ppm -i out.ppm -vcodec libx264 -threads 0 gource..avi -fpre "c:\temp\ffmpeg\presets\libvpx-720p.ffpreset"
// Fast 1s/day
c:\temp\gource\gource.exe -o out.fast.ppm -r 25 -s 1 -a 1 --colour-images --hide filenames --font-size 6
c:\temp\ffmpeg\bin\ffmpeg -y -b 3000K -r 60 -f image2pipe -vcodec ppm -i out.fast.ppm -vcodec libx264 -threads 0 gource.fast.avi -fpre "c:\temp\ffmpeg\presets\libvpx-720p.ffpreset"
@andrewabest
andrewabest / WebStream.cs
Created February 7, 2015 04:10
Example Proxy Handling from ServiceBus
// Generated by .NET Reflector from C:\projects\nextgen\packages\WindowsAzure.ServiceBus.2.1.4.0\lib\net40-full\Microsoft.ServiceBus.dll
namespace Microsoft.ServiceBus
{
using Microsoft.ServiceBus.Common;
using Microsoft.ServiceBus.Tracing;
using System;
using System.Globalization;
using System.IO;
using System.Net;
using System.Net.Cache;
http://www.infoq.com/articles/Continuous-Delivery-Maturity-Model
@andrewabest
andrewabest / SevenYearItch.md
Last active August 29, 2015 14:16
The abstract and basic outline of my March BDN meetup presentation.

The Seven Year Itch

Abstract

In this session Andrew will refactor an existing Angular web application to React, and then measure the outcomes to validate whether React is a viable alternative to Angular.

With Angular nearing its seventh year of life and approaching obselecense, is it time we entertain the idea of seeing new front-end frameworks? Andrew's inspiration for this framework promiscuity came from a conversation he had with colleagues one day around getting Angular to perform a particular task. The outcome of the particular conversation was much introspection as to why we put ourselves through such pain when developing software - so as any good developer does, Andrew is going to see what we can do to make the pain go away.

@andrewabest
andrewabest / Conventions.cs
Last active August 29, 2015 14:19
No Comments Convention Test
public class Conventions
{
private readonly string[] _permittedCommentDelimiters = {"Note", "Todo"};
private readonly string[] _exceptions = { "AssemblyInfo.cs" };
private const string UrlPattern = @"https?:\/\/([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?";
private const string CommentPattern = @"(?!{0}|(?=\/\/ ReSharper))((?<urldudes>" + UrlPattern + @")|(?<cooldudes>\/\/\/)|(?<badguys>\/\/.+))";
[Test]
public void CodebaseMustOnlyContainInformativeComments()
@andrewabest
andrewabest / Elevate.bat
Last active August 29, 2015 14:19
Elevate Batch File
:::::::::::::::::::::::::::::::::::::::::
:: Automatically check & get admin rights
:: Mostly stolen from http://stackoverflow.com/a/12264592/899705
:::::::::::::::::::::::::::::::::::::::::
@echo off
CLS
ECHO.
ECHO =============================
ECHO Running Admin shell
ECHO =============================
@andrewabest
andrewabest / Remedy.md
Created May 25, 2015 03:07
The type "System.Object" is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0....

If you run into an issue where after installing Serilog (or other PCL assembly) you get "The type "System.Object" is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0....."

You need to install either:

  • If you have a .net 4.5 project, the Win 8 SDK.
  • If you have a .net 4.5.1 project, the .net 4.5.1 Developer pack.
  • If you have a .net 4.5.2 project, the .net 4.5.2 Developer pack.

If you install the 4.5.2 pack, it still will not fix the issue if you have a 4.5 project. You'll need to also install the Win 8 SDK. Not sure about 4.5.1 in this case.

@andrewabest
andrewabest / cors.md
Last active August 29, 2015 14:22
CORS

Same-Origin Policy

Each browser has it's own Same-Origin policy (https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy) that it enforces to avoid certain types of CSRF attacks.

If a browser's SOP is triggered when attempting to send a request, it will either refuse to send the request*, or trigger an OPTIONS request to be sent, which the server must respond to with a list of Access-Control headers (http://www.w3.org/TR/cors/#syntax). The browser can then inspect these to determine whether it is good to go ahead and send the request or not.

IE Gotchas