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
Invoke-RestMethod -Uri https://api.github.com/user/repos ` | |
-Body (@{"name"="REPO"} | ConvertTo-Json) ` | |
-Credential 'USER' ` | |
-Method Post ` | |
git remote add origin [email protected]:USER/REPO.git | |
git push origin master |
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 Multiplicity Multiplicity<TElement>(this IEnumerable<TElement> @this) | |
{ | |
switch (@this.Take(2).Count()) | |
{ | |
case 0: return General.Multiplicity.None; | |
case 1: return General.Multiplicity.One; | |
case 2: return General.Multiplicity.Many; | |
default: throw new Exception("WTF‽"); | |
} | |
} |
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.Collections.Generic; | |
using System.ComponentModel; | |
using System.Dynamic; | |
namespace Core.Utils | |
{ | |
public static class ReflectionExtensions | |
{ | |
public static ExpandoObject ToExpando(this object values) | |
{ |
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
StringBuilder sUrl = new StringBuilder(); | |
sUrl.Append("http://www.esvapi.org/v2/rest/passageQuery"); | |
sUrl.Append("?key=IP"); | |
sUrl.Append("&passage=" + Server.UrlEncode("Matthew 5").ToString()); | |
sUrl.Append("&include-headings=true"); | |
WebRequest oReq = WebRequest.Create(sUrl.ToString()); | |
StreamReader sStream = new StreamReader(oReq.GetResponse().GetResponseStream()); |
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 class ServiceLocatorStub : ServiceLocatorImplBase | |
{ | |
private readonly IDictionary<Type, ICollection<object>> | |
registeredTypes = new Dictionary<Type, ICollection<object>>(); | |
private ServiceLocatorStub() | |
{} | |
public ServiceLocatorStub AddInstance<TService>(TService instance) | |
{ |
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 partial class FooBar | |
{ | |
private int ID { get; set; } | |
private string Something { get; set; } | |
} | |
public partial class FooBar | |
{ | |
public class PropertyAccessExpressions | |
{ |
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 class FooContext : DbContext | |
{ | |
protected override void OnModelCreating(DbModelBuilder modelBuilder) | |
{ | |
AddExplicitMappings(modelBuilder); | |
} | |
private static void AddExplicitMappings(DbModelBuilder modelBuilder) | |
{ | |
var addMethod = typeof (ConfigurationRegistrar) |
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 abstract class BillingDetail | |
{ | |
public int BillingDetailId { get; set; } | |
public string Owner { get; set; } | |
public string Number { get; set; } | |
} | |
[Table("BankAccounts")] | |
public class BankAccount : BillingDetail | |
{ |
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 abstract class BillingDetail | |
{ | |
public int BillingDetailId { get; set; } | |
public string Owner { get; set; } | |
public string Number { get; set; } | |
} | |
public class BankAccount : BillingDetail | |
{ | |
public string BankName { get; set; } |
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 StringExtensions | |
{ | |
public static string ToStringWithSpaces(this string input) | |
{ | |
return Regex.Replace( | |
input, | |
"(?<!^)" + // don't match on the first character - never want to place a space here | |
"(" + | |
" [A-Z][a-z] |" + // put a space before "Aaaa" | |
" (?<=[a-z])[A-Z] |" + // put a space into "aAAA" before the first capital |