Skip to content

Instantly share code, notes, and snippets.

@davidfowl
davidfowl / Example1.cs
Last active March 28, 2024 20:36
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)

Source Code Typography

Presentation: http://www.slideshare.net/vancura/source-code-typography

Quotes

Dumb quotes (also known as straight quotes) are straight and vertical. Proper typography never uses straight quotes. They are left over from the age of typewriters, and their only modern use is for coding.

@nicktoumpelis
nicktoumpelis / repo-rinse.sh
Created April 23, 2014 13:00
Cleans and resets a git repo and its submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
@Clancey
Clancey / gist:7610128
Last active December 29, 2015 03:49
Background Downloader. Has the same API as WebClient but uses the underlying NSUrlRequest to download in the background.
public class BackgroundDownload
{
public BackgroundDownload ()
{
}
NSUrlSessionDownloadTask downloadTask;
static NSUrlSession session;
public async Task DownloadFileAsync(Uri url, string destination)
{
if (downloadTask != null)
@nicwise
nicwise / gist:7026601
Created October 17, 2013 15:07
using async/await and a task completion source to work with NavigationController etc.
//start with DoAdd, which comes off a button push.
// it does pop up one screen, then another one, which is not ideal,
// but it wouldn't be hard to adapt.
async void DoAdd ()
{
var camera = await PickCameraForLoad ();
if (camera != null)
{
@brentsimmons
brentsimmons / gist:5810992
Last active January 3, 2021 02:22
Detect a tap on a URL inside a UITextView. Note: the rs_links method isn't included -- you'll need something that takes text and returns an array of detected links. This gist just demonstrates walking through the UITextView characters.
@implementation UITextView (RSExtras)
static BOOL stringCharacterIsAllowedAsPartOfLink(NSString *s) {
/*[s length] is assumed to be 0 or 1. s may be nil.
Totally not a strict check.*/
if (s == nil || [s length] < 1)
return NO;

This post is to explain how to setup and use NuGet in Xamarin Studio and use NuGet packages in your Xamarin.Android project. I'll also explain how to create NuGet packages for Xamarin.Android too.

NuGet, since version 2.5, supports Xamarin.Android and Xamarin.iOS as its "target framework", as well as other targets such as .NET 4.x, Silverlight, Windows Phone and so on.

The same should apply to Xamarin.iOS, so just replace "Android" part with "iOS".

@lobrien
lobrien / gist:5250556
Created March 27, 2013 00:24
Video Capture in MonoTouch
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.Drawing;
using MonoTouch.CoreGraphics;
using MonoTouch.CoreAnimation;
using MonoTouch.AVFoundation;
@praeclarum
praeclarum / Layout.cs
Created March 16, 2013 05:23
A C# syntax for NSLayoutConstraints.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using MonoTouch.UIKit;
namespace Async.iOS
{
public static class Layout
{
@anaisbetts
anaisbetts / release.md
Last active December 14, 2015 19:58
ReactiveUI 4.5.0 Release Notes

Xamarin.iOS and Xamarin.Mac support

This release brings initial support for the latest Xamarin.Mac and Xamarin.iOS. Using ReactiveUI and Xamarin Studio, you can write cross-platform ViewModels and Model classes and bind them to Views using the same RxUI 4.x binding syntax.

  • ReactiveUI knows how to bind to Cocoa objects using Key-Value Observing
  • DeferredScheduler automatically runs code on the Cocoa main runloop