Skip to content

Instantly share code, notes, and snippets.

View noutram's full-sized avatar

Nicholas Outram noutram

View GitHub Profile
@noutram
noutram / main.cpp
Last active March 16, 2023 18:49
Mbed OS Communication with mosquitto MQTT broker
/*
* Copyright (c) 2006-2020 Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*/
#include "uop_msb.h"
#include "mbed.h"
#include "EthernetInterface.h"
#include <MQTTClientMbedOs.h>
#include <stdio.h>
#include <string.h>
@noutram
noutram / IntToBoolConverter.cs
Last active December 20, 2019 13:44
Xamarin Forms Value Converter
/*
...
xmlns:local="clr-namespace:NAMESPACE"
...
<ContentPage.Resources>
<ResourceDictionary>
<local:IntToBoolConverter x:Key="intToBool" />
</ResourceDictionary>
</ContentPage.Resources>
...
@noutram
noutram / gist:febdec49ef494f511c0f50cc9c8c9129
Created December 19, 2019 13:24
C# - difference between typeof, GetType and is
`typeof` takes a type name (which you specify at compile time).
`GetType` gets the runtime type of an instance.
`is` returns true if an instance is in the inheritance tree.
https://stackoverflow.com/questions/983030/type-checking-typeof-gettype-or-is
@noutram
noutram / ViewModel.cs
Created November 9, 2019 15:20
Xamarin ViewModel Class
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms;
namespace BasicNavigation
{
public class MainPageViewModel : INotifyPropertyChanged
@noutram
noutram / PersonDetailsModel.cs
Last active November 9, 2019 15:20
Xamarin Model Class
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace BasicNavigation
{
public class PersonDetailsModel : INotifyPropertyChanged
{
private string name;
private int birthYear;
@noutram
noutram / grid.xaml
Last active August 26, 2019 08:46
Example of Grid Layout
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="FormsAppTest.MainPage">
<StackLayout>
<!-- Note the use of ATTACHED PROPERTIES Grid.Row and Grid.Column -->
@noutram
noutram / enum_extension.cs
Created July 8, 2019 12:33
Method extension of an enumerated type in C#
public static class Extensions
{
public static string ToString(this BodyParameter p)
{
switch (p)
{
case BodyParameter.HEIGHT:
return "Height";
case BodyParameter.WEIGHT:
return "Weight";
@noutram
noutram / fifo_test_v2.vhd
Last active March 21, 2019 10:58
Alternative testbench using a lookup table
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
LIBRARY altera_mf;
USE altera_mf.altera_mf_components.all;
entity fifo_test_v2 is
end fifo_test_v2;
library ieee;
use ieee.std_logic_1164.all;
LIBRARY altera_mf;
USE altera_mf.altera_mf_components.all;
entity fifo_test is
end fifo_test;
architecture rtl of fifo_test is