- Install Chocolatey
- Reopen console application (for example
cmd.exe
) to update%PATH%
and other environment variables - Install ScriptCs using chocolatey
- Save both
Roslyn-EvalSample.csx
andpackages.config
- Install dependencies using
scriptcs -install
- Run
scriptcs .\Roslyn-EvalSample.csx
View 01_SayHello.fsx
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
#time "on" | |
#load "Bootstrap.fsx" | |
open System | |
open Akka.Actor | |
open Akka.Configuration | |
open Akka.FSharp | |
open Akka.TestKit | |
// #Using Actor |
View gist:4622557
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
void Main() | |
{ | |
using(var kernel = new StandardKernel(new Module())) | |
{ | |
kernel.Load<FuncModule>(); // for sake of LinqPAD | |
var instance1 = kernel.Get<MyClass>(new ConstructorArgument("myArg", "test")); | |
var instance2 = kernel.Get<MyClass>(new ConstructorArgument("myArg", "test")); | |
Assert.That(instance1, Is.Not.Null.And.SameAs(instance2)); |
View gist:4258647
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
Write-Host 'throw' | |
try | |
{ | |
try | |
{ | |
throw "exception" | |
} | |
catch | |
{ |
View simple_tcp_server_with_SO_REUSEPORT.py
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
import socket | |
import sys | |
from contextlib import contextmanager | |
import click | |
so_reuseport = socket.SO_REUSEPORT | |
@contextmanager |
View FsCheckSamples.fsx
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
#I @".\packages\FsCheck.0.9.2.0\lib\net40-Client\" | |
#r @"FsCheck.dll" | |
// #time "on" | |
open FsCheck | |
// simple example | |
let revRevIsOrig (xs:list<int>) = List.rev(List.rev xs) = xs | |
Check.Quick revRevIsOrig;; |
View gist:4457261
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
void Main() | |
{ | |
TraceDecorator.Aspect(() => StaticLogic.SuccessfulCall()); | |
TraceDecorator.Aspect(() => StaticLogic.ExceptionCall()); | |
TraceDecorator.Aspect(() => StaticLogic.SuccessfulCallWithReturn(42)).Dump(); | |
TraceDecorator.Aspect(() => StaticLogic.ExceptionCallWithReturn(42)).Dump(); | |
} | |
public static class TraceDecorator | |
{ |
View Howto.md
View 1readme.md
ScriptCs as embedded scripting engine for .Net application with NuGet support
This gist contains:
- ExecuteScriptCs.cs — class that are able to execute ScriptCs from another .Net application
- ScriptModule.cs — AutoFac configuration for ScriptCs/NuGet dependencies
- Program.cs — command-line example
- Sample.csx — sample ScriptCs script
- packages.config — NuGet packages configuration
View gist:4530162
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
void Main() | |
{ | |
ProxyGenerator proxyGenerator = CreateProxyGenerator(); | |
IService proxy = | |
proxyGenerator | |
.CreateInterfaceProxyWithTargetInterface(new Service() as IService, new TracingInterceptorAspect()); | |
proxy.ProcessRequest(); | |
View gist:4593576
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
void Main() | |
{ | |
using(var kernel = new StandardKernel(new CarModule())) | |
{ | |
kernel.Load<FuncModule>(); // for sake of LinqPAD | |
var factory = kernel.Get<ICarFactory>(); | |
Assert.That(factory, Is.Not.Null); | |
NewerOlder