Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 ?
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())
};
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
{