Skip to content

Instantly share code, notes, and snippets.

View davidwhitney's full-sized avatar
🍸
You're all wonderful. That's what's happening.

David Whitney davidwhitney

🍸
You're all wonderful. That's what's happening.
View GitHub Profile
@davidwhitney
davidwhitney / Dojo6.cs
Created May 14, 2020 17:11
Santa Kata
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;
using NUnit.Framework;
namespace dojo6.Test.Unit
{
public class FileParser
{
@davidwhitney
davidwhitney / Cargo.toml
Created May 6, 2020 17:28
Rusty Mars Rover
[package]
name = "rover"
version = "0.1.0"
authors = ["David Whitney <david@davidwhitney.co.uk>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
import { Code } from "./AsciiArt";
describe("Code", async () => {
let sut;
beforeEach(() => {
sut = new Code();
});
it("A single white pixel returns '.'", async () => {
const result = await sut.makeArtFrom("app/white.jpg");
@davidwhitney
davidwhitney / espruinoflash.sh
Created January 29, 2020 11:52
Flash an ESP32 with Espruino
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 bootloader.bin 0x8000 partitions_espruino.bin 0x10000 espruino_esp32.bin
@davidwhitney
davidwhitney / NanoJumper.cs
Created January 29, 2020 11:47
NanoFramework Code Example
public class Program
{
public const int DefaultDelay = 1000;
public static void Main() => new Program().Run();
public Program()
{
Console.WriteLine("Constructors are awesome.");
}
@davidwhitney
davidwhitney / IntCodeVm.cs
Last active December 12, 2019 23:52
Advent of Code IntCodeVm C# port
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace IntCodeVmSharp
{
public class IntCodeVm
{
public bool PauseOnOutput { get; set; }
typedef struct {
const char* key;
int value[100];
} key_value_pair;
const auto empty = new key_value_pair();
key_value_pair images[] {
{"snowman", {1, 2, 3, 4, 5} },
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
@davidwhitney
davidwhitney / setup.ps1
Last active April 10, 2024 10:54
Machine setup chocolatey script
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco feature enable -n allowGlobalConfirmation
choco install notepad2
choco install notepadplusplus
choco install 7zip
choco install paint.net
choco install autoruns
choco install vcredist140
choco install dotnetfx
@davidwhitney
davidwhitney / gilded-rose.ts
Last active October 21, 2019 23:09
A Typescript version of the guilded rose
export class Item {
name: string;
sellIn: number;
quality: number;
constructor(name: string, sellIn: number, quality: number) {
this.name = name;
this.sellIn = sellIn;
this.quality = quality;
}