Skip to content

Instantly share code, notes, and snippets.

View dotMorten's full-sized avatar
:octocat:

Morten Nielsen dotMorten

:octocat:
View GitHub Profile
@dotMorten
dotMorten / HttpGZipClientHandler.cs
Last active May 8, 2018 19:38
GZip support for PCL HttpClient. Create HttpClient using: HttpClient client = new HttpClient(new HttpGZipClientHandler());
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
namespace SharpGIS.Http
{
public class HttpGZipClientHandler : HttpClientHandler
{
@dotMorten
dotMorten / ARApp.Android.cs
Last active March 16, 2018 16:58
Abstract UrhoSharp AR class
#if __ANDROID__
using Urho;
using System.Linq;
using Com.Google.AR.Core;
using Urho.Droid;
namespace UrhoAR
{
public abstract partial class ARApp : SimpleApplication
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.UI.Core;
using Windows.UI.Xaml.Data;
namespace UniversalTestApp
@dotMorten
dotMorten / Program.cs
Created August 25, 2017 21:47
Slow webserver response test
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace TimeoutTestApp
{
@dotMorten
dotMorten / GpsCoordinateSimulator.cs
Created December 12, 2012 01:43
GeoPositionWatcher for more accurately simulating a GPS device, including change in accuracy, heading, and speed. This code is compatible with WPF, Windows Phone 7 and Windows Phone 8
// GpsCoordinateSimulator.cs:
// WPF: Requires reference to System.Device.dll
using System;
using System.Device.Location;
using System.Windows;
using System.Windows.Threading;
namespace GpsSimulator
{
/// <summary>
@dotMorten
dotMorten / Program.cs
Last active December 8, 2016 20:08
Simple Iotivity Server and Light Resource created using .NET calling into the Iotivity C-API
using System;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
namespace SimpleServerNet
{
class Program
{
private static CancellationTokenSource ct;
@dotMorten
dotMorten / XMLDocumentationStripper.cs
Last active September 14, 2016 17:54
Optimizes XML Doc for intellisense by stripping out internals and remarks from the XML doc
using Mono.Cecil;
using Mono.Cecil.Rocks;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
namespace ConsoleApplication1
{
class Program
{
@dotMorten
dotMorten / .NET Native build errors
Created September 22, 2015 21:18
Has anyone ever seen errors like this?
4>c:\source\Tests\UnitTests.Universal\sg.exe : warning : SG0002 : Cannot generate serialization code for type 'System.Globalization.CompareInfo'
4>c:\source\Tests\UnitTests.Universal\sg.exe : warning : SG0002 : Cannot generate serialization code for type 'System.Globalization.CultureData'
4>c:\source\Tests\UnitTests.Universal\sg.exe : warning : SG0002 : Cannot generate serialization code for type 'System.Globalization.TextInfo'
4>c:\source\Tests\UnitTests.Universal\sg.exe : warning : SG0002 : Cannot generate serialization code for type 'MyProjectNameSpace.MyTypeHere'
4>c:\source\Tests\UnitTests.Universal\sg.exe : warning : SG0002 : Cannot generate serialization code for type 'MyProjectNameSpace.MyTypeHere'
4>C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\IlcInternals.targets(886,5): error : System.ArgumentNullException: Value cannot be null.
4>C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\IlcInternals.targets(886,5): error : Parameter name: key
4>C:\Program Files (x86)\MSBuild\Micro
@dotMorten
dotMorten / MainPage-snippet.xaml
Last active June 23, 2016 21:35
StaggeredGrid
<ItemsControl x:Name="items" Grid.RowSpan="3" ItemsSource="{x:Bind Data}" Background="LightGray">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<local:StaggeredGridPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Margin="5" Background="{Binding Brush}" Height="{Binding Height}">
<TextBlock Text="{Binding Name}" HorizontalAlignment="Center" VerticalAlignment="Center" />
@dotMorten
dotMorten / RandomLocationProvider.cs
Last active December 27, 2015 05:09
A custom location provider that randomly accelerates and changes heading for simple in-house testing of location
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Location;
using System;
using System.Linq;
using System.Threading.Tasks;
#if NETFX_CORE
using Windows.Foundation;
using Windows.UI.Xaml;
#else
using System.Windows.Threading;