This file contains hidden or 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
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); |
This file contains hidden or 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 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();}` | |
); |
This file contains hidden or 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
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) |