As a nuget package the same as Fody
Optionally replace/add cs files to the build pipeline in a similar wat to GFV
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reactive; | |
using System.Reactive.Disposables; | |
using System.Reactive.Linq; | |
using System.Reactive.Subjects; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; |
namespace MaybeMonad | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
static class Monads | |
{ | |
/// <summary> |
Things you need: | |
- a base implementation of ICommand - for Win8 I'd recommend asynchronous support. For early frameworks I'd say no. | |
- an interface for messaging between components - current favourite interface is MvvmLight's Messenger | |
- a base implementation of this messenger | |
Things you don't need: | |
- a base implementation of INotifyPropertyChanged - just IL weave and [don't think too hard about it](brendanforster.com/inotifypropertychanged-stop-the-madness.html) |
using Microsoft.AspNet.SignalR; | |
using Microsoft.Owin.Hosting; | |
using Nancy; | |
using Nancy.Owin; | |
using Owin; | |
using System; | |
using System.IO; | |
using System.Reflection; | |
public class Program |
public static class WpfExtensions | |
{ | |
public static DispatcherAwaiter GetAwaiter(this Dispatcher dispatcher) | |
{ | |
return new DispatcherAwaiter(dispatcher, DispatcherPriority.Normal); | |
} | |
public static Tuple<Dispatcher, DispatcherPriority> WithPriority(this Dispatcher dispatcher, DispatcherPriority priority) | |
{ | |
return Tuple.Create(dispatcher, priority); |
Objective:
For Task<T>
and ValueTask<T>
(T
=int
as a common non-trivial but inlineable case), compare async performance in
the synchronous scenario (i.e. where data happens to be buffered - common in deserialization etc code) for 3 implementations:
await
throughoutIsCompleted
); switch via local async Awaited
if neededIsCompletedSuccessfully
); switch via local async Awaited
if neededNote:
<!-- Add the following lines to theme's html code right before </head> --> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script> | |
<script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script> | |
<script src="http://static.tumblr.com/fpifyru/AKFlv9zdu/embedgist.js"></script> | |
<!-- | |
Usage: just add <div class="gist">[gist URL]</div> | |
Example: <div class="gist">https://gist.github.com/1395926</div> | |
--> |
// Only let input Observable fire every 'n' seconds at most | |
// but unlike Throttle, items fire immediately when they aren't | |
// rate-limited. | |
public IObservable<T> RateLimit<T>(this IObservable<T> This, TimeSpan interval, IScheduler scheduler) | |
{ | |
var slot = default(IObservable<Unit>); | |
var input = This.Publish().RefCount(); | |
return input.Window(input, _ => { | |
if (slot != null) return slot; |
#Quick and dirty PS script for counting lines of code in a directory. Output is dumped to a simple CSV file. | |
#Note that this script doesn't count blank lines. | |
#Parameters: | |
# path - the path containing the code files (note that the script will recurse through subfolders | |
# outputFile - fully qualified path of the file to dump the CSV output | |
# include (Optional) - file mask(s) to include in the count (deafults to *.*) | |
# exclude (Optional) - file mask(s) to exclude in the count (defaults to none) | |
# Example (count lines in target path including *.cs but excluding *.designer.cs) | |
# .\countLOC.ps1 -path "C:\code\MyProject" -outputFile "C:\code\loc.csv" -include "*.cs" -exclude "*.designer.cs" | |
param([string]$path, [string]$outputFile, [string]$include = "*.*", [string]$exclude = "") |