Skip to content

Instantly share code, notes, and snippets.

View bgener's full-sized avatar

Borys Generalov bgener

View GitHub Profile
namespace Sagas
{
using System;
using System.Collections.Generic;
class Program
{
static ActivityHost[] processes;
@udooz
udooz / was-generate-authheaderstring
Created November 17, 2012 07:27
PowerShell function to generate signed string for WAS Authorization header
function Generate-AuthString
{
param(
[string]$url
,[string]$accountName
,[string]$accountKey
,[string]$requestUtcTime
)
@npryce
npryce / property-based-testing-tools.md
Last active August 14, 2022 20:34
Property-Based Testing Tools

If you're coming to the Property-Based TDD As If You Meant It Workshop, you will need to bring a laptop with your favourite programming environment, a property-based testing library and, depending on the language, a test framework to run the property-based-tests.

Any other languages or suggestions? Comment below.

.NET (C#, F#, VB)

Python:

@matagus
matagus / rabbitmq.config
Last active January 2, 2018 20:50
a sample rabbitmq config file, tested with RabbitMQ 3.0.2, Erlang R15B01
[
{rabbit, [
{auth_backends, [rabbit_auth_backend_internal]},
{auth_mechanisms, ['PLAIN','AMQPLAIN']},
{backing_queue_module, rabbit_variable_queue},
{cluster_nodes, []},
{collect_statistics, coarse},
{collect_statistics_interval, 5000},
{default_permissions, [<<".*">>,<<".*">>,<<".*">>]},
{default_user, <<"guest">>},
@philiplaureano
philiplaureano / gist:51413336b6c3c6d604e3
Last active September 15, 2016 11:51
Currying and chaining funcs and actions together in C#
public static class FunctionalBindingExtensions
{
public static Action<T2> Bind<T1, T2>(this Action<T1, T2> action, Func<T1> getValueFunc)
{
return action.Bind(getValueFunc());
}
public static Action<T1> Bind<T1, T2>(this Action<T1, T2> action, Func<T2> getValueFunc)
{
@mbenford
mbenford / DeployToOctopus.ps1
Created August 10, 2014 19:28
Powershell script for TeamCity that creates and deploys a release on Octopus Deploy based on the current branch
function Is-Default-Branch {
return "%teamcity.build.branch.is_default%" -eq "true"
}
function Build-Arguments {
if (Is-Default-Branch) {
$releaseNumber = "%octopus.master.releaseNumber%"
$deployTo = "%octopus.master.deployTo%"
$packageVersion = "%octopus.master.packageVersion%"
}
@tmarshall
tmarshall / aws-sns-example.js
Last active October 30, 2022 06:12
aws-sdk sns example, in Node.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();
@vkhorikov
vkhorikov / CustomerController.cs
Last active July 23, 2024 20:42
Handling failures and input errors in a functional way
[HttpPost]
public HttpResponseMessage CreateCustomer(string name, string billingInfo)
{
Result<BillingInfo> billingInfoResult = BillingInfo.Create(billingInfo);
Result<CustomerName> customerNameResult = CustomerName.Create(name);
return Result.Combine(billingInfoResult, customerNameResult)
.OnSuccess(() => _paymentGateway.ChargeCommission(billingInfoResult.Value))
.OnSuccess(() => new Customer(customerNameResult.Value))
.OnSuccess(
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active July 12, 2024 11:15
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@carlhoerberg
carlhoerberg / reconnect.js
Created May 13, 2015 14:45
How to build reconnect logic for amqplib
var amqp = require('amqplib/callback_api');
// if the connection is closed or fails to be established at all, we will reconnect
var amqpConn = null;
function start() {
amqp.connect(process.env.CLOUDAMQP_URL + "?heartbeat=60", function(err, conn) {
if (err) {
console.error("[AMQP]", err.message);
return setTimeout(start, 1000);
}