Skip to content

Instantly share code, notes, and snippets.

View wcoder's full-sized avatar
🎯
Focusing

Yauheni Pakala wcoder

🎯
Focusing
View GitHub Profile
@wcoder
wcoder / update_version.sh
Created April 3, 2019 18:09
Simple bash script for update versions of Xamarin applications via terminal or CI
#!/usr/bin/env bash
# For Xamarin Android or iOS, change the package name located in AndroidManifest.xml and Info.plist.
# AN IMPORTANT THING: YOU NEED DECLARE PACKAGE_NAME, PACKAGE_VERSION ENVIRONMENT VARIABLE IN APP CENTER BUILD CONFIGURATION.
PACKAGE_NAME="com.your.name"
PACKAGE_VERSION="0.1"
ANDROID_PROJECT_PATH="ProjectName.Android"
ANDROID_MANIFEST_PATH="$ANDROID_PROJECT_PATH/Properties/AndroidManifest.xml"
@wcoder
wcoder / DatasSource.cs
Created March 26, 2019 15:54
Texture PoC Dispose
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Threading;
using AsyncDisplayKitBindings;
using Foundation;
using UIKit;
using Softeq.XToolkit.Common.Collections;
using Softeq.XToolkit.Common.WeakSubscription;
@wcoder
wcoder / ColorExtensions.cs
Created March 19, 2019 21:10
Port of UIColorMSHashExtension from Swift to C#. Office UI Fabric iOS for Xamarin.iOS
using System;
using UIKit;
namespace XamarinOfficeUIFabric
{
public static class ColorExtensions
{
// Original MS Source:
// https://github.com/OfficeDev/office-ui-fabric-ios/blob/master/OfficeUIFabricCore/OfficeUIFabricCore/Core/Colors/UIColorMSHashExtension.swift
public static UIColor MSHashColor(this string hash)
@wcoder
wcoder / README.md
Created January 13, 2019 09:50
Simple script for mirror migrate a repository from Bitbucket to Github

How to use

  1. create repo on github (from web interface)
  2. run script:
./bitbucket_to_github.sh <user_name> <repository_name>

Sample:

@wcoder
wcoder / Notes.md
Last active July 14, 2021 15:32
Xamarin.iOS, Xamarin.Android Highlight mentions in label/textview

Core

public static IEnumerable<(int Start, int Length)> DetectMentions(string text)
{
    var matches = Regex.Matches(text, @"\B@(\w|@|\.)+", RegexOptions.IgnorePatternWhitespace);

    foreach (Match mention in matches)
    {
@wcoder
wcoder / clean-bin-obj.sh
Last active December 11, 2018 14:19
Single line bash script for remove `bin` and `obj` folders from .Net solution on macOS (Xamarin)
find -E . -regex ".*/(bin|obj)" -type d -exec rm -r "{}" \;
@wcoder
wcoder / .editorconfig
Last active March 24, 2019 15:09
My EditorConfig file for Xamarin development
# EditorConfig is awesome: http://EditorConfig.org
# Based on:
# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
# https://github.com/dotnet/roslyn/blob/master/.editorconfig
# top-most EditorConfig file
root = true
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<!-- Colors -->
<color name="CustomHighlight">@android:color/transparent</color>
<color name="DarkOverride">@android:color/black</color>
<color name="Brand">#BE1003</color>
<style name="MainTheme" parent="MainTheme.Base">
</style>
@wcoder
wcoder / build.cmd
Created November 20, 2017 14:40
Build Xamarin Android apk & launch on emulator
:: /t:Rebuild /p:Configuration=Debug
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" ProgressDownload\ProgressDownload.csproj /t:Clean
:: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" ProgressDownload\ProgressDownload.csproj /t:Build /p:Configuration=Debug /t:SignAndroidPackage
  1. Fiddler -> Options -> Connections -> 8888
  2. ipconfig -> 192.168.0.2 (fiddler machine IP)
  3. Android Emulator -> Settings -> APN -> Proxy -> 192.168.0.2
  4. .NET layer:
var handler = new HttpClientHandler
{
 UseProxy = true,