Skip to content

Instantly share code, notes, and snippets.

View AlexZeitler's full-sized avatar
👷‍♂️
Building stuff

Alexander Zeitler AlexZeitler

👷‍♂️
Building stuff
View GitHub Profile
@AlexZeitler
AlexZeitler / Startup.cs
Last active August 29, 2015 14:21
ASP.NET 5 (DNX) beta 4 perf tests (ASP.NET 5 is not performance optimized yet in any way!)
using System.Linq;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Mvc;
using Microsoft.Framework.DependencyInjection;
using Newtonsoft.Json.Serialization;
namespace MyNamespace.Controllers
{
@AlexZeitler
AlexZeitler / spec.js
Created May 25, 2015 17:58
$httpBackend + promise
describe('when getting configuration from backend', function () {
beforeEach(inject(function ($injector) {
$httpBackend = $injector.get("$httpBackend");
$httpBackend.expect("GET", "/api/config")
.respond(200, configMock);
}));
afterEach(function () {
@AlexZeitler
AlexZeitler / mbpusbbackup.txt
Last active August 31, 2015 19:28
Backup MacBook Pro to USB-Stick in Single User mode
Create a hfs+ usb stick on Ubuntu:
sudo apt-get install hfsprogs
sudo apt-get install gparted
using gparted, create a partition table and a partition, format the partition table to hfs+
Boot the MBP to Single User Mode using ⌘+S key on power on
When booted:
/sbin/fsck -fy
/sbin/mount -uw /
@AlexZeitler
AlexZeitler / ideas for grouping BDD items using VsCommands
Created June 29, 2010 14:01
my thoughts on grouping #bdd items using #vscommands - any other ideas?
Bar.cs
+-BarSpecs.cs
Foo.cs
+- FooSpecs.cs
vs.
Bar.cs
BarSpecs.cs (with common Bar related IBehaviorConfigs)
+- when_bar_has_this.cs
C:\Users\AZeitler\Desktop\xunitbddextensions>powershell -Command "& {Import-Modu
le .\psake.psm1; Invoke-psake .\default.ps1}"
Executing task: Clean
Executing task: Init
fatal: Not a git repository (or any of the parent directories): .git
default.ps1:You cannot call a method on a null-valued expression.
C:\Users\AZeitler\Desktop\xunitbddextensions>Pause
Press any key to continue . . .
// Concern
protected override void Because() {
_actualDependencyModel = Sut.Resolve(); // "root" of AssemblyHasTwoPartDependencies / EstablishContext should be passed to Resolve
}
// Dependency
public class AssemblyHasTwoPartDependencies : IBehaviorConfig {
public void EstablishContext(IDependencyAccessor accessor) {
IConfiguration activeRootConfiguration = accessor.An<IConfiguration>();
@AlexZeitler
AlexZeitler / gist:4894f93c935c0f7c1495
Last active September 7, 2015 22:37 — forked from kagemusha/gist:5866759
Using Debugger with Grunt
version: grunt-cli v0.1.8
1. Install node-inspector globally (-g)
npm install -g node-inspector
2. Add debugger statements to your code
3. Run your grunt task in debug mode
VBoxManage modifyvm "default" --natpf1 "postgres,tcp,127.0.0.1,5432,,5432"
@AlexZeitler
AlexZeitler / gist:b8f0debac6bead7fda18
Last active September 18, 2015 11:09 — forked from benfoster/gist:4416655
A lightweight message bus using TPL DataFlow
using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
namespace TDFDemo
{
class Program
{
@AlexZeitler
AlexZeitler / gist:076810d466fe44b5efe8
Last active September 19, 2015 15:58 — forked from six8/gist:1732686
Javascript dependency graph resolution
// Dependency resolution, adapted from https://gist.github.com/1232505/f16308bc14966c8d003c2686b1c258ec41303c1f
function resolve(graph) {
var sorted = [], // sorted list of IDs ( returned value )
visited = {}; // hash: id of already visited node => true
// 2. topological sort
Object.keys(graph).forEach(function visit(name, ancestors) {
if (!Array.isArray(ancestors)) ancestors = [];
ancestors.push(name);
visited[name] = true;