Skip to content

Instantly share code, notes, and snippets.

View robertaarcoverde's full-sized avatar

Roberta Arcoverde robertaarcoverde

View GitHub Profile
@robertaarcoverde
robertaarcoverde / gist:5622122
Created May 21, 2013 18:31
performance tracing using the IDisposable pattern and MS Enterprise Library. usage example: using (new PerformanceLogger("some time consuming routine")) { //do something }
public class PerformanceLogger : IDisposable
{
private Stopwatch sw;
private string context;
public PerformanceLogger(string context)
{
this.context = context;
this.sw = Stopwatch.StartNew();
}
@robertaarcoverde
robertaarcoverde / gist:7030402
Created October 17, 2013 19:04
quick function for converting expression strings into objects ex: "Account.Manager.Name", "Roberta" ==> new Account { new Manager { Name = "Roberta" } }
private object Eval(KeyValuePair<string, object> df)
{
var properties = df.Key.Split('.');
object root = Activator.CreateInstance(Assembly.GetExecutingAssembly().GetTypes().First(t => t.Name == properties.First()));
var temp = root;
for (int i = 1; i < properties.Length - 1; i++)
{
var propertyInfo = temp.GetType().GetProperty(properties[i]);
@robertaarcoverde
robertaarcoverde / gist:0bced84ec6e2cb15baeee62ae0b2c6fa
Created February 13, 2017 12:23
Git: stage everything but whitespaces
git diff -w | git apply --cached --ignore-whitespace