This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading; | |
using System.Windows; | |
using System.Windows.Threading; | |
namespace BorderTest | |
{ | |
/// <summary> | |
/// Interaction logic for MainWindow.xaml | |
/// </summary> | |
public partial class MainWindow : Window |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void SafeInvoke(this Action act) | |
{ | |
if (act != null) | |
{ | |
act(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RequireTargetProcessNumber : PreCommitHook | |
{ | |
protected override bool HandleHookEvent(ITransactionInfo commit) | |
{ | |
string commitMessage = commit.LogMessage; | |
if (!HasTargetProcessNumber(commitMessage)) | |
{ | |
this.Context.Output.WriteError("TargetProcess Number was not specified in commit message."); | |
return false; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ISession mySession = //Get your session object. | |
var myUsers = from user in mySession.Query<User>() where user.Name == "Kevin" select user; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var timer = new System.Timers.Timer(2){AutoReset = false, Enabled = false}) | |
{ | |
using (var latch = new ManualResetEventSlim(false)) | |
{ | |
timer.Elapsed += (a, o) => latch.Set(); | |
timer.Start(); | |
latch.Wait(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var foo = (MyType<string>) "cat"; | |
} | |
} | |
public class MyType<t> | |
{ |
OlderNewer