Provider | Singleton | Instantiable | Configurable |
---|---|---|---|
Constant | Yes | No | No |
Value | Yes | No | No |
Service | Yes | No | No |
Factory | Yes | Yes | No |
Decorator | Yes | No? | No |
Provider | Yes | Yes | Yes |
This file contains 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 bool SameAs(this BsonDocument source, BsonDocument other, params string[] ignoreFields) | |
{ | |
var elements = source.Elements.Where(x => !ignoreFields.Contains(x.Name)).ToArray(); | |
if (elements.Length == 0 && other.Elements.Where(x => !ignoreFields.Contains(x.Name)).Any()) return false; | |
foreach (var element in source.Elements) | |
{ | |
if (ignoreFields.Contains(element.Name)) continue; | |
if (!other.Names.Contains(element.Name)) return false; | |
var value = element.Value; | |
var otherValue = other[element.Name]; |
This file contains 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
Properties { | |
$Build_dir = Split-Path $psake.build_script_file | |
$Packages_dir = Join-Path $build_dir 'Packages' | |
$MsDeploy_dir = Join-Path $env:ProgramFiles 'IIS\Microsoft Web Deploy' | |
$SiteName = 'www.example.com' | |
$Package = "$SiteName.zip" | |
$Dest = 'hosting.com' | |
$UserName = 'IIS User Name' | |
$Pwd = 'Secret Password' |
Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
This file contains 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
// from http://scratch99.com/web-development/javascript/convert-bytes-to-mb-kb/ | |
function bytesToSize(bytes) { | |
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; | |
if (bytes == 0) return 'n/a'; | |
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); | |
if (i == 0) return bytes + ' ' + sizes[i]; | |
return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i]; | |
}; |
Some snippets for Chrome that I've made or found/modified and thought were useful.
This file contains 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
namespace APP.Domain | |
{ | |
public class FactoryClassMap : BsonClassMap | |
{ | |
public FactoryClassMap(Type classType, IDeserializationFactory factory) : base(classType) | |
{ | |
Func<object> factoryDelegate = factory.Create; | |
MapCreator(factoryDelegate); | |
AutoMap(); | |
} |
This file contains 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 Newtonsoft.Json; | |
using System; | |
using System.Collections.Specialized; | |
using System.Net; | |
using System.Text; | |
//A simple C# class to post messages to a Slack channel | |
//Note: This class uses the Newtonsoft Json.NET serializer available via NuGet | |
public class SlackClient | |
{ |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
This file contains 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
<?xml version="1.0"?> | |
<configuration> | |
<system.web> | |
<compilation debug="true" targetFramework="4.5" /> | |
<httpRuntime targetFramework="4.5" /> | |
</system.web> | |
<system.webServer> | |
<rewrite> | |
<rules> |
OlderNewer