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 / IRemove.cs
Last active February 27, 2016 20:15 — forked from jamesmontemagno/IRemove.cs
A simple and Intuitive Xamarin.iOS + MvvmCross TableView swipe to delete implementation. This will allow you to have any number of ViewModels simply implement IRemove.cs and all you need is MvxDeleteStandarTableViewSource and implement the interface in your viewmodels! I should say that these are edited classes, you should implement some of the …
public interface IRemove
{
ICommand RemoveCommand { get; }
}
public class BaseViewModel : BaseNotify
{
bool _isBusy = false;
CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
public bool IsBusy
{
get
{
return _isBusy;
public class CarouselIndicators : Grid
{
private ImageSource UnselectedImageSource = null;
private ImageSource SelectedImageSource = null;
private readonly StackLayout _indicators = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.CenterAndExpand };
public CarouselIndicators()
{
this.HorizontalOptions = LayoutOptions.CenterAndExpand;
this.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
@wcoder
wcoder / parseInt.js
Last active September 23, 2017 13:35
// (c) 2016 Yauheni Pakala
var _parseInt = str => str.replace(/(.*?)(\d+)(.*)/,'$2') - 0;
// test
console.log(_parseInt("123hui"));
console.log(_parseInt("123hui321"));
console.log(_parseInt("hui123"));
@wcoder
wcoder / ViewPagerIndicator.cs
Last active July 14, 2021 15:37
Basic implementation of ViewPager indicator
public class ViewPagerIndicator : LinearLayout, ViewPager.IOnPageChangeListener
{
private TextView _textView;
private ViewPager _viewPager;
#region Android view dafault constructors
public ViewPagerIndicator(Context context)
: base(context)
{
@wcoder
wcoder / multiple-rename.md
Last active January 29, 2018 21:08
Multiple files renaming on macOS
for j in *.bak; do mv -- "$j" "temp_${j%.bak}.txt"; done

Example:

from:
123.bak
@wcoder
wcoder / xamarin_android.md
Last active January 29, 2018 21:10
Exception handling on Xamarin Android
// Wire up Unhandled Expcetion handler from Android
AndroidEnvironment.UnhandledExceptionRaiser += (sender, args) =>
{
	/*
	 * When the UI Thread crashes this is the code that will be executed. There is no context at this point
	 * and no way to recover from the exception. This is where you would capture the error and log it to a 
	 * file for example. You might be able to post to a web handler, I have not tried that.
	 * 
// (c) 2017 Yauheni Pakala
(function(p,l){l.protocol===p||(l.protocol=p)}("https:",window.location))
  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,
@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