Skip to content

Instantly share code, notes, and snippets.

View migrate.ps1
param(
[Parameter(Mandatory=$true)]
[string]$TargetFolder
)
function CopyPackageReferences($project, $packagesConfigPath) {
$packagesConfig = [xml](Get-Content $packagesConfigPath -Encoding UTF8)
$itemGroup = $project.CreateElement("ItemGroup")
$project.Project.AppendChild($itemGroup) | Out-Null
Write-Verbose "Found $($packagesConfig.packages.package.Length) packages to copy"
@ejsmith
ejsmith / containers.md
Created Oct 25, 2016
Benefits of using Docker Containers
View containers.md
  • Package format that not only contains our code, but also the entire definition of the OS that runs the code which means you get guaranteed consistency in your deployments
  • Easy deployments
    • Just tell docker to run an image from our build artifact registry
  • Simple build promotion
  • Easy scaling
  • Run console workers that will automatically be restarted based on a restart policy
  • Cheaper because we can pack more services onto a box and utilize resources more efficiently while still providing isolation and cpu / memory constraints
  • Can scale each worker independently
View gist:7beddda6eb23a55aa66122ffa08572b9
log : Restoring packages for /Users/ejsmith/.vscode-insiders/extensions/ms-vscode.csharp-1.0.1-rc2/coreclr-debug/project.json...
info : Committing restore...
log : Writing lock file to disk. Path: /Users/ejsmith/.vscode-insiders/extensions/ms-vscode.csharp-1.0.1-rc2/coreclr-debug/project.lock.json
log : /Users/ejsmith/.vscode-insiders/extensions/ms-vscode.csharp-1.0.1-rc2/coreclr-debug/project.json
log : Restore completed in 918ms.
NuGet Config files used:
/Users/ejsmith/.vscode-insiders/extensions/ms-vscode.csharp-1.0.1-rc2/coreclr-debug/NuGet.config
Feeds used:
View gist:1b5f03f676fcd539f6cd
-------------------------------------
Session Tracking
-------------------------------------
Exceptionless can also track user sessions which enables powerful application analytics.
Session tracking can be enabled by simply adding this line to the startup of your application:
ExceptionlessClient.Default.Configuration.UseSessions()
View Exceptionless.json
{
"title": "Exceptionless",
"services": {
"query": {
"list": {
"0": {
"id": 0,
"color": "#7EB26D",
"alias": "",
"pin": false,
@ejsmith
ejsmith / EmptyCollectionContractResolver.cs
Created Aug 6, 2014
EmptyCollectionContractResolver
View EmptyCollectionContractResolver.cs
class EmptyCollectionContractResolver : DefaultContractResolver {
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) {
JsonProperty property = base.CreateProperty(member, memberSerialization);
Predicate<object> shouldSerialize = property.ShouldSerialize;
property.ShouldSerialize = obj => (shouldSerialize == null || shouldSerialize(obj)) && !IsEmptyCollection(property, obj);
return property;
}
private bool IsEmptyCollection(JsonProperty property, object target) {
@ejsmith
ejsmith / Program.cs
Last active Aug 29, 2015
Examples of using the Exceptionless 2.0 client
View Program.cs
var client = new ExceptionlessClient(config => {
// Set your API key.
config.ApiKey = "API_KEY_HERE";
// Send events to your own free Exceptionless server install.
config.ServerUrl = "https://exceptionless.myorg.com";
// Read config settings from attributes.
config.ReadFromAttributes();
View project.json
{
"version": "0.1-alpha-*",
"compilationOptions": {
"warningsAsErrors": true
},
"dependencies": {
"Microsoft.AspNet.Http": "0.1-alpha-*",
"Microsoft.AspNet.Mvc.Common": "",
"Microsoft.AspNet.Mvc.ModelBinding": "",
"Microsoft.AspNet.Routing": "0.1-alpha-*",
View Bootstrap.cs
Bootstrap.Run(config => {
config.IncludeAssemblyFor<Type>();
config.IncludeAssembly(Assembly);
config.UseAutoMapper(mapper => mapper.UseSomeOption());
config.UseAutofac();
config.LogToConsole();
};
Bootstrap.Run(config =>
config
@ejsmith
ejsmith / gist:6082335
Last active Dec 20, 2015
Sample console app for Exceptionless
View gist:6082335
using System;
using CodeSmith.Core.Helpers;
using Exceptionless;
namespace SampleConsole {
internal class Program {
private static void Main() {
ExceptionlessClient.Current.Startup();
SendOne();
ExceptionlessClient.Current.ProcessQueue();