Skip to content

Instantly share code, notes, and snippets.

View wwwlicious's full-sized avatar

Scott Mackay wwwlicious

View GitHub Profile
@davidfowl
davidfowl / Example1.cs
Last active June 19, 2024 16:41
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
@carols10cents
carols10cents / c#-to-rust.md
Last active April 18, 2024 22:55
C# to Rust Cheat Sheet

Thanks to @seejee for making this for me!!!

C# to Rust Cheat Sheet

The goal of this is to have an easily-scannable reference for the most common syntax idioms in C# and Rust so that programmers most comfortable with C# can quickly get through the syntax differences and feel like they could read and write basic Rust programs.

What do you think? Does this meet its goal? If not, why not?

Variables

#!/bin/bash
source /etc/environment
name=$(cat /etc/machine-id)
if [ ! -f /opt/consul ]; then
mkdir /opt
mkdir /var/lib/consul
wget https://dl.bintray.com/mitchellh/consul/0.4.1_linux_amd64.zip
unzip 0.4.1_linux_amd64.zip
@jen20
jen20 / MessageIdentity.cs
Created August 19, 2014 17:39
Generator for deterministic GUIDs
public class MessageIdentity
{
public Guid NameSpace;
private readonly byte[] _namespaceBytes;
public MessageIdentity(Guid guidNameSpace)
{
NameSpace = guidNameSpace;
_namespaceBytes = guidNameSpace.ToByteArray();
SwapByteOrder(_namespaceBytes);
@oswaldoacauan
oswaldoacauan / styleguide.md
Created May 2, 2014 13:23
Ghostium - Styleguide Markdown
@danielmarbach
danielmarbach / MoqToFakeItEasy.DotSettings
Last active July 3, 2024 18:26
Structural Search and Replace Pattern for Migration from Moq to FakeItEasy with Resharper
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=23B254B63645A7449313D9A6F88A5C0C/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=23B254B63645A7449313D9A6F88A5C0C/Comment/@EntryValue">Replace Mock Field with FakeItEasy</s:String>
<s:Boolean x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=23B254B63645A7449313D9A6F88A5C0C/CustomPatternPlaceholder/=fieldName/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=23B254B63645A7449313D9A6F88A5C0C/CustomPatternPlaceholder/=fieldName/Properties/=CaseSensitive/@EntryIndexedValue">True</s:String>
<s:String x:Key="/Default/PatternsAndTempla
@miketrebilcock
miketrebilcock / main.cs
Created July 2, 2013 19:10
Using TopShelf to Host Service Stack
public static void Main(string[] args)
{
var appSettings = new AppSettings();
AppConfig config = new AppConfig(appSettings);
HostFactory.Run(x =>
{
x.UseLog4Net();
x.Service<AppHost>(s =>
{
using ServiceStack.WebHost.Endpoints;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Security;
using ServiceStack.Common.Web;
using ServiceStack.Logging;
using ServiceStack.ServiceHost;
using ServiceStack.ServiceInterface;
@dotnetchris
dotnetchris / gist:3636052
Created September 5, 2012 12:47
Simple ravendb backup script
$dest = "F:\Backup\Runs\backup-"+(Get-Date).ToString("yyyy-MM-dd HHmm")
.\Raven.Backup.exe --url=http://localhost/ --dest=$dest
& 'C:\Program Files\7-Zip\7z.exe' a $dest $dest
Remove-Item -Recurse $dest
@sandord
sandord / gist:400553
Last active September 24, 2023 08:17
Get property name from lambda expression
using System.Linq.Expressions;
/// <summary>
/// Returns the name of the specified property of the specified type.
/// </summary>
/// <typeparam name="T">The type the property is a member of.</typeparam>
/// <param name="property">The property expression.</param>
/// <returns>The property name.</returns>
public static string GetPropertyName<T>(Expression<Func<T, object>> property)
{