Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <vector>
using namespace std;
template<typename T> void draw(const T& x, ostream& out, size_t position);
class object_t {
public:
template<typename T> object_t(T x) : self_(make_unique<model<T>>(move(x))) {}
void draw(const my_class_t&, ostream& out, size_t position)
{
out << string (position, ' ') << "my_class_t" << endl;
}
int main() {
document_t document;
document.reserve(5);
document.emplace_back(my_class_t());
#include <iostream>
#include <vector>
using namespace std;
template <typename T>
void draw(const T& x, ostream& out, size_t position)
{
out << string(position, ' ') << x << endl;
}
/*
Copyright (C) 2016 Apple Inc. All Rights Reserved.
See LICENSE.txt for this sample’s licensing information
Abstract:
A struct for accessing generic password keychain items.
*/
import Foundation
import SwiftUI
enum ButtonState {
case pressed
case notPressed
}
struct PressedModifier: ViewModifier {
@GestureState private var isPressed = false
let changeState: (ButtonState) -> Void
//
// KeychainWrapper.swift
//
// Created by Oliver Epper on 27.05.20.
// Copyright © 2020 Oliver Epper. All rights reserved.
//
import Foundation
// This is a stripped down version of SwiftKeychainWraper
import Foundation
enum OneOff {}
enum Sustained {}
struct KuandoCommand<Kind>: ExpressibleByArrayLiteral {
typealias ArrayLiteralElement = UInt8
private(set) var data = [ArrayLiteralElement](repeating: 0, count: 64)
struct ContentView: View {
@State private var oben = false
var body: some View {
VStack {
if oben {
Text("HA").id(4)
Spacer()
} else {
Spacer()
@oliverepper
oliverepper / ReadOperation.swift
Last active February 20, 2021 09:21
ReadOperation
//
// Created by Oliver Epper on 16.02.21.
//
//
import Combine
import Foundation
final class ReadOperation: Operation {
enum ReadOperationError: Error {
@oliverepper
oliverepper / LinePublisher.swift
Last active February 14, 2021 09:29
LinePublisher
import Foundation
import Combine
class LinePublisherSubscription<S: Subscriber>: Subscription where S.Input == String, S.Failure == LinePublisher.Error {
let url: URL
let linesToRead: Int?
var subscriber: S?
var openDemand = Subscribers.Demand.none