Skip to content

Instantly share code, notes, and snippets.

View dphoebus's full-sized avatar
😏

Daniel Phoebus dphoebus

😏
  • CaptiveAire, Inc.
View GitHub Profile
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];
@dphoebus
dphoebus / angularjs-providers-explained.md
Created November 18, 2015 20:30 — forked from demisx/angularjs-providers-explained.md
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
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

Constant

@dphoebus
dphoebus / Deploy.ps1
Created February 23, 2016 13:25 — forked from rarous/Deploy.ps1
Script for packaging and deployment of ASP.NET applications to IIS via Web Deploment Tools
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'
@dphoebus
dphoebus / README.md
Created March 4, 2016 18:51 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@dphoebus
dphoebus / bytesToSize.js
Created May 27, 2016 20:12 — forked from lanqy/bytesToSize.js
JavaScript To Convert Bytes To MB, KB, Etc
// 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];
};
@dphoebus
dphoebus / AngularJS Snippets.md
Created November 30, 2016 06:52 — forked from kentcdodds/AngularJS Snippets.md
AngularJS Chrome DevTools Snippets

Angular Snippets

Some snippets for Chrome that I've made or found/modified and thought were useful.

demo

@dphoebus
dphoebus / DomainModelRegistration.cs
Created August 1, 2017 19:22 — forked from andreabalducci/DomainModelRegistration.cs
mapping custom factory for mongodb c# driver deserialization
namespace APP.Domain
{
public class FactoryClassMap : BsonClassMap
{
public FactoryClassMap(Type classType, IDeserializationFactory factory) : base(classType)
{
Func<object> factoryDelegate = factory.Create;
MapCreator(factoryDelegate);
AutoMap();
}
@dphoebus
dphoebus / SlackClient.cs
Created August 8, 2017 21:03 — forked from jogleasonjr/SlackClient.cs
A simple C# class to post messages to a Slack channel. You must have the Incoming WebHooks Integration enabled. This class uses the Newtonsoft Json.NET serializer available via NuGet. Scroll down for an example test method and a LinqPad snippet. Enjoy!
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
{
@dphoebus
dphoebus / introrx.md
Created August 11, 2017 07:15 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@dphoebus
dphoebus / web.config
Created August 21, 2017 17:21 — forked from emyann/web.config
ASP.NET web.config configuration for Single Page Application (AngularJS) running on IIS with OwinHttpHandler
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.webServer>
<rewrite>
<rules>