Skip to content

Instantly share code, notes, and snippets.

View rr-codes's full-sized avatar

Richard Robinson rr-codes

View GitHub Profile
.,.,.,.,O,.,Y,.,.,.,O,.,.,.,O,.,.,.,.,.,
.,.,O,.,.,.,.,O,.,.,O,Y,.,.,.,.,.,.,O,.,
O,.,.,.,.,.,.,.,.,.,.,.,.,O,.,.,O,.,.,O,
.,.,O,Y,.,O,.,.,.,.,.,.,Y,.,.,.,.,Y,.,.,
.,.,.,.,.,.,.,.,.,.,.,O,.,.,.,.,.,.,.,.,
O,O,.,.,.,.,.,O,.,O,.,.,.,.,.,.,O,O,.,O,
.,.,.,.,.,O,.,.,.,.,.,.,O,.,.,.,.,.,.,O,
.,.,O,.,.,.,.,O,.,.,O,.,.,.,.,.,O,.,Y,.,
.,.,Y,.,.,.,.,O,Y,.,.,.,O,.,.,.,.,.,O,.,
O,.,.,.,.,.,.,.,.,.,.,.,.,.,O,.,.,.,.,.,
//
// LocalImageProvider.swift
// Countdown
//
// Created by Richard Robinson on 2020-08-26.
//
import Foundation
import PhotosUI
import SwiftUI
@rr-codes
rr-codes / main.py
Last active August 5, 2020 15:14
main.py --mode memory --suffix "Desktop" --output [some/output/folder] [some/input/folder]
import argparse
import os
import pandas
import regex as regex
from matplotlib import pyplot
colors = ['tab:purple', 'tab:blue']
@rr-codes
rr-codes / String+NLTagger.swift
Created July 25, 2020 22:12
A String extension to filter substrings based on parts of speech
import NaturalLanguage
extension String {
/// Extracts the substrings of this string which match any of the specified `partsOfSpeech`
///
/// For example,
///
/// let string = "John's anniversary in Greece"
/// let filtered = string.filter(by: [.noun, .placeName]) // ["anniversary", "Greece"]
///
@rr-codes
rr-codes / EmojiModel.swift
Last active August 1, 2020 10:56
A SwiftUI emoji picker
//
// EmojiModel.swift
// Countdown
//
// Created by Richard Robinson on 2020-07-31.
//
import Foundation
fileprivate let emojiCategories = [
//
// CardView2.swift
// Hourglass
//
// Created by Richard Robinson on 2020-07-21.
//
import Foundation
import SwiftUI
/// An implementation of `ProgressView` built in SwiftUI
struct ProgressViewSUI<Progress>: View where Progress: BinaryFloatingPoint {
var value: Progress
var body: some View {
GeometryReader { geometry in
ZStack(alignment: .leading) {
Capsule()
.foregroundColor(.gray)
.opacity(0.3)
@rr-codes
rr-codes / FluidView.swift
Created July 12, 2020 00:45
Currently, the invariant is false for all `percentFilled != 0.5 && angle != 0`. I believe this is because of the x-values of the points
/// A view representing a dynamically moving fluid with a quadrilateral
/// - Invariant: The area of the view is exactly equal to the area of the rectangle of the parent view times `percentFilled`
struct FluidView: Shape {
var angle: CGFloat = 0.0
var percentFilled: CGFloat = 0
var animatableData: CGFloat {
get { angle }
set { self.angle = newValue }
}
//
// Playground.swift
// Hourglass
//
// Created by Richard Robinson on 2020-07-06.
//
import Foundation
import SwiftUI
import PlaygroundSupport
package com.richardrobinson;
import java.io.BufferedReader;
import java.io.IOException;
import java.lang.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Stream;