Skip to content

Instantly share code, notes, and snippets.

View rgregg's full-sized avatar

Ryan Gregg rgregg

  • Microsoft
  • Seattle, WA
View GitHub Profile
@rgregg
rgregg / gist:5cf07a3f1cbfa8dc6cdf
Created May 24, 2014 22:29
Retain/Release Debugging
- (id) retain
{
NSLog(@"%@ retain: count: %d + 1", self, [self retainCount]);
return [super retain];
}
- (void) release
{
NSLog(@"%@ release: count: %d - 1", self, [self retainCount]);
[super release];
@rgregg
rgregg / FormMicrosoftAccountAuth.cs
Last active September 27, 2021 23:59
Easy OAuth form for Microsoft Account authentication
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
@rgregg
rgregg / onedrive-bits-upload.md
Last active May 26, 2022 09:17
OneDrive Large File Upload API

Uploading Large Files

NOTICE: The OneDrive API now has native supported for large file uploads. Instead of using BITS, consider using the OneDrive API upload method instead!

Note This is preliminary documentation and is subject to change as we evolve the OneDrive API.

OneDrive handles uploading large files by supporting the BITS protocol.

@rgregg
rgregg / FancyConsole.cs
Last active February 25, 2022 23:19
FancyConsole
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
public class FancyConsole
{
private static string _logFileName;
@rgregg
rgregg / MsaForStoreApps.cs
Last active February 25, 2022 23:19
Windows Store App Sign-in for OneDrive SDK
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Windows.Security.Authentication.OnlineId;
namespace OneDrive
{
public class MsaForStoreApps
{
@rgregg
rgregg / OneDriveError.cs
Created June 19, 2015 20:39
OneDrive Error Code Handling
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Microsoft.OneDrive
{
public class OneDriveError
@rgregg
rgregg / Program.cs
Created June 23, 2015 05:55
OneDrive View.Changes Experiment Program
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using Newtonsoft.Json;
using System.IO;
// Requires Newtonsoft.Json and Nito.AsyncEx NuGet Packages
@rgregg
rgregg / QuickXorHash.cs
Last active October 12, 2023 11:54
Old: Sample code to generate the OneDrive Quick XOR Hash value for a file. The official documentation for the QuickXorHash is available here: https://learn.microsoft.com/en-us/onedrive/developer/code-snippets/quickxorhash?view=odsp-graph-online
// ------------------------------------------------------------------------------
// Copyright (c) 2016 Microsoft Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
@rgregg
rgregg / notification-body.json
Last active February 25, 2022 23:17
Webhook notification body template for AppVeyor to Microsoft Teams
{
{{#passed}}
"title": "Build {{projectName}} {{buildVersion}} completed",
"themeColor": "5FE35F",
{{/passed}}
{{#failed}}
"title": "Build {{projectName}} {{buildVersion}} failed",
"themeColor": "FC5C3C",
{{/failed}}
"text": "Commit [{{commitId}}](https://github.com/{{repositoryName}}/commit/{{commitId}}) by {{committerName}} on {{commitDate}}: {{commitMessage}}",
@rgregg
rgregg / extract-license.md
Created July 19, 2018 19:16
How to extract LICENSES from docker image
  1. Start the container

    $ docker run -d {docker image}
    f05ad96e2570da12c27784d0d4752c99269e25713bb8565c287eb52d8f97573f
  2. Extract the license from the container to standard out