Skip to content

Instantly share code, notes, and snippets.

@teyc
teyc / .gitignore
Last active August 29, 2015 13:57
Caliburn Micro Conductor Stackoverflow Question
obj/
Bin/
Properties/
Tests/
@teyc
teyc / index.html
Created January 15, 2015 22:40
Load scripts relative to Sharepoint Site Collection
<!doctype html>
<html>
<script type="text/javascript" src="spLoadScripts.js">
Readify.SiteUrl = "/sites/MySite";
Readify.loadScriptsAsync(
"SiteAssets/pageStyle.css",
"SiteAssets/lodash.js"
);
</script>
</html>
@teyc
teyc / HomeModule.cs
Created February 15, 2015 10:12
Using Nancy with CoreCLR (doesn't work)
namespace WebApplication1
{
using Nancy;
public class HomeModule: NancyModule
{
public HomeModule()
{
Get["/"] = _ => "Goodbye from Nancy";
}
public class CustomHostFactory : ServiceHostFactory
{
protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
{
ServiceHost host = new ServiceHost(serviceType, baseAddresses);
// ... now can configure endpoints programmatically if required
return host;
}
@teyc
teyc / DbUp.csproj
Last active August 29, 2015 14:23 — forked from sheastrickland/DbUp.csproj
MSBuild convention checks
<Target Name="AfterBuild">
<Message Text="@(Content)" Importance="high" Condition="%(Content.Extension) == '.sql'" />
<Error Condition="%(Content.Extension) == '.sql'" Text="Nothing should be marked as Content, check your scripts are marked as Embedded Resource" />
</Target>
@teyc
teyc / gist:8eea5e9afc027bd2da6a
Last active August 29, 2015 14:27
Converts from music notes to number of semitones
type Notes =
| A = 0
| ASharp = 1
| B = 2
| C = 3
| CSharp = 4
| D = 5
| DSharp = 6
| E = 7
| F = 8
@teyc
teyc / README.md
Last active September 9, 2015 11:17
How dnx compiles and loads assemblies

When dnx executes, it loads a list of IAssemblyLoaders, of which one is a ProjectAssemblyLoader

https://github.com/aspnet/dnx/blob/master/src/Microsoft.Dnx.Runtime/Loader/ProjectAssemblyLoader.cs

and the ProjectAssemblyLoader embeds an ICompilationEngine,

Dnx also includes a DesignTimeHost. https://github.com/aspnet/dnx/blob/master/src/Microsoft.Dnx.DesignTimeHost/Program.cs I'm not sure where this is used, but a DTH usually embeds a Roslyn compiler.

Update: See https://github.com/aspnet/dnx/commit/a3d1f0f29c1f4e49326cf66e330dc56cd0105576 where you can pass a command line option to ApplicationHost.cs to use an out of process DesignTimeHost compiler.

@teyc
teyc / PersistentRemoteWebDriver.cs
Last active September 17, 2015 04:42
A persistent web driver that keeps the browser open so that you can continue scripting from where you left off.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using OpenQA.Selenium.Remote;
namespace Readify.FunctionalTests.Selenium
{
/// <summary>
@teyc
teyc / CLibrary_Sample.cs
Created September 5, 2015 11:16
DotNet CoreCLR dnxcore50 on OS X console
namespace CLibrary
{
public class Sample
{
public string OperatingSystem
{
get
{
return "OS X";
}