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
/** | |
* Both of the below methods are valid actions in an ApiController, and both would result in the | |
* same response being sent to the client. | |
**/ | |
// GET api/strings | |
public IEnumerable<string> Get() | |
{ | |
return new string[] { "value1", "value2" }; | |
} |
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 DocumentSessionFactory : IDisposable | |
{ | |
private readonly IDocumentStore documentStore; | |
public DocumentSessionFactory() | |
{ | |
documentStore = new EmbeddableDocumentStore { RunInMemory = true }; | |
documentStore.Initialize(); | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="4.0" DefaultTargets="Build" | |
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!-- Created by Craig Andrews http://candrews.integralblue.com [email protected] --> | |
<UsingTask TaskName="Microsoft.WebDeployment.Tasks.AspNetMerge" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\WebDeployment\v10.0\Microsoft.WebDeployment.Tasks.dll"/> | |
<PropertyGroup> | |
<_PackageTempDirCompiled>$(PackageTempRootDir)\PackageTempCompiled</_PackageTempDirCompiled> |
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; | |
using System.Linq; | |
using System.Text; | |
using System.Net.NetworkInformation; | |
using System.Net; | |
namespace AvailablePort | |
{ | |
class Program |
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
/// <summary> | |
/// Represents an IIS Express site.</summary> | |
public class IISExpress : IDisposable | |
{ | |
private readonly string applicationPath; | |
private readonly Uri address; | |
private Process process; | |
private bool disposed; |
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($) { | |
'use strict'; | |
function TypeaheadItem(value, selectedText, suggestionText) { | |
this.value = value; | |
this.text = selectedText; | |
this.suggestion = suggestionText || selectedText; | |
} | |
TypeaheadItem.prototype.toString = function () { |
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 client = new HttpClient()) | |
{ | |
var authTokenBytes = Encoding.UTF8.GetBytes("auth_key:"); | |
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(authTokenBytes)); | |
await client.PostAsync("https://push.ducksboard.com/v/widget_id", new { value = timer.ElapsedMilliseconds }, new JsonMediaTypeFormatter()); | |
} |
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 class HtmlHelperExtensions | |
{ | |
public static WebGrid<T> Grid<T>( | |
this HtmlHelper<PagedViewModel<T>> htmlHelper, | |
int rowsPerPage = 10) where T : class | |
{ | |
return new WebGrid<T>(htmlHelper, rowsPerPage); | |
} | |
public static WebGrid<TModel> Grid<T, TModel>( |
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
private class FakeScriptPack : IScriptPack | |
{ | |
public void Initialize(IScriptPackSession session) | |
{ | |
} | |
public IScriptPackContext GetContext() | |
{ | |
return new FakeScriptPackContext(); | |
} |
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 void Execute(string code, IEnumerable<string> references, IEnumerable<string> namespaces, ScriptPackSession scriptPackSession) | |
{ | |
var host = _scriptHostFactory.CreateScriptHost(new ScriptPackManager(scriptPackSession.Contexts)); | |
foreach (var context in scriptPackSession.Contexts) _scriptEngine.AddReference(context.GetType().Assembly); | |
var session = _scriptEngine.CreateSession(host); | |
foreach (var reference in references.Union(scriptPackSession.References).Distinct()) | |
session.AddReference(reference); |