Skip to content

Instantly share code, notes, and snippets.

View M-Yankov's full-sized avatar
💻
🤖🧭🏃‍♂️🚵‍♂️

Mihail Yankov M-Yankov

💻
🤖🧭🏃‍♂️🚵‍♂️
View GitHub Profile
@M-Yankov
M-Yankov / RangeSlider.cs
Created February 25, 2024 22:01
Range Slider for MAUI
using System.ComponentModel;
using System.Diagnostics;
using MAUI = Microsoft.Maui.Controls.Shapes;
namespace TelemetryExporter.UI.CustomControls;
// It will be good that range slider to be Generic and initialize it from code behind.
// For example RangeSlider<T> where T : Struct (or something comparable)
public class RangeSlider : ContentView, INotifyPropertyChanged
@M-Yankov
M-Yankov / wp-index.js
Created January 7, 2024 20:25
show all tickera custom fields and their values. (field in database; field title). Open a custom form for edit and then execute the script.
jQuery('[name="tc_input_field_form_element[field_name][]"],[name="tc_select_field_form_element[field_name][]"]')
.map((i, x) => `${x.value} ${jQuery(x).nextAll('[name="tc_input_field_form_element[field_label][]"],[name="tc_select_field_form_element[field_label][]"]').get(0).value}`)
@M-Yankov
M-Yankov / RaceEventSites.md
Last active February 6, 2024 16:03
A web sites of events for trail running or bike
@M-Yankov
M-Yankov / bike-shops-list.md
Last active March 4, 2022 15:21
Bike shop sites
  • Basebike
  • allmountain
  • niko bikes
  • hala bikes
  • pumpmybike.eu
  • 1001parts
  • veloserviz.com
  • bikeshop-bg.com
  • champion-bikeshop.com
  • pavebikeshop
@M-Yankov
M-Yankov / Article.md
Created February 24, 2022 19:15
An article for my blog

When working with nullable booleans and using null condiional operator could be wrong:

Let's take the follwoing example:
bool? isRecording = savedInstanceState?.GetBoolean("isRecording");

if (isRecording) - This won't compile. need another approach. The condition if (isRecording == false) will be true when the variable is equal to false and when it is null. It's logical to work like that since the default value of bool is false and the null value is more suitable to false. But we should be careful if the logic need to be executed only if it's equal to false.

@M-Yankov
M-Yankov / cmd.md
Created November 7, 2021 06:31
Andtoid export/backup database

Connect the phone

execute the following line in CMD as Administrator

cd "C:\Program Files (x86)\Android\android-sdk\platform-tools"
adb backup -f C:\Users\M.Yankov\Desktop\data.ab com.mihyan.simpletracker

In the phone screen Enable dubug if asked

@M-Yankov
M-Yankov / PdfGenerator.cs
Last active January 14, 2020 11:13
A code that generates a PDF document for testing (requires iTextSharp)
using System;
using System.IO;
using iText.Kernel.Colors;
using iText.Kernel.Pdf;
using iText.Layout;
using iText.Layout.Element;
public class Program
{
@M-Yankov
M-Yankov / App.Config
Created September 18, 2019 22:26
A sample C# .NET CORE app using PredicateBuilder.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="LocalDb" connectionString="Data Source=LENOVO-G710;Initial Catalog=PredicateBuilder;Integrated Security=True" providerName=""/>
</connectionStrings>
</configuration>
@M-Yankov
M-Yankov / GetAddressMemory.cs
Created September 9, 2019 06:13
Returns the address of the memory refferensed by object.
public unsafe void Get(MyModel a)
{
System.Runtime.InteropServices.GCHandle handle = System.Runtime.InteropServices.GCHandle.Alloc(a, System.Runtime.InteropServices.GCHandleType.Weak);
try
{
IntPtr pointer = System.Runtime.InteropServices.GCHandle.ToIntPtr(handle);
string test = "0x" + pointer.ToString("X");
}
finally
{
@M-Yankov
M-Yankov / MSBuildFilePublish.txt
Created April 18, 2019 13:15
Local File Publish with MS Build
msbuild ProjectFile.csproj /p:Configuration=Release ^
/p:Platform=AnyCPU ^
/t:WebPublish ^
/p:WebPublishMethod=FileSystem ^
/p:DeleteExistingFiles=True ^
/p:publishUrl=c:\output
msbuild Solution.sln /p:Configuration=Release ^
/p:DeployOnBuild=True ^
/p:DeployDefaultTarget=WebPublish ^