Skip to content

Instantly share code, notes, and snippets.

public bool failsHoleConditions(HoleInfo holeOne, HoleInfo holeTwo)
{
var radiusSum = (holeOne.Diameter + holeTwo.Diameter) /2;
var distanceX = Math.Abs(holeOne.X - holeTwo.X);
var distanceY = Math.Abs(holeOne.Y - holeTwo.Y);
var distanceHolesSquare = (distanceX * distanceX) + (distanceY * distanceY) - (radiusSum * radiusSum);
if (distanceHolesSquare <= 0)
var remote = require('remote'); //'remote' is a node module of edge, and i need to resolve it with the require Method defined in module.js of node
export class EdgeTest
{
private edge = remote.require('electron-edge')
myInput = 'TypeScript';
myResult = '';
private helloWorld = this.edge.func(
`async (input) => { return ".NET Welcomes " + input.ToString();}`
);
static class AsyncResultExtensions
{
//added to chain awaitable methods
public static async Task<Result<TResult>> OnSuccessAsync<T, TResult>(this Result<T> result, Func<T, Task<Result<TResult>>> func)
{
var res = result;
if (res.Failed)
return Result<TResult>.Fail(res.Error);
return await func(res.Value);