Skip to content

Instantly share code, notes, and snippets.

View ebdrup's full-sized avatar

Allan Ebdrup ebdrup

View GitHub Profile
@ebdrup
ebdrup / logInfo.js
Last active August 29, 2015 13:56
Logging info with errors in Muscula
//This information will be logged and aggregated with your errors
//It will be shown on the details of each error group
Muscula.info = {
email: "email@mydomain.com",
sessionId: 42,
lovesDogs: true
//and your own properties and values
};
@ebdrup
ebdrup / test.js
Created June 23, 2013 16:20
Logging your own error with Muscula
try {
//your code, that may cause an error...
} catch(ex){
Muscula.errors.push(ex); //Log error to Muscula
}
@ebdrup
ebdrup / bashrc.md
Last active December 17, 2015 19:38
Setting up .bashrc to run tests with npm test before git push.

Github does not provide pre-receive hooks, so in order to ensure that all tests are run before a push is accepted, you should add the following to your %HOME%/.bashrc file (node.js example - something similar can be done for .Net):

# begin: automatic run of tests
GIT_LOCATION=$(which git)
git () {
  if [ "$1" == "push" ] && [ -f package.json ] ; then
		if [[ "$*" == *\ --no-verify* ]] ; then
			echo "skipping tests..."
 # skip the testing and remove the custom --no-verify option before calling git
@ebdrup
ebdrup / JSON.cs
Created March 10, 2013 17:05
JSON mixin like underscore extend for dotNet (works on JSON strings not Objects). Relies on Newtonsoft.Json from http://json.net
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Newtonsoft.Json;
namespace CopenhagenCode
{
public class JSON