Skip to content

Instantly share code, notes, and snippets.

View vcsjones's full-sized avatar

Kevin Jones vcsjones

View GitHub Profile
public static void SafeInvoke(this Action act)
{
if (act != null)
{
act();
}
}
@vcsjones
vcsjones / gist:718189
Created November 27, 2010 19:24
WP7 Zip
//Throws exception if number of items in the collection are different.
public static IEnumerable<R> Zip<T, U, R>(this IEnumerable<T> first, IEnumerable<U> second, Func<T, U, R> selector)
{
var enumerator1 = first.GetEnumerator();
var enumerator2 = second.GetEnumerator();
while (true)
{
var move1 = enumerator1.MoveNext();
var move2 = enumerator2.MoveNext();
if (move1 != move2)
@vcsjones
vcsjones / IoC.cs
Created November 26, 2010 01:03
WP7 IoC
public static partial class IoC
{
private static readonly Dictionary<Type, Type> _registration = new Dictionary<Type, Type>();
private static readonly Dictionary<Type, object> _rot = new Dictionary<Type, object>();
private static readonly object[] _emptyArguments = new object[0];
private static readonly object _syncLock = new object();
static partial void RegisterAll();
static IoC()
// Written for .NET 3.5.
[DataContract]
public class JSONObject
{
/// <summary>
/// This is how you can escape a keyword as an identifier.
/// </summary>
[DataMember]
public string @public
{
using System.Threading;
using System.Windows;
using System.Windows.Threading;
namespace BorderTest
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
$URI = "https://myserver/webservices/sswebservice.asmx" #The URI of the webservice
$templateName = "File Storage" #The name of the secret template we are going to use.
$username = "myusername"
$domain = "" #Leave empty if you aren't using domain accounts
$password = "mypassword"
$organizationCode = "" #Leave empty unless you are using Secret Server Online
$pathToFile = "C:\Users\My Account\Desktop\input.txt" #The path to the file we are going to upload.
$maxFieldSize = 1991
$secretName = "My New File 2"