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
public class AppHarborMiddleware : OwinMiddleware | |
{ | |
public AppHarborMiddleware(OwinMiddleware next) | |
: base(next) | |
{ | |
} | |
public override Task Invoke(IOwinContext context) | |
{ | |
if (string.Equals(context.Request.Headers["X-Forwarded-Proto"], "https", StringComparison.InvariantCultureIgnoreCase)) |
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 (var webClient = new WebClient()) | |
{ | |
var appSettings = ConfigurationManager.AppSettings; | |
webClient.Headers.Add("x-license-key", appSettings["NEWRELIC_LICENSEKEY"]); | |
webClient.UploadValues(new Uri("https://api.newrelic.com/deployments.xml"), new NameValueCollection | |
{ | |
{ "deployment[app_name]", "My Application" }, | |
{ "deployment[user]", "AppHarbor" }, | |
{ "deployment[description]", string.Format("Deployment notification from {0}", appSettings["appharbor.worker_name"]) }, | |
{ "deployment[revision]", appSettings["appharbor.commit_id"] }, |
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
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var processStartInfo = new ProcessStartInfo | |
{ | |
FileName = "C:\\foo.exe", | |
RedirectStandardOutput = true, | |
RedirectStandardError = true, | |
UseShellExecute = false, |
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
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs) | |
[Bb]in/ | |
[Oo]bj/ | |
# mstest test results | |
TestResults | |
## Ignore Visual Studio temporary files, build results, and | |
## files generated by popular Visual Studio add-ons. |
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.IO; | |
using System.Security.Cryptography.X509Certificates; | |
namespace CertificateFoo | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
using (var certificateStream = GetEmbeddedResourceStream<Program>("foo.p12")) |
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.Web.Mvc; | |
using RequireHttpsAttributeBase = System.Web.Mvc.RequireHttpsAttribute; | |
namespace AppHarbor.Web | |
{ | |
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, | |
AllowMultiple = false)] | |
public class RequireHttpsAttribute : RequireHttpsAttributeBase | |
{ |
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
public static string ToPublicUrl(this UrlHelper urlHelper, Uri relativeUri) | |
{ | |
var httpContext = urlHelper.RequestContext.HttpContext; | |
var uriBuilder = new UriBuilder | |
{ | |
Host = httpContext.Request.Url.Host, | |
Path = "/", | |
Port = 80, | |
Scheme = "http", |