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
using System; | |
using System.Threading; | |
using System.Web.Mvc; | |
namespace MvcApplication1.Controllers | |
{ | |
public class HomeController : Controller | |
{ | |
public ActionResult Index() | |
{ |
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 result = elasticClient.Search<ErrorDocument>(s => s | |
.FacetDateHistogram(fd => fd | |
.OnField(p => p.Time) | |
.Interval(DateInterval.Day) | |
.Global() | |
.FacetFilter(ff => ff | |
.Range(rf => rf | |
.From(DateTime.UtcNow.AddDays(-14)) | |
.To(DateTime.UtcNow) | |
) |
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
<h1>Comments</h1> | |
<div id="comments"> | |
{{#each comments}} | |
<h2><a href="/posts/#{{id}}">{{title}}</a></h2> | |
<div>{{body}}</div> | |
{{/each}} | |
</div> |
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
<h1>Comments</h1> | |
<div id="comments" data-bind="foreach: comments"> | |
<h2><a data-bind="attr: { href: '/posts/#' + id }, text: title"></a></h2> | |
<div data-bind="text: body"></div> | |
</div> |
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
// Load the http module to create an http server. | |
var http = require('http'); | |
// Configure our HTTP server to respond with Hello World to all requests. | |
var server = http.createServer(function (request, response) { | |
response.writeHead(200, { "Content-Type": "text/plain" }); | |
response.end("Hello World\n"); | |
}); | |
// Listen on port 8000, IP defaults to 127.0.0.1 |
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 class IISExpressTest | |
{ | |
[Test] | |
public void IISExpressIsNeverDisabled() | |
{ | |
XNamespace @namespace = "http://schemas.microsoft.com/developer/msbuild/2003"; | |
var document = XDocument.Load("path to your web project (csproj)"); | |
var element = | |
document.Descendants(@namespace + "Project") | |
.First() |
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 links = | |
LinkCheck | |
.On(x => x.Url(new Uri(context.Url))) | |
.AsBot(bot => bot.Google()) | |
.Start(); | |
.Where(x => (int) x.StatusCode >= 400) | |
.Select(x => new ValidationIssue | |
{ | |
Severity = SeverityEnum.Error, | |
Title = "The following link returned status code " + |
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 result = | |
LinkCheck | |
.On(x => x.Url(new Uri("http://www.hippovalidator.com"))) | |
.AsBot(x => x.Google()) | |
.OnRequest(req => ...) | |
.OnResponse(resp => ...) | |
.Start(); |
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
using System; | |
using System.Collections; | |
using System.Configuration; | |
using System.Globalization; | |
using Nest; | |
namespace Elmah.ElasticSearch | |
{ | |
public class ElasticSearchLog : ErrorLog | |
{ |
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
$username = "insert_username_here" | |
$password = ConvertTo-SecureString "insert_password_here" -AsPlainText -Force | |
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username,$password | |
$session = New-PSSession "insert_hostname_here" -Credential $credential | |
Invoke-Command -Session $session -ScriptBlock { | |
Set-ExecutionPolicy RemoteSigned | |
Import-Module WebAdministration | |
New-Item iis:\Sites\%teamcity.build.branch%.insert_local_name_here -bindings @{protocol="http";bindingInformation=":80:%teamcity.build.branch%.insert_local_name_here"} -physicalPath c:\inetpub\wwwroot\%teamcity.build.branch%.insert_local_name_here | |
Set-ItemProperty 'IIS:\Sites\%teamcity.build.branch%.insert_local_name_here' ApplicationPool "ASP.NET v4.0" |