Skip to content

Instantly share code, notes, and snippets.

Oren Novotny onovotny

Block or report user

Report or block onovotny

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View AuthenticatedHttpClientHandler.cs
class AuthenticatedHttpClientHandler : HttpClientHandler
private readonly Func<Task<string>> getToken;
public AuthenticatedHttpClientHandler(Func<Task<string>> getToken)
if (getToken == null) throw new ArgumentNullException("getToken");
this.getToken = getToken;
onovotny / WImageRenderer.cs
Last active Aug 29, 2015
Image Renderer for WP8 Images
View WImageRenderer.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using News.Controls;
View Update-Version.ps1
[string]$pathToSearch = $env:BUILD_SOURCESDIRECTORY,
[string]$buildNumber = $env:BUILD_BUILDNUMBER
$buildPattern = "\d+\.\d+\.\d+\.\d+"
if ($buildNumber -match $buildPattern -ne $true) {
onovotny / Util.cs
Created Oct 15, 2012
TimeZone Conversion for NetCore - Obsolete - Use the WinRTTimeZones Nuget package for the latest
View Util.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
// OBSOLETE!!! Use the Nuget WinRTTimeZones package for the latest or
// get the code at
namespace TimeZoneUtils
View build.proj
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="UpdateVersion" xmlns="">
<Import Project="$(MSBuildProjectDirectory)\Build.tasks" />
<!-- Setup configuration variables -->
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)..\</SolutionDir>
<Configuration Condition="'$(OS)' == 'Windows_NT' And '$(Configuration)' == ''">Debug</Configuration>
onovotny / gist:5906841
Created Jul 2, 2013
UI thread for store
View gist:5906841
public IAsyncAction ExecuteOnUIThread<TException>(DispatchedHandler action)
return CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, action);
onovotny / CollectionViewSourceFactory.cs
Last active Feb 17, 2017
Pattern to use collection views in a portable class library with WPF and WinRT XAML. The issue is that while WPF and WinRT both have the CollectionView concepts, they're in different namespaces, so you can't use them in a PCL ViewModel. This wrapper allows you to wrap a collection view source and manipulate it in a PCL for navigation, etc. This …
View CollectionViewSourceFactory.cs
// These classes would go in your PCL
public interface IWrappedCollectionView
bool MoveCurrentTo(object item);
bool MoveCurrentToPosition(int position);
bool IsCurrentAfterLast { get; }
bool MoveCurrentToFirst();
bool IsCurrentBeforeFirst { get; }
bool MoveCurrentToLast();
onovotny /
Created Mar 29, 2017
B2B Invites to VSTS

To invite external users into VSTS, we first need to add them to the AAD directory. We can do this today with PowerShell, but you need the right module installed.

Make sure you have the AzureADPreview module installed.

If you need it, from an admin powershell prompt, you can use: Install-Module AzureADPreview

To update it later: update-module AzureAdPreview To remove it once it hits the stable module: uninstall-module AzureAdPreview

View job.cs
internal class Job : IDisposable
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
static extern IntPtr CreateJobObject(IntPtr a, string lpName);
static extern bool SetInformationJobObject(IntPtr hJob, JobObjectInfoType infoType, IntPtr lpJobObjectInfo, UInt32 cbJobObjectInfoLength);
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool AssignProcessToJobObject(IntPtr job, IntPtr process);
View AadUserService.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web;
using IdentityServer3.Core.Models;
using IdentityServer3.Core.Services;
You can’t perform that action at this time.