Skip to content

Instantly share code, notes, and snippets.

View austenstrine's full-sized avatar

Austen L. Strine austenstrine

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<!-- I clearly copied and pasted some of this...check for over complexity please!-->
<style>
html, body{
min-height: 100%;
}
body{
//The purpose of this assignment was to create a program that would
//allow teachers to input three test scores, and get the average of
//those three. It specifically required the use of two functions
//(getTestScore and calcAverage)in the way I use them below. I
//added functionality to make it so that if the teacher put in a
//wrong value, such as a letter in place of a number for a number
//only variable (double or int) it would simply ask for input again
//until such a time as valid input is given. Also ensured that the
// >> operator would not freeze with invalid input. I also enabled
//teachers to do this for a certain number of students, and assign
//I got a tiny bit further in the book and realized I was
//coding pretty inefficiently in the switch/case area.
//These are the updates I made to that.
//
#include <iostream>
#include <iomanip>
#include <typeinfo>
#include <limits>
@austenstrine
austenstrine / scoreAverageProgram.cpp
Last active February 10, 2017 21:05
A program to help teachers average grades
//The purpose of the original assignment was to create a program that would
//allow teachers to input three test scores, and get the average of
//those three. I've altered it quite a bit, and the current version includes
//my first attempt at vectors (just taught myself how to use them today.)
//Planning on eventually making the averages be stored/retreivable.
//Also note that I follow the whitespace convention of indenting
//loops and if statements in entirety, and again for the body.
#include <iostream>
@austenstrine
austenstrine / ScopedPrintableStack.swift
Created February 14, 2019 20:06
A stack for gathering function names and printing them in a scope-level conscious fashion
import Foundation
struct ScopedPrintableStack: CustomStringConvertible
{
var items = [String]()
var description: String
{
var tabbedStackString:String = ""
for (index, string) in items.enumerated()
import Foundation
infix operator =!& : AssignmentPrecedence
func =!&<T:NSCopying>(lhs: inout T, rhs: T)
{
lhs = rhs.copy(with: nil) as! T
}
import Foundation
import CoreData
class CopyingCodable : Encodable, Decodable, NSCopying
{
func copy(with zone: NSZone? = nil) -> Any
{ //this is like...the ugliest code I've ever written
return try! JSONDecoder().decode(
type(of: self),
from: try! JSONEncoder().encode(self)
@austenstrine
austenstrine / AppManagedDataController.swift
Last active June 25, 2019 01:56
An API for CoreData that allows safe access and mutation of "global" variables.
// AppManagedDataController.swift
// Yah-El
//
// Created by Austen Strine on 5/20/19.
// Copyright © 2019 GoGreen. All rights reserved.
//
import CoreData
import 'package:json_annotation/json_annotation.dart';
import 'package:gogreen_utility_belt/interface_class/JSONSerializable.dart';
part 'Product.g.dart'; //flutter pub run build_runner build
@JsonSerializable()
class Product extends JSONSerializable {
static final Product example = Product(//comment out on build_runner build
upc: '10000000000',
inventory: 0,
categories: ['Rum'],
import Foundation
protocol PropertyLoopable {
func allProperties() -> [String: Any?]
}
extension Optional {
func unwrappedDebugString() -> String {
switch self {