Instantly share code, notes, and snippets.

# Marc Symonds MarcSymonds

Last active September 27, 2023 15:00
Javascript code for calculating triangle properties
This file contains 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
 // Note: Javascript works in radians. // // pa, pb, pc are 3 points. Each point is an array with 2 values; x and y // function triangleCalculations(pa, pb, pc) { var a = lineLength(pc, pb); // Length of line from c to b. var b = lineLength(pa, pc); // Length of line from a to c. var c = lineLength(pa, pb); // Length of line from a to b. //var A = Math.acos(((b * b) + (c * c) - (a * a)) / (2 * b * c)); // Angle at point a.
Created April 25, 2017 08:42
JavaScript.Example - Convert a number to Roman numerals. Only works effectively up to 9999.
This file contains 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
 function convertToRoman(num) { var romanNumerals = [ {number: 1, numeral: "I", sub: 0}, {number: 5, numeral: "V", sub: -1}, {number: 10, numeral: "X", sub: -2}, {number: 50, numeral: "L", sub: -1}, {number: 100, numeral: "C", sub: -2}, {number: 500, numeral: "D", sub: -1}, {number: 1000, numeral: "M", sub: -2} ];
Last active June 7, 2019 21:48
C#.Example - Multiple indexers within a class
This file contains 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
 using System; using System.Collections.Generic; /// /// Example of multiple indexers within a single class. /// /// Why you might want/need to do this, who knows? /// namespace CSharp_Examples {
Created April 24, 2017 15:50
C#.Example - Multiple enumerators within a class to enumerate in multiple ways
This file contains 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
 using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; /// /// Example of multiple enumerators within a class so that you can enumerate through values /// hosted by the class in different ways. In this example, one enumerator allows you to go