This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[cfg(test)] | |
mod tests { | |
use std::convert::TryInto; | |
use std::num::TryFromIntError; | |
#[test] | |
fn it_works() { | |
let a = 1i16; | |
let b: Result<i8, TryFromIntError> = a.try_into(); | |
assert!(b.is_ok()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Random code from https://docs.microsoft.com/en-ca/learn/paths/rust-first-steps/ | |
use std::fmt; | |
trait Distance<T> { | |
fn distance(&self) -> T; | |
} | |
#[derive(Debug, PartialEq)] | |
struct Point<T> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Advent of Code - 2015 Day 20 */ | |
#include <stdio.h> | |
#include <dispatch/dispatch.h> | |
int number_of_presents(int house) { | |
int n = 0; | |
for (int elf = 1; elf <= house; elf++) { | |
if ((house % elf) == 0) { | |
n += (10 * elf); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Disable Siri Suggestions on Simulators and SwiftUI Previews to | |
# avoid Spotlight heating up your MacBook by keeping 4 cores busy | |
# at 100%. | |
# | |
# See https://developer.apple.com/forums/thread/683277 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ContentView.swift | |
// WhatIsMyIP | |
// | |
// Created by Stefan Arentz on 02/10/2021. | |
// | |
import SwiftUI | |
struct Address { |
Here is a Link to the Mac App Store
And this is a Link to the iOS App Store
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -x | |
env CGO_CFLAGS="-mmacosx-version-min=10.15" CGO_LDFLAGS="-mmacosx-version-min=10.15" CGO_ENABLED=1 GOARCH=amd64 go build -installsuffix argussh_amd64 -o argussh-amd64.a -buildmode=c-archive | |
env CGO_CFLAGS="-mmacosx-version-min=10.15" CGO_LDFLAGS="-mmacosx-version-min=10.15" CGO_ENABLED=1 GOARCH=arm64 go build -installsuffix argussh_arm64 -o argussh-arm64.a -buildmode=c-archive | |
mv ./argussh-amd64.h ./argussh.h | |
lipo -create argussh-amd64.a argussh-arm64.a -output argussh.a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vapor | |
import Redis | |
struct Counter: Content { | |
let id: UUID | |
let name: String | |
let value: Int | |
} |