Skip to content

Instantly share code, notes, and snippets.

View MartinZikmund's full-sized avatar
⌨️
Coding

Martin Zikmund MartinZikmund

⌨️
Coding
View GitHub Profile
@MartinZikmund
MartinZikmund / about.md
Created September 23, 2011 21:03 — forked from sputnikus/about.md
Programming Achievements: How to Level Up as a Developer

Programming Achievements: How to Level Up as a Developer

  1. Select a particular experience to pursue.
  2. Pursue that experience to completion. (Achievement unlocked!)
  3. Reflect on that experience. Really soak it in. Maybe a blog post would be in order?
  4. Return to Step 1, this time selecting a new experience.

This gist is a fork of the gist from this blog post.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyAwesomeApp.HomePage"
xmlns:viewModels="clr-namespace:MyAwesomeApp.ViewModels"
x:DataType="viewModels:HomeViewModel">
<ContentPage.BindingContext>
<viewModels:HomeViewModel />
</ContentPage.BindingContext>
<ContentPage.Content>
using Xamarin.Forms;
namespace MyAwesomeApp.ViewModels
{
public class HomeViewModel : BindableObject
{
private string _greeting = "Hello";
public string Greeting
{
@MartinZikmund
MartinZikmund / MainPage.xaml.cs
Created November 19, 2018 22:30
XAML page with enabled compiled bindings
[XamlCompilation (XamlCompilationOptions.Compile)]
public class MainPage : ContentPage
{
...
}
@MartinZikmund
MartinZikmund / App.xaml.cs
Created November 19, 2018 22:31
Xamarin.Forms App.xaml.cs with enabled compiled views
[assembly: XamlCompilation (XamlCompilationOptions.Compile)]
@MartinZikmund
MartinZikmund / ListView.xaml
Created November 19, 2018 22:39
Xamarin.Forms compiled bindings applied to DataTemplate
<DataTemplate x:DataType="viewModels:ListItemViewModel">
...
</DataTemplate>
@MartinZikmund
MartinZikmund / ClassicBinding.xaml
Created November 19, 2018 22:43
Switching back to classic Xamarin.Forms bindings
<Grid x:DataType="viewModels:SomeViewModel">
<!-- compiled bindings are applied here -->
<Grid x:DataType="{x:Null}">
<!-- compiled bindings no longer apply here -->
</Grid>
</Grid>
@MartinZikmund
MartinZikmund / ByteShiftFirstApproach.cs
Created January 6, 2019 07:58
First (wrong) approach for converting two little-endian bytes to ushort
var result = (ushort)(data[position + 1] << 8 + data[position]);
@MartinZikmund
MartinZikmund / ByteShiftSecondApproach.cs
Created January 6, 2019 08:00
Correct approach for converting two little-endian bytes to ushort
var result = (ushort)((data[position + 1] << 8) + data[position]); //note the additional parentheses
@MartinZikmund
MartinZikmund / ByteShiftFirstApproachPrecedence.cs
Last active January 6, 2019 08:05
Precedence of operators
8 + data[position]