Skip to content

Instantly share code, notes, and snippets.

View adamralph's full-sized avatar
🤗
Living the dream

Adam Ralph adamralph

🤗
Living the dream
View GitHub Profile
@glennblock
glennblock / non_scripty_way.csx
Last active August 29, 2015 13:56
Script packs as script
public class WebApi : IScriptPackContext {
public WebApi(ILog logger, IControllerTypeManager typeManager) {
...
}
}
public class WebApiScriptPack : IScriptPack
{
private readonly ILog _logger;
private readonly IControllerTypeManager _typeManager;
@danbarua
danbarua / rakefile.rb
Created February 10, 2014 13:26
Albacore task to verify projects have StyleCop.MSBuild set up properly
desc "Checks .csproj files for StyleCop.MSBuild target"
task :verify_stylecop_msbuild do
projectFiles = FileList["./**/*.csproj"]
projectFiles.each{|f|
doc = Nokogiri::XML(File.open(f))
target = doc.css('PropertyGroup > StyleCopMSBuildTargetsFile')
if (target.empty?)
puts "#{f} has no stylecop.msbuild"
else
puts "#{f} is ok"
@filipw
filipw / app.csx
Last active August 29, 2015 13:56
nancy on helios with OWIN and scriptcs
#load "bootstrapper.csx" //setup rootpathprovider and other stuff
public class IndexModule : NancyModule
{
public IndexModule()
{
Get["/"] = x => {
return View["index"];
};
}
  1. Install SublimeREPL package from package control

  2. Install scriptcs package from package control

  3. Download this experimental build of scriptcs and extract to some folder on your machine

  4. go to ~/.config/sublime-text-2/Packages/SublimeREPL/config/ScriptCS and open Main.sublime-menu file

  5. Update the "linux" path in that file to "linux": ["mono", "PATH/TO/YOUR/scriptcs.exe", "-modules", "mono", "-repl"]

@blairconrad
blairconrad / FIE_1.19.0_startup.md
Last active August 29, 2015 13:59
FakeItEasy 1.19.0 startup time improvements

In case anyone is interested, the faster FakeItEasy 1.19.0 startup does indeed seem to be faster. I started using 1.19.0 at the Day Job today, and got these results for a test run in the IDE (ReSharper test runner):

shadow copies no shadow copies
1.18.0 5.9s 2.5s
1.19.0 0.86s 0.63s
@GraemeBradbury
GraemeBradbury / gist:c14eb5133bb01f979328
Created April 2, 2015 12:03
Multiple asserts single detailed response
That's not really a pattern and more a tooling thing.
Sometimes scenarios have behaviour that has multiple aspects, which individually are worthless but together have worth.
So contrived scenario ahead
Given a Spline
When it's Retriculated
Then it beeps
And it flashes
  1. Update VS Code settings to treat .csx as .cs

     win: C:\Users\username\AppData\Local\Code\app-0.1.0\resources\app\plugins\vs.language.csharp\ticino.plugin.json
     os x: \AppData\Local\Code\app-0.1.0\resources\app\client\vs\languages\vs.language.csharp\ticino.plugin.json
    

There is an extensions array there tht you should modify.

  1. Get omnisharp-roslyn and build

git clone https://github.com/OmniSharp/omnisharp-roslyn.git

@filipw
filipw / app.csx
Last active November 4, 2015 19:34
#load "bootstrapper.csx"
public class IndexModule : NancyModule
{
public IndexModule()
{
Get["/"] = x => {
return View["index"];
};
}
@khellang
khellang / script.csx
Last active December 22, 2015 17:12
scriptcs running a self-hosted OWIN application
#r Owin;
#r Microsoft.Owin.Hosting;
using Owin;
using Microsoft.Owin.Hosting;
var url = "http://localhost:8080";
using (WebApp.Start(url, Configure))
{
@msugakov
msugakov / a.cs
Created April 27, 2014 19:13
C# program that starts process and combines its standart output and standard error in one stream
using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
class App
{
public static int ExecuteProcess(
string fileName,
string arguments,