Skip to content

Instantly share code, notes, and snippets.

@pavlovmilen
pavlovmilen / CurrentActivityFixForMvvmLight.txt
Created September 16, 2016 07:50
CurrentActivityFixForMvvmLight
protected override void OnResume()
{
CurrentActivity = this;
if (string.IsNullOrEmpty(ActivityKey))
{
ActivityKey = NextPageKey;
NextPageKey = null;
}
private void DismissKeypad ()
{
var currentView = ConsortiumApp.CurrentActivity.Window.CurrentFocus;
if(currentView != null)
{
var manager = (InputMethodManager)ConsortiumApp.CurrentActivity.GetSystemService(Activity.InputMethodService);
manager.HideSoftInputFromWindow (currentView.WindowToken, 0);
}
}
@pavlovmilen
pavlovmilen / alexaresponse.cs
Created April 26, 2018 14:14
alexa response
innerResponse.Ssml = ssml.ToSsml();
var response = ResponseBuilder.Tell(innerResponse);
response.Response.ShouldEndSession = false;
@pavlovmilen
pavlovmilen / showalert.cs
Created May 3, 2018 06:33
Show alert on UI XF
public static class PageExtensions
{
public static Task<bool> DisplayAlertOnUi(this Page source, string title, string message, string accept, string cancel)
{
TaskCompletionSource<bool> doneSource = new TaskCompletionSource<bool>();
Device.BeginInvokeOnMainThread(async () =>
{
try
{
var result = await source.DisplayAlert(title, message, accept, cancel);
@pavlovmilen
pavlovmilen / sslcertpinningios.cs
Created June 1, 2018 15:25
Get SHA1 for Public key of SSL Cert Xamarin.iOS
private byte[] rsa2048Asn1Header = new byte[] {0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00};
public override void DidReceiveChallenge(NSUrlSession session, NSUrlAuthenticationChallenge challenge, Action<NSUrlSessionAuthChallengeDisposition, NSUrlCredential> completionHandler)
{
//Sample implementation using SHA1Managed
var secServerChain = challenge.ProtectionSpace.ServerSecTrust;
int certCount = challenge.ProtectionSpace.ServerSecTrust.Count;
@pavlovmilen
pavlovmilen / ioshttpclient.cs
Created June 1, 2018 15:51
myioshttpclient
public class MyiOSHttpClient : IMyClient
{
NSUrlSession _client;
var _delegate = new mycustomsessiondatadelegate();
using (NSUrlSessionConfiguration config = NSUrlSessionConfiguration.DefaultSessionConfiguration)
{
_client = NSUrlSession.FromConfiguration(config, _delegate, NSOperationQueue.MainQueue);
}
....
@pavlovmilen
pavlovmilen / BatchUpsert.cs
Last active November 25, 2019 14:43
Initialise table storage
public async Task<ApiResponse<bool>> BatchSaveEntities(List<MyDto> items)
{
try
{
var batchOperation = new TableBatchOperation();
if (!items.Any())
return new ApiResponse<bool>(){IsSuccess = false, Errors = new []{"No data"}};
foreach (var item in items)
@pavlovmilen
pavlovmilen / settings.json
Last active August 27, 2021 14:03
vscode settings
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[html]": {
"editor.defaultFormatter": "hookyqr.beautify",
"editor.formatOnSave": true
},
"[css]": {
"editor.defaultFormatter": "hookyqr.beautify",
@pavlovmilen
pavlovmilen / AzureDependencyFilterTelemetryProcessor
Last active May 5, 2021 16:49
filters out dependencies like polling queues that are not attached to any larger operation.
/// filters out dependencies like polling queues that are not attached to any larger operation.
public class AzureDependencyFilterTelemetryProcessor : ITelemetryProcessor
{
private readonly ITelemetryProcessor _inner;
public AzureDependencyFilterTelemetryProcessor(ITelemetryProcessor inner)
{
_inner = inner;
}
@pavlovmilen
pavlovmilen / Local-Kubernetes.md
Created January 21, 2022 09:06 — forked from dahlsailrunner/Local-Kubernetes.md
Helpful tips and snippets for Kubernetes within Docker Desktop

Using the K8s Dashboard Locally

Actual repo is here: https://github.com/kubernetes/dashboard

1. Install the Dashboard

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.4.0/aio/deploy/recommended.yaml

2. Create a Sample User Account that can Access the Dashboard via Token

kubectl apply -f https://gist.githubusercontent.com/dahlsailrunner/bbd453f3bb6259b66c08a70d0908283f/raw/5727723217e2df4b65d8933adf04d009cfb0fe3f/local-dashboard-account.yml