Skip to content

Instantly share code, notes, and snippets.

using System;
using Library;
using System.Reflection;
using System.Runtime.Remoting.Proxies;
using System.Runtime.Remoting.Services;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Activation;
namespace Library
{
var spec = from sut in SpecificationExpression.Begin(() => new Stack<int>())
where sut.Push(element)
select new Observations()
{
() => Assert.NotEmpty(sut),
() => Assert.Equal(element, sut.Peek())
};
@JohannesRudolph
JohannesRudolph / BoundedWildcards.java
Created March 25, 2011 08:12
A simple example showing common usage scenarios of bounded wildcards in java
class Vehicle {}
class Car extends Vehicle {}
class Porsche extends Car {}
public void foo(List<? extends Car> extendsCar , List<? super Car> superOfCar, List<Car> cars) {
Vehicle V = new Vehicle();
Car C = new Car();
Porsche P = new Porsche();
// [] specifies the range of valid types for ?
@JohannesRudolph
JohannesRudolph / TeamCityAdapter.m
Created May 27, 2011 08:53
TeamCity Adapter for SenTestingKit/OCUnit
//
// TeamCityAdadpter.m
// Created by Johannes Rudolph on 27.05.11.
// Use of this source code is governed by the following license:
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// (1) Redistributions of source code must retain the above copyright notice,
@JohannesRudolph
JohannesRudolph / MethodStatics.cs
Created June 26, 2011 13:30
Caller-dependent method level local statics implementation in C#
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace MethodStaticLocals
{
class ExpensiveObject
@JohannesRudolph
JohannesRudolph / TestflihtappDeployTeamcity.sh
Created January 26, 2012 22:04
Builds and deploys an App to testflightapp.com. Integrates with Teamcity.
#!/bin/bash
#
# testflightapp.com tokens
API_TOKEN="YOUR_API_TOKEN"
TEAM_TOKEN="YOUR_TEAM_TOKEN"
PRODUCT_NAME="RowMotion"
ARTEFACTS="$PWD/Artefacts"
@JohannesRudolph
JohannesRudolph / gist:4193650
Created December 3, 2012 08:30
F# Cond Zip
open System.Linq
let a = [0; 5; 10]
let b = [0 .. 10]
// enumerates left and yields element pairs combined by consuming right until 'consume' is false or either sequence is exhausted
let condZip (left:seq<'a>) (right:seq<'b>) consume project =
seq {
use en = right.GetEnumerator()
let hadNext = ref(en.MoveNext())
@JohannesRudolph
JohannesRudolph / Demo.cs
Created December 20, 2012 17:39
Simple spec. A minimalisitic specification framework for xunit.net. MS-PL License.
using SimpleSpec;
using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
namespace SimpleSpec.Tests
{
public class Demo
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using System.IO.Compression;
#!/bin/sh
# Launch application using ios-sim and set up environment to inject test bundle into application
# Source: http://stackoverflow.com/a/12682617/504494
if [ "$RUN_APPLICATION_TESTS_WITH_IOS_SIM" = "YES" ]; then
test_bundle_path="$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.$WRAPPER_EXTENSION"
environment_args="--setenv DYLD_INSERT_LIBRARIES=/../../Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection --setenv XCInjectBundle=$test_bundle_path --setenv XCInjectBundleInto=\"$TEST_HOST\""
testhost_dir=$(dirname "$TEST_HOST")