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
# Moved! | |
iwr -useb https://raw.githubusercontent.com/refactoring-pipelines/Pipelines/master/machine-setup.ps1 | iex |
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
float Q_rsqrt_original(float number) | |
{ | |
long i; | |
float x2, y; | |
const float threehalfs = 1.5F; | |
x2 = number * 0.5F; | |
y = number; | |
i = *(long*)&y; // evil floating point bit level hacking | |
i = 0x5f3759df - (i >> 1); // what the fuck? |
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
var zipCodePipe = new InputPipe<ZipCode>("zipCode"); | |
var peanutButtersPipe = zipCodePipe.ProcessFunction( PeanutButterShop.GetAvailable); | |
var jelliesPipe = zipCodePipe.ProcessFunction(JellyShop.GetAvailable); | |
var bestPeanutButterPipe = peanutButtersPipe.Process(_ => _.BestPeanutButter); | |
var bestJelliesPipe = jelliesPipe.Process(_ => _.BestJelly); | |
var joinedPipe = bestPeanutButterPipe.JoinTo(bestJelliesPipe); | |
var sandwichPipe = joinedPipe.Process((bestPeanutButter, bestJelly) => | |
Sandwich.Create(bestPeanutButter, bestJelly)); | |
sandwichPipe.Collect(); |
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 "okra.h" | |
TEST("addToArray will result in a new copy of the array with the added items") | |
{ | |
const vector<int> numbers = {1, 2, 3}; | |
const vector<int> result = ArrayUtils::addtoArray(numbers, 4, 5, 6); | |
assertArrayEquals(vector<int>{1, 2, 3, 4, 5, 6}, result); | |
} |
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
@Test | |
class YouCanAddToAnArrayTheSameWayYouCanAddToAList | |
{ | |
public void addToArray_WillResultInANewCopyOfTheArrayWithTheAddedItems() throws Exception | |
{ | |
Integer[] numbers = {1, 2, 3}; | |
Integer[] result = ArrayUtils.addtoArray(numbers, 4, 5, 6); | |
assertArrayEquals({1, 2, 3, 4, 5, 6}, result); | |
} | |
} |
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
// | |
// - PipeSource is split. The "take a static input" is one part. The "execute a function and broadcast the result" is another. | |
// | |
// - A FunctionPipe is like PipeMiddle, with the specific purpose of applying an A->B function to each item in the pipeline. Its last ctor parameter is the thing it listens to. (Assume it calls `predecessor.AndNext(this)`) | |
// | |
// - An overloaded FunctionPipe ctor takes a string, to identify it in the ASCII art, when the function is a lambda that doesn't have a friendly name. | |
// var characterFile = CharacterFile.From(fileName); | |
var fileNamePipe = StaticInputPipe.Of(fileName); | |
var characterFile = FunctionPipe.Of(CharacterFile.From, fileNamePipe); |
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
// var characterFile = CharacterFile.From(fileName); | |
var fileName = new StaticInputPipe(fileName); | |
var characterFile = new FunctionPipe(CharacterFile.From, fileName); | |
// var configFile = ConfigFile.Matching(characterFile); | |
var configFile = new FunctionPipe(ConfigFile.Matching, characterFile); | |
// var partialCards = characterFile.ParseCards(); | |
var partialCards = new FunctionPipe("CharacterFile.ParseCards", _ => _.ParseCards(), characterFile); |
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
// var characterFile = CharacterFile.From(fileName); | |
var fileName = new StaticInputPipe(fileName); | |
var characterFile = new FunctionPipe(CharacterFile.From, fileName); | |
// var configFile = ConfigFile.Matching(characterFile); | |
var configFile = new FunctionPipe(ConfigFile.Matching, characterFile); | |
// var partialCards = characterFile.ParseCards(); | |
var partialCards = new FunctionPipe("CharacterFile.ParseCards", _ => _.ParseCards(), characterFile); |
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
CharacterData MakeAllTheViewModels( | |
const std::string& fileName, const std::string& username, const std::string& password) | |
{ | |
auto characterFile = CharacterFile::From(fileName); | |
auto configFile = ConfigFile::Matching(characterFile); | |
auto partialCards = characterFile.ParseCards(); | |
auto localCards = configFile.ParseCards(); | |
auto compendiumService = CompendiumService::Authenticate(username, password); | |
auto cardService = CardService::Authenticate(username, password); |
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
var pipeline = new Pipeline(CharacterFile.From) | |
{ | |
new ResultCollector<CharacterFile>(), | |
new Pipeline(ConfigFile.Matching) | |
{ | |
new ResultCollector<ConfigFile>(), | |
}, | |
new Pipeline(_ => _.ParseCards()) | |
{ | |
new ResultCollector<List<CardData>>(), |