This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include <iostream> | |
#include <functional> | |
class FunctionTester | |
{ | |
public: | |
FunctionTester(); | |
std::function<int(bool)> DoStuff(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{1..999} |> Seq.sumBy (fun n -> if n % 3 = 0 || n % 5 = 0 then n else 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let fibs = Seq.unfold( fun (a,b) -> Some( a + b, (b, a + b) ) ) (1,1) | |
let result = fibs |> Seq.takeWhile ( fun x -> x <= 4000000) | |
|> Seq.sumBy ( fun x -> if x % 2 = 0 then x else 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void ShouldBeStructurallyEqualTo<T, U>(this IEnumerable<T> actual, IEnumerable<U> expected) | |
{ | |
var actualList = actual.ToList(); | |
var expectedList = expected.ToList(); | |
actualList.Should().HaveCount(expectedList.Count()); | |
bool isArrayOfValueType = typeof (T).IsArray && typeof (T).GetElementType().IsValueType; | |
foreach (var pair in actualList.Zip(expectedList, Tuple.Create)) | |
{ | |
if (isArrayOfValueType) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed class Option<T> : IEquatable<Option<T>> | |
{ | |
private readonly T m_Value; | |
private static readonly Option<T> g_None = new Option<T>(); | |
private Option() { } | |
private Option(T value) | |
{ | |
m_Value = value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$psgit = @{ | |
'tb' = "git branch -r --no-color | | |
where { `$_ -match ' (?<fb>origin/(?<b>#1.+))' } | | |
% { git branch --set-upstream `$matches['b'] `$matches['fb'] }"; | |
} | |
Set-Alias git Wrap-Git | |
function Wrap-Git { | |
if (-not $psgit.ContainsKey($args[0])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let ReplaceElementAt index element sequence = | |
let beforeIndex = sequence |> Seq.take index | |
let atIndex = element |> Seq.singleton | |
let afterIndex = sequence |> Seq.skip (index + 1) | |
Seq.append beforeIndex <| Seq.append atIndex afterIndex | |
let ReplaceElementAt index element sequence = | |
let beforeIndex = sequence |> Seq.take index | |
let afterIndex = sequence |> Seq.skip (index + 1) | |
seq { yield! beforeIndex; yield element; yield! afterIndex } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh -L 12345:internal-remote-server:8081 -N username@publicfacing-remote-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
changedPackageFiles=$(git diff --cached --name-only | grep -i packages.config) | |
grepedCommitMessage=$(grep -i 'Update Packages' $1) | |
if [ -n "$changedPackageFiles" -a -z "$grepedCommitMessage" ] | |
then | |
echo "Aborting commit." | |
echo "Your changing the following packages.config files but you did not confirm this action:" | |
echo "$changedPackageFiles" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch -r --merged | where { $_ -match ' origin/(?<branch>ssb.+)' } | % { git push origin {:}$matches['branch'] } |
OlderNewer