Skip to content

Instantly share code, notes, and snippets.

@rdavisau
rdavisau / dark-style-from-vs-2015.json
Created Feb 25, 2016
dark-style-from-vs-2015.json
View dark-style-from-vs-2015.json
{
"name":"dark-style-from-vs-2015",
"version":"1.0",
"description":"Imported color scheme",
"originator":"Imported from /Users/rdavis/Library/XamarinStudio-5.0/HighlightingSchemes/dark-style-from-vs-2015.vssettings",
"colors":[
{"name": "Background(Read Only)", "color":"#1E1E1E" },
{"name": "Search result background", "color":"#005F60" },
{"name": "Search result background (highlighted)", "color":"#007F80" },
{"name": "Fold Square", "color":"#A5A5A5" },
View BackgroundImagePage.cs
public class BackgroundImagePage : ContentPage
{
public BackgroundImagePage() =>
Content = new Grid // this is the outer grid
{
Children =
{
// this image fills the outer grid and sits behind the 'original' content
new Image { Source = new Uri("https://tinyurl.com/msdevbg"), Aspect = Aspect.AspectFill },
@rdavisau
rdavisau / NSNotificationCenterExtensions.cs
Created Dec 25, 2016
Provides `IObservable` semantics for `NSNotificationCenter` subscriptions
View NSNotificationCenterExtensions.cs
public static class NSNotificationCenterExtensions
{
public static IObservable<NSNotification> ObserveNotification(this NSNotificationCenter notificationCenter, NSString notificationKey) =>
Observable.Create<NSNotification>(obs =>
{
var nsObserver = notificationCenter.AddObserver(notificationKey, obs.OnNext);
return Disposable.Create(() => notificationCenter.RemoveObserver(nsObserver));
});
}
View internet-is-down.linq
<Query Kind="Program">
<Reference>&lt;RuntimeDirectory&gt;\System.Windows.Forms.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\System.Security.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\System.Configuration.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\Accessibility.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\System.Runtime.Serialization.Formatters.Soap.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\System.Deployment.dll</Reference>
<NuGetReference>DynamicLINQ</NuGetReference>
<NuGetReference>DynamicQuery</NuGetReference>
<NuGetReference>Newtonsoft.Json</NuGetReference>
View EnumerableStream.cs
/// <summary>
/// Provides a convenience method for constructing an EnumerableStream<T>.
/// </summary>
public static class EnumerableStream
{
public static EnumerableStream<T> Create<T>(IEnumerable<T> source, Func<T, List<byte>> serializer)
{
return new EnumerableStream<T>(source, serializer);
}
}