Skip to content

Instantly share code, notes, and snippets.

Bruno Van Thournout BrunoVT1992

View GitHub Profile
@BrunoVT1992
BrunoVT1992 / CurrentActivityUtil.cs
Last active Jul 11, 2018
Function for getting the current activity in Xamarin Android
View CurrentActivityUtil.cs
using System.Collections.Generic;
using System.Linq;
using Android.Runtime;
using Android.Util;
using Java.Lang;
using Java.Util;
namespace Droid
{
public static class CurrentActivityUtil
@BrunoVT1992
BrunoVT1992 / ScaleImageView.cs
Last active Jun 23, 2018
Scaleable / zoomable imageview for Xamarin Android
View ScaleImageView.cs
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Android.Content;
using Android.Graphics;
using Android.Util;
using Android.Views;
using Android.Widget;
namespace Droid
@BrunoVT1992
BrunoVT1992 / BaseRepository
Last active Jan 5, 2018
SQLite.NET async BaseRepository
View BaseRepository
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using SQLite;
using System.Linq.Expressions;
using System.Linq;
namespace SQLite
{
public interface IBaseRepository<TEntity, TPrimaryKey>
@BrunoVT1992
BrunoVT1992 / EmailValidator.cs
Created Dec 18, 2017
c# email validator class to see if a string is a correct email
View EmailValidator.cs
using System.Text.RegularExpressions;
namespace CSharp
{
public static class EmailValidator
{
const string EmailPattern = @"^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDC
@BrunoVT1992
BrunoVT1992 / Translations.tt
Created Oct 13, 2017
Translations visual studio tool for managing csv text files
View Translations.tt
<#@ template language="C#" hostSpecific="true" #>
<#@ output extension=".cs" #>
<#@ assembly name="System.Core"#>
<#@ import namespace="System" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.Globalization" #>
<#
@BrunoVT1992
BrunoVT1992 / Translations.tt
Created Oct 13, 2017
Translations visual studio tool for managing csv text files. Ex.:
View Translations.tt
<#@ template language="C#" hostSpecific="true" #>
<#@ output extension=".cs" #>
<#@ assembly name="System.Core"#>
<#@ import namespace="System" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.Globalization" #>
<#
@BrunoVT1992
BrunoVT1992 / StackView.cs
Created Sep 18, 2017
StackView for Xamarin.iOS without the need for AutoLayout constraints
View StackView.cs
using System;
using System.Linq;
using CoreGraphics;
using UIKit;
namespace iOS
{
public class StackView : UIView
{
nfloat _previousWidth;
@BrunoVT1992
BrunoVT1992 / FreeDrawView.cs
Created Jul 27, 2017
Free draw view for Xamarin Android
View FreeDrawView.cs
using Android.Content;
using Android.Graphics;
using Android.Util;
using Android.Views;
namespace Droid
{
public class FreeDrawView : View
{
Path _drawPath;
@BrunoVT1992
BrunoVT1992 / FreeDrawUIView.cs
Created Jul 27, 2017
Free draw view for Xamarin iOS
View FreeDrawUIView.cs
using CoreGraphics;
using Foundation;
using UIKit;
namespace iOS
{
public class FreeDrawUIView : UIView
{
UIBezierPath _path;
@BrunoVT1992
BrunoVT1992 / UIImageExtensions.cs
Created Jul 20, 2017
UIImage extension to get a pixel color for Xamarin iOS
View UIImageExtensions.cs
using System.Drawing;
using System.Runtime.InteropServices;
using CoreGraphics;
using UIKit;
namespace iOS
{
public static class UIImageExtensions
{
public static string GetPixelHexColor(this UIImage image, float x, float y)
You can’t perform that action at this time.