Skip to content

Instantly share code, notes, and snippets.

Jay Bazuzi JayBazuzi

Block or report user

Report or block JayBazuzi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View You can add to an array the same way you can add to a list.cpp
#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);
}
View addToArrayTest.java
@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);
}
}
View LegacyCharExampleSyntax.cs
//
// - 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);
@JayBazuzi
JayBazuzi / LegacyCharExampleSyntax.cs
Created Feb 19, 2019
- PipeSource is split into a StaticInputPipe and a PipeMiddle
View LegacyCharExampleSyntax.cs
// 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);
@JayBazuzi
JayBazuzi / LegacyCharExampleSyntax.cs
Created Feb 19, 2019
- PipeSource is split into a StaticInputPipe and a PipeMiddle
View LegacyCharExampleSyntax.cs
// 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);
View DoEverything.cpp
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);
View IniitalizePipeline.cs
var pipeline = new Pipeline(CharacterFile.From)
{
new ResultCollector<CharacterFile>(),
new Pipeline(ConfigFile.Matching)
{
new ResultCollector<ConfigFile>(),
},
new Pipeline(_ => _.ParseCards())
{
new ResultCollector<List<CardData>>(),
@JayBazuzi
JayBazuzi / MergeDownProcess.py
Created Sep 22, 2018
One way to factor a script for a multi-step process.
View MergeDownProcess.py
def main():
return (MergeDownProcess(_WORKSPACE_DIR)
.get_user_intent()
.ensure_on_sparse_branch()
.ensure_no_files_opened()
.ensure_something_to_integrate()
.merge()
.create_changelist_for_any_changes()
.ensure_resolved()
.submit_any_changes()
@JayBazuzi
JayBazuzi / MergeDownProcess.py
Created Sep 22, 2018
One way to factor a script for a multi-step process.
View MergeDownProcess.py
def main():
return (MergeDownProcess(_WORKSPACE_DIR)
.get_user_intent()
.ensure_on_sparse_branch()
.ensure_no_files_opened()
.ensure_something_to_integrate()
.merge()
.create_changelist_for_any_changes()
.ensure_resolved()
.submit_any_changes()
@JayBazuzi
JayBazuzi / MergeDownProcess.py
Created Sep 22, 2018
One way to factor a script for a multi-step process.
View MergeDownProcess.py
def main():
return (MergeDownProcess(_WORKSPACE_DIR)
.get_user_intent()
.ensure_on_sparse_branch()
.ensure_no_files_opened()
.ensure_something_to_integrate()
.merge()
.create_changelist_for_any_changes()
.ensure_resolved()
.submit_any_changes()
You can’t perform that action at this time.