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
/// <summary> | |
/// partial implementation of Railway oriented Programming in C#. | |
/// based on: https://www.slideshare.net/ScottWlaschin/railway-oriented-programming?ref=http://fsharpforfunandprofit.com/rop/ | |
/// Notification<T> is defined in https://github.com/mvbalaw/MvbaCore/blob/master/src/MvbaCore/Notification.cs | |
/// | |
/// Unfortunately I couldn't find very many functions in my code where this could even be applied. | |
/// Reasons include the function having multiple inputs, throwing an exception, triggering an async action, etc., | |
/// all of which would require additional growth in this infrastructure and at least in my opinion do not make | |
/// the code easier to understand, debug or maintain. | |
/// </summary> |
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
# File: genetic.py | |
# from chapter 1 of _Genetic Algorithms with Python_, an ebook | |
# available for purchase at http://leanpub.com/genetic_algorithms_with_python | |
# | |
# Author: Clinton Sheppard <[email protected]> | |
# Repository: https://drive.google.com/open?id=0B2tHXnhOFnVkRU95SC12alNkU2M | |
# Copyright (c) 2016 Clinton Sheppard | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"). |
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
[package] | |
name = "genetic" | |
version = "0.0.1" | |
authors = ["Clinton <[email protected]>"] | |
[dependencies] | |
rand = "*" | |
time = "*" | |
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
// for the problem description see: http://www.cnn.com/2015/04/15/living/feat-cheryl-birthday-math-problem-goes-viral/ | |
public class Birthday | |
{ | |
public Birthday(string monthName, int dayOfMonth) | |
{ | |
MonthName = monthName; | |
DayOfMonth = dayOfMonth; | |
} |
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
quadrangle: {X=231,Y=44} {X=56,Y=12} {X=171,Y=228} {X=15,Y=229} color: [A=145, R=202, G=163, B=140] | |
quadrangle: {X=0,Y=385} {X=60,Y=204} {X=189,Y=206} {X=384,Y=386} color: [A=239, R=16, G=0, B=25] | |
quadrangle: {X=3,Y=9} {X=0,Y=359} {X=399,Y=373} {X=399,Y=104} color: [A=206, R=132, G=87, B=65] | |
quadrangle: {X=3,Y=359} {X=9,Y=226} {X=392,Y=135} {X=331,Y=371} color: [A=218, R=64, G=30, B=63] | |
quadrangle: {X=78,Y=174} {X=82,Y=377} {X=401,Y=379} {X=400,Y=169} color: [A=122, R=24, G=64, B=30] | |
quadrangle: {X=392,Y=3} {X=397,Y=231} {X=375,Y=178} {X=33,Y=17} color: [A=80, R=239, G=203, B=119] | |
quadrangle: {X=400,Y=4} {X=400,Y=181} {X=251,Y=160} {X=122,Y=6} color: [A=224, R=252, G=225, B=180] | |
quadrangle: {X=301,Y=2} {X=397,Y=172} {X=240,Y=161} {X=173,Y=56} color: [A=138, R=253, G=246, B=203] | |
quadrangle: {X=181,Y=7} {X=157,Y=235} {X=176,Y=268} {X=197,Y=277} color: [A=8, R=47, G=47, B=36] | |
quadrangle: {X=367,Y=374} {X=326,Y=128} {X=234,Y=236} {X=224,Y=369} color: [A=174, R=29, G=4, B=38] |
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
// this breaker was used on @scichelli's | |
// collection comparer | |
// https://gist.github.com/3836918/ | |
[Test] | |
public void Breaker() | |
{ | |
var legal = GetIntLegals(); | |
for (int i = 0; i < 1000000; i++) | |
{ |
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
// * ********************************************************************************** | |
// * Copyright (c) Clinton Sheppard | |
// * This source code is subject to terms and conditions of the MIT License. | |
// * By using this source code in any fashion, you are agreeing to be bound by | |
// * the terms of the MIT License. | |
// * You must not remove this notice from this software. | |
// * ********************************************************************************** | |
using System; | |
using System.Collections.Generic; |
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
// * ************************************************************************** | |
// * Copyright (c) McCreary, Veselka, Bragg & Allen, P.C. | |
// * This source code is subject to terms and conditions of the MIT License. | |
// * By using this source code in any fashion, you are agreeing to be bound by | |
// * the terms of the MIT License. | |
// * You must not remove this notice from this software. | |
// * ************************************************************************** | |
using System.Collections.Generic; |
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 IEnumerable<T> AllButLast<T>(this IEnumerable<T> input) | |
{ | |
var next = input.First(); | |
foreach(var item in input.Skip(1)) | |
{ | |
yield return next; | |
next = item; | |
} | |
} |
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
for /F "skip=6 tokens=1" %%i in ('WHOAMI /PRIV') do SET %%i=1 | |
if not defined SeImpersonatePrivilege ( | |
echo This script must be run as an administrator | |
exit /b | |
) |