Skip to content

Instantly share code, notes, and snippets.

View JerryNixon's full-sized avatar
🤔
Trying to make a living.

Jerry Nixon JerryNixon

🤔
Trying to make a living.
View GitHub Profile
@JerryNixon
JerryNixon / Seven.cs
Last active May 23, 2016 22:57
Prep for presentation
// C# 6 return complex types
public class result
{
public int Sum {get;set;}
public int Count {get;set;}
}
public result Total(int[] values)
{
return new result
@JerryNixon
JerryNixon / FlipView.xaml
Created July 20, 2016 15:43
Simply FlipView
<FlipView Width="320"
Height="480"
RelativePanel.AlignHorizontalCenterWithPanel="True"
RelativePanel.AlignVerticalCenterWithPanel="True">
<FlipView.ItemTemplate>
<DataTemplate>
<Image Source="{Binding}" />
</DataTemplate>
</FlipView.ItemTemplate>
<FlipView.Items>
@JerryNixon
JerryNixon / SqliteDAL.cs
Last active August 23, 2016 19:20
Potential Sqlite DAL for UWP
public static class SqliteDAL
{
public static class Database
{
public static string FileName { get; set; } = "Storage.sqlite";
public static StorageFolder Folder { get; set; } = ApplicationData.Current.LocalFolder;
public static async Task DropAsync(string path = null)
{
/// <summary>
/// This is a very simple example of a DI/IoC container.
/// </summary>
public sealed class SimpleContainer
{
readonly Dictionary<Type, Func<object>> registeredCreators = new Dictionary<Type, Func<object>>();
/// <summary>
/// Register a type with the container. This is only necessary if the
/// type has a non-default constructor or needs to be customized in some fashion.
@JerryNixon
JerryNixon / WunderlistHelper.cs
Last active December 16, 2016 18:14
Authenticate to Wunderlist
public class WunderlistHelper
{
private static Template10.Services.NetworkAvailableService.NetworkAvailableService _NetworkService = new NetworkAvailableService();
private static Template10.Services.SecretService.SecretService _SecretService = new SecretService();
private static Template10.Services.HttpService.HttpHelper _HttpHelper = new HttpHelper();
private WunderlistSettings _settings;
public WunderlistHelper(WunderlistSettings settings)
{
_settings = settings;
using System.Threading.Tasks;
using Windows.Web.Http;
using System;
using System.Collections.Generic;
using System.Threading;
using Windows.Networking.BackgroundTransfer;
using System.Diagnostics;
using Windows.Storage;
using Windows.Security.Credentials;
using Windows.UI.Notifications;
@JerryNixon
JerryNixon / SwipeTap.cs
Last active February 7, 2017 01:22
For the way of the sub.
public class ButtonEx : Button
{
public ButtonEx() : base()
{
ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.System;
ManipulationCompleted += (s, e) => ShouldExcuteCommand2(Math.Abs(e.Cumulative.Translation.X));
Tapped += (s, e) => ShouldExcuteCommand2(DateTime.Now);
}
private void ShouldExcuteCommand2(double distanceX)
@JerryNixon
JerryNixon / Example1.cs
Created April 11, 2017 16:30 — forked from davidfowl/Example1.cs
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)
@JerryNixon
JerryNixon / Example1.cs
Created April 11, 2017 16:30 — forked from davidfowl/Example1.cs
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)
@JerryNixon
JerryNixon / app.xaml
Last active May 1, 2017 21:45
The Visual Studio 2017 default UWP Application
<Application
x:Class="Sample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Sample"
RequestedTheme="Light" />