Skip to content

Instantly share code, notes, and snippets.

@ejsmith
ejsmith / each_with_index.js
Created December 11, 2012 16:53 — forked from dsci/each_with_index.js
each_with_index handlebars helper, adds an {{index}} prop accessible from within the block
// {{#each_with_index records}}
// <li class="legend_item{{index}}"><span></span>{{Name}}</li>
// {{/each_with_index}}
Handlebars.registerHelper("each_with_index", function(array, fn) {
var buffer = "";
for (var i = 0, j = array.length; i < j; i++) {
var item = array[i];
// stick an index property onto the item, starting with 1, may make configurable later
@ejsmith
ejsmith / each_with_index.coffee
Created December 11, 2012 16:56 — forked from burin/each_with_index.coffee
each_with_index handlebars helper, adds an {{index}} prop accessible from within the block
Handlebars.registerHelper 'each_with_index', (array, fn) ->
buffer = ''
for i in array
item = i
item.index = _i
buffer += fn(item)
buffer
@ejsmith
ejsmith / gist:6081109
Created July 25, 2013 15:51
Exceptionless config file samples
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="exceptionless" type="Exceptionless.Configuration.ExceptionlessSection, Exceptionless" />
</configSections>
<!-- attribute names are cases sensitive, must specify a path that you have write access to -->
<exceptionless apiKey="API_KEY_HERE" enableLogging="true" logPath="C:\log.txt" />
...
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
@ejsmith
ejsmith / gist:6082335
Last active December 20, 2015 05:59
Sample console app for Exceptionless
using System;
using CodeSmith.Core.Helpers;
using Exceptionless;
namespace SampleConsole {
internal class Program {
private static void Main() {
ExceptionlessClient.Current.Startup();
SendOne();
ExceptionlessClient.Current.ProcessQueue();
Bootstrap.Run(config => {
config.IncludeAssemblyFor<Type>();
config.IncludeAssembly(Assembly);
config.UseAutoMapper(mapper => mapper.UseSomeOption());
config.UseAutofac();
config.LogToConsole();
};
Bootstrap.Run(config =>
config
{
"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-*",
@ejsmith
ejsmith / Program.cs
Last active August 29, 2015 14:03
Examples of using the Exceptionless 2.0 client
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();
@ejsmith
ejsmith / EmptyCollectionContractResolver.cs
Created August 6, 2014 16:41
EmptyCollectionContractResolver
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) {
{
"title": "Exceptionless",
"services": {
"query": {
"list": {
"0": {
"id": 0,
"color": "#7EB26D",
"alias": "",
"pin": false,
@ejsmith
ejsmith / gist:1b5f03f676fcd539f6cd
Last active January 25, 2016 22:13
session tracking
-------------------------------------
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()