Skip to content

Instantly share code, notes, and snippets.

View adamsteinert's full-sized avatar

Adam Steinert adamsteinert

View GitHub Profile
@adamsteinert
adamsteinert / .gitignore
Created April 30, 2015 18:15
.gitignore file
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
# Usage: .\DisableNuGetPackageRestore.ps1 C:\Path\To\Solution.sln
# Get the path that the user specified when calling the script
$solution = $args[0]
$solutionPath = Split-Path $solution -Parent
$solutionName = Split-Path $solution -Leaf
# Delete the .nuget directory and all contents
Remove-Item (Join-Path $solutionPath ".nuget") -Force -Recurse -ErrorAction 0
@adamsteinert
adamsteinert / NetFxGetJsonPayload.cs
Created March 17, 2014 20:02
Get a ResponseBase<T> from a web service via JSON.
using System.Net;
using Newtonsoft.Json.Linq;
//...
using (var w = new WebClient())
{
var json_data = string.Empty;
var fullUrl = commandUrl + key;
@adamsteinert
adamsteinert / .hgignore
Last active August 29, 2015 13:56
Modified gitignore for .hgignore with minor changes.
syntax: glob
## Slightly modified from: Github default VS ignore:
## https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
@adamsteinert
adamsteinert / Toaster.cs
Last active December 23, 2015 16:39
Simple text toast notification for windows store apps.
// Toast Types: http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.notifications.toasttemplatetype.aspx
// Enable in appxmanifest!
// Toasts won't show in simulator.
// More info: http://www.jeffblankenburg.com/2012/11/10/31-days-of-windows-8-day-10-toast-notifications
public class Toaster
{
public static void SendTextToast(string text)
{
var template = ToastTemplateType.ToastText01;
var doc = ToastNotificationManager.GetTemplateContent(template);
public class BooleanToVisibileHiddenConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var boolean = false;
if (value is bool) boolean = (bool)value;
return boolean ? Visibility.Visible : Visibility.Hidden;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
/// <summary>
/// A simple class to encapsulate the functionality for a restartable timer. When Restart is called the timer is stopped
/// so the time interval starts again from that point.
/// </summary>
public class DelayTimer
{
DispatcherTimer _timer;
Action _tickAction;
#region -- Events ---