Skip to content

Instantly share code, notes, and snippets.

View fnbk's full-sized avatar
💭
I may be slow to respond.

Florian Böhmak fnbk

💭
I may be slow to respond.
View GitHub Profile
public static int[] BubbleSort(List<int> listInput)
{
for (int i = 0; i < listInput.Count; i++)
{
for (int j = 0; j < listInput.Count; j++)
{
if (listInput[i] < listInput[j])
{
var temp = listInput[i];
listInput[i] = listInput[j];
private Job CreateJob(Order order)
{
var computer = GetComputer(order.ComputerName, order.CustomerId);
computer.CustomerId = GetCustomerId(order.CustomerId, computer.CustomerId);
var serverAddress = GetServerAddress(order.ComputerName, computer.CustomerId);
var deploymentType = GetDeploymentType(order.MaterialNumber, computer.CustomerId);
var job = NewJob(order, computer, serverAddress, deploymentType, jobActions);
return job;
}
@fnbk
fnbk / CreateJobV6.cs
Last active September 18, 2022 15:02
branching: monads
// Create Job
return ValidateComputer(order).Resolve(
fail: () => {
new Job()
{
ActivationTime = order.ClientLocalStartTime,
ComputerName = order.ComputerName,
orderId = order.Id,
Status = invalidComputerErrorMessage,
}
@fnbk
fnbk / CreateJobV5.cs
Created September 2, 2022 21:22
branching: local-functions
private Job CreateJob(order order)
{
var job = ValidateComputer(order.ComputerName, onSuccess, onFailure);
return job;
Job onSuccess(Order order)
{
var computer = GetComputer(order.ComputerName, order.CustomerId);
computer.CustomerId = GetCustomerId(order.CustomerId, computer.CustomerId);
var siteServerAddress = GetServerAddress(order.ComputerName, computer.CustomerId);
@fnbk
fnbk / CreateJobV4.cs
Last active September 18, 2022 14:50
branching: if-else
private Job CreateJob(order order)
{
var errorMessage = ValidateComputer(order.ComputerName);
if (errorMessage != "")
{
return new Job()
{
ActivationTime = order.ClientLocalStartTime,
ComputerName = order.ComputerName,
orderId = order.Id,
@fnbk
fnbk / CreateJobV3.cs
Created September 2, 2022 21:20
branching: try-catch
private async Task<Job> CreateJob(order order)
{
Job job = new Job()
{
ActivationTime = order.ClientLocalStartTime,
ComputerName = order.ComputerName,
orderId = order.Id,
};
try // happy path
@fnbk
fnbk / CreateJobV2.cs
Created September 2, 2022 21:19
clean
private async Task<Job> CreateJob(Order order)
{
var computer = GetComputer(order.ComputerName, order.CustomerId);
computer.CustomerId = GetCustomerId(order.CustomerId, computer.CustomerId);
var serverAddress = GetServerAddress(order.ComputerName, computer.CustomerId);
var deploymentType = GetDeploymentType(order.MaterialNumber, computer.CustomerId);
var jobActions = CreateJobActions(deploymentType, order, serverAddress, computer);
var status = "created";
Job job = new Job()
@fnbk
fnbk / CreateJobV1.cs
Last active September 22, 2022 13:23
dirty
private async Task<Job> CreateJob(order order)
{
Job job = new Job
{
ActivationTime = order.ClientLocalStartTime,
ComputerName = order.ComputerName,
orderId = order.Id,
Status = "created"
};
# copy file from VM to your host system
scp -i ~\.ssh\my-key.pem [email protected]:/home/azureuser/export.json export.json
# copy file from VM to your host system
scp -i ~\.ssh\my-key.pem [email protected]:/home/azureuser/export.json export.json