Skip to content

Instantly share code, notes, and snippets.


Michael Phillips idiotandrobot

View GitHub Profile
$ git clone
View win-update-powershell.ps1
iex "& { $(irm } -UseMSI"
View nuget-restore.ps1
if (Test-Path "nuget.exe") {
Invoke-Expression "./nuget restore"
elseif((Get-Command "nuget" -ErrorAction SilentlyContinue) -ne $null) {
nuget restore
else {
"Nuget was not found and is required to run bootstrap.ps1. Download and retry now?"
choice /c yn
if ($LASTEXITCODE -eq 1) {
View GetLatestVersion.cs
using Newtonsoft.Json;
public static async Task<Version> GetLatestVersion()
const string latestReleaseRequestUrl =
string versionStr;
idiotandrobot / Clear-NuGet-Cache.ps1
Last active December 22, 2018 16:53 — forked from thoemmi/Clear-NuGetCache.ps1
Script to delete old NuGet packages from the default global packages folder which haven't been accessed for 150 days
View Clear-NuGet-Cache.ps1
[int]$CutoffDays = 150
$cutoffDate = (Get-Date).AddDays(-$CutoffDays)
# get path to cached NuGet packages
$nugetCachePath = .\Get-Nuget-Cache-Path.ps1
idiotandrobot / dosomethingasync.cs
Last active July 21, 2018 08:13
async/await in Windows Runtime Components
View dosomethingasync.cs
public async Task DoSomethingAsync()
await SomethingElseAsync();
public async Task<Foo> DoAnotherAsync()
return await ReturnAFooAsync();
View lists.txt
View linq_expression.cs
// IObservable<byte> (socket.Receiver) to IObservable<string> (Receiver)
Receiver = from header in socket.Receiver.Buffer(sizeof(int))
let length = BitConverter.ToInt32(header.ToArray(), 0)
let body = socket.Receiver.Take(length)
select encoding.GetString(body.ToEnumerable().ToArray());
idiotandrobot / appbarbutton.xaml
Created January 29, 2018 17:28
AppBarButton focus
View appbarbutton.xaml
<AppBarButton AllowFocusOnInteraction="True"/>