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
internal class Program
{
private static void Main(string[] args)
{
Test("pass");
Test("password");
Test("Password");
Test("P@ssword");
Test("P@ssw0rd");
Test("P@ssW0rD");
<Page
x:Class="UsingRing.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UsingRing"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
@JerryNixon
JerryNixon / AzureFunction.cs
Last active September 4, 2019 05:16
How to use custom dependency injection.
using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Linq;
@JerryNixon
JerryNixon / Aspose.FindTables.cs
Created September 10, 2019 17:35
A test that we tried against artwork. Sort of works. Abandoned though.
static void Main(string[] args)
{
SetLicense();
var path = Path.Combine(Environment.CurrentDirectory, "artwork1.pdf");
using (var doc = new Document(path))
{
var tableOptions = new TextSearchOptions(false)
{
IgnoreShadowText = true,
@JerryNixon
JerryNixon / BoundingBoxLogic.cs
Created September 23, 2019 04:17
Making sense of Azure's Recognize Text computer vision cognitive service Line and Word BoundingBox array of longs property.
public static void GetBoxCoordinates(long[] longs, out (Point TopLeft, Point TopRight, Point BottomRight, Point BottomLeft) corners, out Size size, out double angle)
{
if (longs.Length != 8)
{
throw new ArgumentOutOfRangeException(nameof(longs));
}
corners = (
new Point((int)longs[0], (int)longs[1]),
new Point((int)longs[2], (int)longs[3]),
new Point((int)longs[4], (int)longs[5]),
@JerryNixon
JerryNixon / CropUwpImageControl.cs
Created September 30, 2019 03:22
Image.Source = await CropImageAsync(Image.Source, new Rectangle(10, 10, 100, 100));
private async Task<SoftwareBitmapSource> CropImageAsync(ImageSource source, Rectangle rectangle)
{
try
{
SoftwareBitmap bitmap;
var image = source as BitmapImage;
var file = await StorageFile.GetFileFromApplicationUriAsync(image.UriSource);
using (var stream = await file.OpenAsync(FileAccessMode.Read))
{
@JerryNixon
JerryNixon / BackgroundTask.cs
Created November 16, 2019 23:57
Simple, basic UWP Background Task
public class ApplicationTask : IBackgroundTask
{
public void Run(IBackgroundTaskInstance instance)
{
Debugger.Break();
}
public static async Task<IBackgroundTrigger> RegisterWithApplicationTriggerAsync(params IBackgroundCondition[] conditions)
{
var trigger = new ApplicationTrigger();
@JerryNixon
JerryNixon / Snake.cs
Last active September 8, 2023 16:01
The simple Snake game in C# for the Windows Console
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Threading;
namespace Snake
{
public enum Direction { Stop, Up, Down, Left, Right }
using System;
using System.Drawing;
namespace SnakePrep
{
internal class Program
{
private static ConsoleKey _direction = ConsoleKey.Escape;
private static bool _gameOver = false;
private static Point _current;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
namespace SnakePrep
{
internal class Program
{