Skip to content

Instantly share code, notes, and snippets.

@rid00z
rid00z / ViewController.cs
Created February 20, 2019 06:13
ARKit Xamarin
using System;
using System.Collections.Generic;
using System.Linq;
using ARKit;
using ARKitExample.Nodes;
using Foundation;
using SceneKit;
using UIKit;
namespace ARKitExample
public class Coord
{
public double lon { get; set; }
public double lat { get; set; }
}
public class Weather
{
public int id { get; set; }
public string main { get; set; }
@rid00z
rid00z / AndroidResourcesPolyFill.cs
Created May 16, 2016 03:00
This is a Android Resources Polyfill for Xamarin.Forms 2.2 when 3rd party libraries have not' updated.
using System;
namespace Yournamespace
{
public partial class Resource
{
public partial class Attribute
{
// public const int mediaRoutePlayDrawable = -1;
public const int mediaRouteSettingsDrawable = -2;
@rid00z
rid00z / TextBlobOperations.cs
Created March 22, 2016 23:59
Text Blob Operation and Attribute
public static class TextBlobOperations
{
public static void GetTextBlobs(object element)
{
if (element == null)
return;
var type = element.GetType();
foreach (var relationshipProperty in type.GetTextBlobProperties())
{
@rid00z
rid00z / AsyncHelper.cs
Created September 19, 2015 03:11
This code can be used to task a async task and run it without the async part.
public static class AsyncHelper
{
private static readonly TaskFactory _myTaskFactory = new
TaskFactory(CancellationToken.None,
TaskCreationOptions.None,
TaskContinuationOptions.None,
TaskScheduler.Default);
public static TResult RunSync<TResult>(Func<Task<TResult>> func)
{
@rid00z
rid00z / BindablePropertyTemplate.cs
Created September 19, 2015 02:00
Visual/Xamarin Studio - Bindable Property Template for Xamarin.Forms
public static readonly BindableProperty $Name$Property =
BindableProperty.Create<$owner$, $type$>(
p => p.$Name$, default($type$));
public $type$ $Name$ {
get { return ($type$)GetValue($Name$Property); }
set { SetValue($Name$Property, value); }
}
@rid00z
rid00z / Extensions.cs
Created July 15, 2015 11:15
Bluetooth APIs with TaskCompletionSource
using System;
using System.Threading.Tasks;
using System.Linq;
using System.Diagnostics;
namespace Robotics.Mobile.Core.Bluetooth.LE
{
public static class Extensions
{
/// <summary>
@rid00z
rid00z / RemoteDataSource.cs
Last active August 29, 2015 14:05
Remote Data Source
/*
* Note* this is for demo purposes only and is not a example of good network code,
* http://www.michaelridland.com/mobile/asp-net-mvc-xamarin-mashups/
*/
public class RemoteDataSource : IDataSource
{
static string HostBase = "http://192.168.56.101:49203";
public RemoteDataSource ()
{
}
@rid00z
rid00z / LocalDataSource.cs
Created August 19, 2014 11:42
Local Data Source
public class LocalDataSource : IDataSource
{
SQLiteConnection _sqliteConnection;
public LocalDataSource ()
{
_sqliteConnection = Xamarin.Forms.DependencyService.Get<ISQLiteFactory> ().GetConnection("app.db");
CreateTable ();
}
@rid00z
rid00z / JellyBeanGraphCalculator.cs
Last active August 29, 2015 14:05
JellyBeanGraphCalculator
public class JellyBeanGraphCalculator
{
IDataSource _datasource;
public JellyBeanGraphCalculator (IDataSource datasource)
{
_datasource = datasource;
}
public IEnumerable<JellyBeanGraphData> GetGraphData()
{