[![Trello Development Board](https://trello.com/b/nC8QJJoZ.png)](https://trello.com/b/nC8QJJoZ)
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
namespace Mvc.Cors | |
{ | |
using System.Linq; | |
using System.Web.Http.Filters; | |
public class CorsEnabledAttribute : ActionFilterAttribute | |
{ | |
private string[] allowedDomains; | |
public CorsEnabledAttribute() |
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
/* euclidean GCD (feel free to use any other) */ | |
function gcd(a,b) {if(b>a) {temp = a; a = b; b = temp} while(b!=0) {m=a%b; a=b; b=m;} return a;} | |
/* ratio is to get the gcd and divide each component by the gcd, then return a string with the typical colon-separated value */ | |
function ratio(x,y) {c=gcd(x,y); return ""+(x/c)+":"+(y/c)} | |
/* eg: | |
> ratio(320,240) | |
"4:3" | |
> ratio(360,240) |