-
Intro to Rust - Variables
Wednesday, February 26, 2020
Variables are conceptually labeled boxes that we can store values. The box is the address in memory where the value is stored and the label is just a human readable alias for that address. All variable declarations in Rust start with the let keyword followed by the name we assign to variable. Here we are declaring a variable called z and assigning the value 12 to it: let z = 12; By default, all variables in Rust are immutable meaning you cannot re-assign a value to them.…more
-
Intro to Rust - Hello World
Tuesday, February 25, 2020
Installing and configuring Rust is a breeze with rustup which is an installer for Rust. You can download it by visiting: https://rustup.rs/ And following the onscreen instructions. You can confirm that the installation has worked by running: rustc --version The rustup installation also comes with another command line tool called cargo which is the Rust packager manager – akin to npm for Node. Rust packages are called crates and there is an online repository of crates visible here:…more
-
Intro to Typescript - Getting Started
Monday, February 24, 2020
What is TypeScript? TypeScript is a transpile-to-JavaScript language meaning that a program written in Typescript must first be translated (transpiled) to JavaScript before it can be run in the browser. Although compiling typically has a different meaning, the TypeScript community refers to this process as compilation. Why would anyone want to go through this process though? Because TypeScript comes with a host of features on top of those already available in JavaScript, all aimed at making writing JavaScript code more robust.…more
-
Intro to Object Oriented Programming
Friday, February 21, 2020
Introduction What exactly is an object? An object is defined by two components: properties and behaviors. A car has properties like its color, the year it was made, if it’s 4WD or not, etc. It also has behaviors such as starting, driving and so on. Having both of these components is key because if you just have behaviors then you’re simply dealing with functions that transform their inputs and return the output.…more
-
C# Structs
Thursday, February 20, 2020
Structs and Classes are constructed very similarly in C#: struct Book { private string title; private int[] editions; public string Title { get { return title; } set { title = value; } } public string Author { get; set; } public int[] Editions { get { return editions; } set { editions = value; } } public string Blurb() { return $"{Title} by {Author}"; } } And they are instantiated in the same way:…more
-
C# Autoimplemented Properties
Wednesday, February 19, 2020
In object-oriented programming, you’ll often be creating getters and setters for instance variables. For example: class Book { private string title; public Book(string title) { this.title = title; } GetTitle() { return title; } SetTitle(string title) { this.title = title; } } The problem with this is that it’s verbose and creating getters and setters is extremely common so it becomes a little cumbersome. Now, you might be thinking “If I can just freely get and set the instance variable, why not make its accessibility public?…more
-
Markdown Reference
Wednesday, February 19, 2020
Introduction This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I’ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won’t cover using CSS to style your theme. We’ll start with creating a new site with a very basic template.…more