Skip to content

Instantly share code, notes, and snippets.

@zachbonham
zachbonham / oprop.snippet.xml
Created October 20, 2009 01:12
'Observable' property snippet
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>oprop</Title>
<Shortcut>oprop</Shortcut>
<Description>Code snippet for an automatically implemented observable property for any class that implements INotifyPropertyChanged.</Description>
<Author>Your name here</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
@zachbonham
zachbonham / msmq.vbs
Created October 27, 2009 12:14
msmb.vbs - Manage private MSMQ queues
' http://zachbonham.blogspot.com
'
' use at your own risk. :)
'
' assuming that your default scripting engine is CScript.exe
' cscript //H:CScript
'
'
' Assuming administrator priviledges
'
@zachbonham
zachbonham / getsmarx.rb
Created April 9, 2010 02:33
1:1 between ruby and C# for getsmarx
require 'rexml/document'
require 'rexml/xpath'
require 'net/http'
require 'net/https'
require 'uri'
include REXML
url = URI.parse('http://annoysmarx.cloudapp.net/')
using System;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Xml.Linq;
namespace getsmarx
{
public static class StringExtensions
{
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>tm</Title>
<Shortcut>tm</Shortcut>
<Description>Code snippet for an automatically create a method decorated with [TestMethod] attribute.</Description>
<Author>Zach Bonham</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
@zachbonham
zachbonham / GetProjects.cs
Created December 24, 2010 15:25
Custom MSBuild Task to return ProjectItems in a Visual Studio Solution
public class GetProjects : Task
{
[Required]
public string SolutionPath { get; set; }
[Output]
public ITaskItem[] Projects { get; set; }
public override bool Execute()
{
@zachbonham
zachbonham / msmq.vbs
Created June 16, 2011 17:26
Manage Msmq Queues
' http://zachbonham.blogspot.com
'
' use at your own risk. :)
'
' assuming that your default scripting engine is CScript.exe
' cscript //H:CScript
'
'
' Assuming administrator priviledges
'
@zachbonham
zachbonham / remoteupdate.ps1
Created February 16, 2012 16:07
Remote execution of start-bitstransfer
$cred = get-credential
$session = new-pssession -computername fqdn -credential $cred
invoke-command { import-module bitstransfer; start-bitstransfer -source \\fnp\package_1234.zip -destination c:\temp\package1234.zip } -session $session -asjob -jobname "update"
receive-job $jobid
<#
The remote use of BITS is not supported. For more information about BITS, see the MSDN documentation at http://go.microsoft.com/FWLINK/?LinkId=140888.
@zachbonham
zachbonham / ServerRepository.js
Created April 28, 2012 12:55
sample type declaration in javascript
function ServerRepository(connection)
{
var servers = [
{ name : "testin 1"},
{ name: "testin 2"}
];
var self = this;
self.connection = connection;
@zachbonham
zachbonham / remote.ps1
Created May 8, 2012 14:57
invoke-remoteexpression
function invoke-remoteexpression($computer = “\\$ENV:ComputerName”, [ScriptBlock] $expression = $(throw “Please specify an expression to invoke.”), [switch] $noProfile , $username, $password)
{
$commandLine = “echo . | powershell “
if($noProfile)
{
$commandLine += “-NoProfile “