Skip to content

Instantly share code, notes, and snippets.

View MatthewSteeples's full-sized avatar

Matthew Steeples MatthewSteeples

View GitHub Profile
@MatthewSteeples
MatthewSteeples / EnumerableToTextConverter.cs
Created October 17, 2012 13:10
ValueConverter to convert an IEnumerable of anything into a string with custom separator
using System;
using System.Collections;
using System.Linq;
using System.Windows.Data;
namespace LedgerscopeApplication.ValueConverters
{
public class EnumerableToTextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
@MatthewSteeples
MatthewSteeples / gist:4279019
Created December 13, 2012 19:26
Recursively update NuGet executable
gci -recurse -filter nuget.exe | ForEach { start-process $_.FullName -ArgumentList "update -self" }
@MatthewSteeples
MatthewSteeples / gist:5588087
Created May 15, 2013 22:56
Code to rename namespaces from compiled assemblies using Mono.Cecil
using Mono.Cecil;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace CecilTest
$version = "Intuit.Ipp.V3."
gci |
%{
$newName = $_.Name.Replace("Intuit.Ipp.", $version)
mv $_.Name $newName
}
gci -Filter *.dll |
%{
@MatthewSteeples
MatthewSteeples / gist:5768974
Created June 12, 2013 20:49
Read through properties in a class and find out if they depend on any other properties in the same class
using Mono.Cecil;
using Mono.Cecil.Cil;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace ConsoleApplication1
{
class Program
{
@MatthewSteeples
MatthewSteeples / linqpad.cs
Created June 19, 2013 15:49
Pull Skype chat history out into XML and then query it using LinqPad
var xml = XElement.Load(@"C:\users\matthew\desktop\query.xml");
var names = new string[] { "" }; //Full names of participants to look for
var messages = xml.Elements("Table")
.Where(a => names.Any(a.Element("participants").Value.Split(' ').Contains))
.Where(a => a.Element("body_xml") != null)
.Where(a => a.Element("author") != null)
.Select(a => new
{
@MatthewSteeples
MatthewSteeples / gist:5888722
Created June 28, 2013 22:40
Build 2003 XML reader
var xml = XElement.Load(@"C:\users\matthew\desktop\wmvhigh.xml");
//xml.Element("channel").Elements("item").Dump();
xml.Element("channel").Elements("item")
.Select(a => new
{
Title = a.Element("title").Value,
Url = new Uri(a.Element("enclosure").Attribute("url").Value)
})
@MatthewSteeples
MatthewSteeples / SeleniumLog
Last active December 19, 2015 09:29
Automated Test
Started ChromeDriver (v2.0) on port 53252
[0.971][INFO]: received WebDriver request: GET /status
[0.972][INFO]: sending WebDriver response: 200 {
"sessionId": "",
"status": 0,
"value": {
"build": {
"version": "alpha"
},
"os": {
@MatthewSteeples
MatthewSteeples / gist:5997144
Last active December 19, 2015 18:18
Delete SqlWorkflowInstanceStore entries
delete from [System.Activities.DurableInstancing].InstanceMetadataChangesTable
delete from [System.Activities.DurableInstancing].InstancePromotedPropertiesTable
delete from [System.Activities.DurableInstancing].InstancesTable
delete from [System.Activities.DurableInstancing].KeysTable
delete from [System.Activities.DurableInstancing].LockOwnersTable
delete from [System.Activities.DurableInstancing].RunnableInstancesTable
delete from [System.Activities.DurableInstancing].ServiceDeploymentsTable
@model DateTime?
@{
string name = ViewData.TemplateInfo.HtmlFieldPrefix;
string id = name.Replace(".", "_");
bool monthEndOnly = ViewBag.MonthEndOnly ?? false;
}
@Html.TextBoxFor(model => model, new { style = "DatePicker" })
<i class="icon-calendar"></i>