This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>net5.0</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0" /> | |
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Shared code | |
public class ResponsiveLabel : Label | |
{ | |
public double MinSize | |
{ | |
get => (double)GetValue(MinSizeProperty); | |
set => SetValue(MinSizeProperty, value); | |
} | |
public static readonly BindableProperty MinSizeProperty = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class GeoHelper | |
{ | |
private const double r_earth = 6371; | |
private const double pi = Math.PI; | |
private static double RadiansToDegrees(double rads) => rads * 180.0 / pi; | |
private static double ToRadian(double degrees) => degrees * pi / 180.0; | |
public static (Position topRight, Position btmRight, Position btmLeft, Position topLeft) GetBoundingBox(Position position, double distance) => | |
GetBoundingBox(position.Lat, position.Long, distance); | |
public static (Position topRight, Position btmRight, Position btmLeft, Position topLeft) GetBoundingBox(double centerLat, double centerLong, double distance) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class GesturesBehavior | |
{ | |
public static readonly BindableProperty TapCommandProperty = | |
BindableProperty.CreateAttached("TapCommand", typeof(ICommand), typeof(GesturesBehavior), null, propertyChanged: OnTapCommandChanged); | |
public static ICommand GetTapCommand(BindableObject view) | |
=> (ICommand)view.GetValue(TapCommandProperty); | |
public static void SetTapCommand(BindableObject view, ICommand value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Some files downloaded from Pluralsight using youtube-dl tool have GUIDs appended to their names, | |
//e.g.: Course Overview-13acb659-b860-4dac-b284-64fc18a2ece1.mp4, this C# function removes them | |
static void Main() | |
{ | |
RemoveGuidsFromFilesIn(@"D:\C#\CourseFolder"); | |
} | |
private static void RemoveGuidsFromFilesIn(string path) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BaseViewModel : INotifyPropertyChanged | |
{ | |
public INavigation Navigation { get; set; } | |
bool isBusy = false; | |
public bool IsBusy | |
{ | |
get { return isBusy; } | |
set { SetProperty(ref isBusy, value); } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
namespace ExtendedCollection | |
{ | |
[DebuggerDisplay("{Value}")] | |
public class SNode<T> | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<Kmer> kmers = new List<Kmer>(); | |
string message = "gjhcebfu71uevkkvhjv,yjvykku71jrbirbgerngtgntteu71agg6g79htu718eay8hibioay+8eru71ohob8vy89egyhoih89vu71oyhbigr89yhrrvoaeoghau71e8ryg98ergh.oaeryl9g7rv7g7iytg643483gi@$#t32@#2R23r213ri4tyg2ti.88oichu71tp9hg"; | |
for (int i = 0; i <= message.Length - 3; i++) | |
{ | |
string substring = message.Substring(i, 3); | |
int occurences = Regex.Matches(message, Regex.Escape(substring)).Count; | |
kmers.Add(new Kmer { Text = substring, Occ = occurences }); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var img = Image.FromFile(@"C:\Users\Mohamed.Elshawaf\Desktop\imageTests\original.png"); | |
var ratio = .75; | |
var height = img.Height; | |
var width = img.Width; | |
int newHeight = (int)(height * ratio); | |
int newWidth = (int)(width * ratio); |
NewerOlder