Skip to content

Instantly share code, notes, and snippets.

import {Component, bootstrap, Input, View} from 'angular2/angular2';
@Component({
selector: 'hello-message',
inputs: ['message'],
template: 'Hello, {{message}}'
})
class HelloMessage {
@Input() message: string;
}
import {Component, bootstrap} from 'angular2/angular2';
@Component({
selector: 'my-app',
template: '<h1>Hello World</h1>'
})
class AppComponent { }
bootstrap(AppComponent);
@Haemoglobin
Haemoglobin / SwitchDisposable.cs
Created October 27, 2012 10:43
Switch Disposable
[Test]
public void Switch_should_dispose_old_subscriptions()
{
//ARRANGE
var disposed = new List<int>();
var switchedObservable = Observable.Range(1, 2)
.Select(i => Observable.Create<Unit>(o => Disposable.Create(() => disposed.Add(i))))
.Switch();
//ACT
@Haemoglobin
Haemoglobin / gist:3111542
Created July 14, 2012 14:12
Resiliant Acceptance Test Automation Assertions
private T FindWithRetry<T>(Func<T> find, string description) where T : class
{
int numWaits = 0;
Console.WriteLine("Searching for " + description);
while(numWaits < 200)
{
T result = find();
@Haemoglobin
Haemoglobin / add-source-headers.ps1
Created March 26, 2012 14:32
Add Source File Headers
#requires -version 2
<# #>
param(
[Parameter(Mandatory = $true)]
[string] $sourceRoot,
[Parameter(Mandatory = $true)]
[string] $versionNumber
)