Skip to content

Instantly share code, notes, and snippets.

Pedro Lamas PedroLamas

Block or report user

Report or block PedroLamas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
PedroLamas / MultiWindowViewModelBase.cs
Last active Mar 21, 2018
Base view model that can be used in multiple windows
View MultiWindowViewModelBase.cs
public class MultiWindowViewModelBase : INotifyPropertyChanged
private readonly ConcurrentDictionary<CoreDispatcher, PropertyChangedEventHandler> _dispatchersAndHandlers = new ConcurrentDictionary<CoreDispatcher, PropertyChangedEventHandler>();
public event PropertyChangedEventHandler PropertyChanged
var dispatcher = Window.Current.Dispatcher;

GPG Cheat Sheet

Generating a new key

gpg --gen-key

gpg --expert --full-gen-key
PedroLamas / CultureInfoHelper.cs
Last active May 3, 2017
Helper class to return the correct CultureInfo in UWP apps
View CultureInfoHelper.cs
using System.Globalization;
using System.Runtime.InteropServices;
using System.Text;
public class CultureInfoHelper
[DllImport("api-ms-win-core-localization-l1-2-0.dll", CharSet = CharSet.Unicode)]
private static extern int GetLocaleInfoEx(string lpLocaleName, uint LCType, StringBuilder lpLCData, int cchData);
private const uint LOCALE_SNAME = 0x0000005c;

Keybase proof

I hereby claim:

  • I am pedrolamas on github.
  • I am pedrolamas ( on keybase.
  • I have a public key ASC1NVaCf8XHix-iLfc6BG864vBxGvmzdRB6cBG36TdCowo

To claim this, I am signing this object:

PedroLamas / Boxstarter.txt
Last active Aug 29, 2015
My personal Boxstarter script
View Boxstarter.txt
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowFileExtensions
cinst DotNet4.5.1
cinst silverlight5developerruntime
cinst 7zip
cinst adobereader
cinst skype
cinst dropbox
cinst fiddler4
PedroLamas / UriExtensions.cs
Created Sep 29, 2014
UriExtensions class used in Cimbalino Toolkit with some changes to show the usage of optional parameters
View UriExtensions.cs
// ****************************************************************************
// <copyright file="UriExtensions.cs" company="Pedro Lamas">
// Copyright © Pedro Lamas 2014
// </copyright>
// ****************************************************************************
// <author>Pedro Lamas</author>
// <email></email>
// <project>Cimbalino.Toolkit.Core</project>
// <web></web>
// <license>
PedroLamas / CustomUiNavigationController.cs
Created Sep 12, 2014
Xamarin UINavigationController.ViewDidLoad running before constructor
View CustomUiNavigationController.cs
using System.Text;
using MonoTouch.UIKit;
namespace App2
public class CustomUiNavigationController : UINavigationController
private readonly StringBuilder _sb;
public CustomUiNavigationController(UIViewController uiViewController)
PedroLamas / app.xaml.cs
Created Aug 7, 2014
Grid layout in WP8.1
View app.xaml.cs
In the "old" Windows Phone grid layout you would have a two columns layout like so:
where M is a 12px margin and C is the column width (so 5 * M + 2 * C = Width)
For a 3 columns layout it would be:
PedroLamas / Program.cs
Created Jul 4, 2014
Basic app to test and compare the generated IL
View Program.cs
using System;
namespace ConsoleApplication1
class Program
static void Main(string[] args)
View Program.cs
using System.Collections.Generic;
using Newtonsoft.Json;
using System;
namespace ConsoleApplication1
class Program
public static T DeserializeFromJson<T>(string json)
You can’t perform that action at this time.