public string GetSomething()
{
return something;
}
This file contains hidden or 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 sealed class Dependency : IDisposable | |
{ | |
public string SomeProperty { get; set; } | |
public void Dispose() | |
{ | |
} | |
} | |
public sealed class Owner : IDisposable |
This file contains hidden or 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
Assert.Throws<SomeException>(async () => await obj.GetAsync()); |
This file contains hidden or 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 async static Task<T> ThrowsAsync<T>(Func<Task> testCode) where T : Exception | |
{ | |
try | |
{ | |
await testCode(); | |
Assert.Throws<T>(() => { }); // Use xUnit's default behavior. | |
} | |
catch (T exception) | |
{ | |
return exception; |
This file contains hidden or 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 EnumerableExtensions | |
{ | |
public static Dictionary<TKey, TSource> ToDictionaryBetter<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) | |
{ | |
return source.GroupBy(keySelector).ToDictionary(group => group.Key, group => | |
{ | |
try | |
{ | |
return group.Single(); | |
} |
This file contains hidden or 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
$dir = (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent) | |
Push-Location $dir | |
. (Resolve-Path "$dir\vs2010.ps1") | |
# . "Bradwils\profile.ps1" | |
$env:path += ";" + (Get-Item "Env:ProgramFiles(x86)").Value + "\Git\bin" | |
# Set up GitHub environment | |
Write-Host "Setting up GitHub Environment" |
- Unit tests: Review unit tests first. Unit tests are a fantastic way to grasp how code is meant to be used by others and to learn what the expected behavior is. Are there any test gaps that should be there?
- Method arguments" Make sure arguments to methods make sense and are validated. Mentally test boundary conditions and edge cases.
- Null References" (Yah yah, we know. Use F# and this goes away. We get it already.) Null references are a bitch and it’s worth looking out for them specifically.
- Conventions Consistency" Make sure naming, formatting, etc. follow our conventions and are consistent. I like a codebase that’s fairly consistent so you know what to expect.
- Disposables: Make sure disposable things are disposed. Look for usages of resources that should be disposed but are not.
- Security: There is a whole threat and mitigation review process that falls under this bucket. In simple terms, ask yourself how this code could be exploited. The [STRIDE Threat Mo
This file contains hidden or 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.Text.RegularExpressions; | |
using System.Reflection; | |
namespace RegexLibraryBuilder | |
{ | |
/// <summary> | |
/// Summary description for Class1. | |
/// </summary> | |
class RegexBuilderMain | |
{ |
This file contains hidden or 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
{% comment %} Load script if disquss comments are enabled and `page.comments` is either empty (index) or set to true {% endcomment %} | |
{% if site.disqus_short_name and page.comments != false %} | |
<script type="text/javascript"> | |
var disqus_shortname = '{{ site.disqus_short_name }}'; | |
{% if page.comments == true %} | |
{% comment %} `page.comments` can be only be set to true on pages/posts, so we embed the comments here. {% endcomment %} | |
// var disqus_developer = 1; | |
var disqus_identifier = '{% if page.disqus_identifier %}{{ page.disqus_identifier}}{% else %}{{ site.url }}{{ page.url }}{% endif %}'; | |
var disqus_url = '{{ site.url }}{{ page.url }}'; | |
var disqus_script = 'embed.js'; |
This file contains hidden or 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
open System | |
open System.Reactive | |
open System.Reactive.Linq | |
let seq = [1; 2; 3; 4].ToObservable() | |
// Add curryable versions of Rx methods | |
let select (selector:'TSource -> 'TResult) (source:IObservable<'TSource>) = | |
Observable.Select(source, selector) |