Skip to content

Instantly share code, notes, and snippets.

View tobitech's full-sized avatar
🌎
Changing the World

Tobi Omotayo tobitech

🌎
Changing the World
View GitHub Profile
import SwiftUI
import SensitiveContentAnalysis
struct ContentView: View {
enum AnalysisState {
case notStarted
case analyzing
case isSensitive
case notSensitive
@tobitech
tobitech / WebViewExampleViewController.swift
Created June 10, 2020 21:05 — forked from fxm90/WebViewExampleViewController.swift
Show progress of WKWebView in UIProgressBar that is attached to an UINavigationBar
//
// WebViewExampleViewController.swift
//
// Created by Felix Mau on 06.01.18.
// Copyright © 2018 Felix Mau. All rights reserved.
//
import UIKit
import WebKit
@tobitech
tobitech / NestableCodingKey.swift
Last active February 12, 2020 01:54 — forked from AliSoftware/Demo.swift
NestableCodingKey: Nice way to define nested coding keys for properties
import Foundation
//: # NestedKey
///
/// Use this to annotate the properties that require a depth traversal during decoding.
/// The corresponding `CodingKey` for this property must be a `NestableCodingKey`
@propertyWrapper
struct NestedKey<T: Decodable>: Decodable {
var wrappedValue: T
struct AnyCodingKey: CodingKey {
import UIKit
import XCTest
import MapKit
class ExampleTests: XCTestCase {
//declaring the ViewController under test as an implicitly unwrapped optional
var viewControllerUnderTest : ViewController!
override func setUp() {
<html>
<head>
<title>API Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
var accessToken = "<your agent's client access token>";
var baseUrl = "https://api.api.ai/v1/";
@tobitech
tobitech / textHeight.m
Created February 27, 2017 11:50 — forked from brennanMKE/textHeight.m
Text Height in Objective-C for NSString and NSAttributedString
- (CGFloat)heightForAttributedString:(NSAttributedString *)text maxWidth:(CGFloat)maxWidth {
if ([text isKindOfClass:[NSString class]] && !text.length) {
// no text means no height
return 0;
}
NSStringDrawingOptions options = NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading;
CGSize size = [text boundingRectWithSize:CGSizeMake(maxWidth, CGFLOAT_MAX) options:options context:nil].size;
@tobitech
tobitech / Xcode.txt
Created January 11, 2017 08:32 — forked from tangzhen/Xcode.txt
git ignore file for Xcode
#########################
# update 4 June 2014
# ignore Pods folder and Podfile.lock
#########################
Pods
Podfile.lock
#########################
# https://gist.github.com/foundry/4383910
import UIKit
import StreamingKit
private let singletonInstance = NineInchAudio()
class NineInchAudio {
class var manager: NineInchAudio {
return singletonInstance
}