Skip to content

Instantly share code, notes, and snippets.

View pedrolamas's full-sized avatar

Pedro Lamas pedrolamas

View GitHub Profile
@pedrolamas
pedrolamas / MainPage.xaml
Created March 11, 2012 22:04
Silverlight Toolkit ListPicker with items defined in XAML
<phone:PhoneApplicationPage
x:Class="PhoneApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
@pedrolamas
pedrolamas / gist:2386001
Created April 14, 2012 17:12
Gettings all "a.href" in HTML string
using System.Linq;
using HtmlAgilityPack;
namespace PhoneApp1
{
public class HtmlAgilityPackSample
{
public static string[] GetLinks(string html)
{
// The next line allows for form overlaps (forms inside forms)
@pedrolamas
pedrolamas / ImageHelper.cs
Created May 2, 2012 11:04
Windows Phone ImageHelper class
using System;
using System.IO;
using System.Windows.Media.Imaging;
namespace Helpers
{
public class ImageHelper
{
public static MemoryStream ResizeImage(Stream inputStream, double maxWidth, double maxHeight)
{
using System.Collections.Generic;
using Newtonsoft.Json;
using System;
namespace ConsoleApplication1
{
class Program
{
public static T DeserializeFromJson<T>(string json)
{
@pedrolamas
pedrolamas / Program.cs
Created July 4, 2014 10:15
Basic app to test and compare the generated IL
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
DoIt1();
DoIt2();
@pedrolamas
pedrolamas / app.xaml.cs
Created August 7, 2014 13:02
Grid layout in WP8.1
/*
In the "old" Windows Phone grid layout you would have a two columns layout like so:
MMCMCMM
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:
MMCMCMCMM
@pedrolamas
pedrolamas / CustomUiNavigationController.cs
Created September 12, 2014 09:45
Xamarin UINavigationController.ViewDidLoad running before constructor
using System.Text;
using MonoTouch.UIKit;
namespace App2
{
public class CustomUiNavigationController : UINavigationController
{
private readonly StringBuilder _sb;
public CustomUiNavigationController(UIViewController uiViewController)
@pedrolamas
pedrolamas / UriExtensions.cs
Created September 29, 2014 00:03
UriExtensions class used in Cimbalino Toolkit with some changes to show the usage of optional parameters
// ****************************************************************************
// <copyright file="UriExtensions.cs" company="Pedro Lamas">
// Copyright © Pedro Lamas 2014
// </copyright>
// ****************************************************************************
// <author>Pedro Lamas</author>
// <email>pedrolamas@gmail.com</email>
// <project>Cimbalino.Toolkit.Core</project>
// <web>http://www.pedrolamas.com</web>
// <license>
@pedrolamas
pedrolamas / Boxstarter.txt
Last active August 29, 2015 14:13
My personal Boxstarter script
Enable-MicrosoftUpdate
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowFileExtensions
cinst DotNet4.5.1
cinst silverlight5developerruntime
cinst 7zip
cinst adobereader
cinst skype
cinst dropbox
cinst fiddler4

Keybase proof

I hereby claim:

  • I am pedrolamas on github.
  • I am pedrolamas (https://keybase.io/pedrolamas) on keybase.
  • I have a public key ASC1NVaCf8XHix-iLfc6BG864vBxGvmzdRB6cBG36TdCowo

To claim this, I am signing this object: