Skip to content

Instantly share code, notes, and snippets.

View spencerwhyte's full-sized avatar

Spencer Whyte spencerwhyte

  • Ottawa
View GitHub Profile
@spencerwhyte
spencerwhyte / FloatingTextLabel2.swift
Created October 4, 2018 17:30
Another feable attempt at trying to make a performant UITextView -- just not worth the trouble
class FloatingTextView: UIControl, UITextViewDelegate {
var label: String? {
didSet {
floatingLabel.text = label
hintLabel.text = label
}
}
var text: String? {
@spencerwhyte
spencerwhyte / FloatingTextView.swift
Created October 3, 2018 23:55
Beginnings of a floating label text view
//
// FloatingTextView.swift
// DocumentsUI
//
// Created by Spencer Whyte on 2018-10-03.
// Copyright © 2018 Probuild Software Inc. All rights reserved.
//
import UIKit
@spencerwhyte
spencerwhyte / extract_options.bash
Created February 18, 2016 05:40
You have some html options, and you want the contents of the tags.
cat data | sed 's/<option value=".*">//g' | sed 's/<\/option>//g' | sed 's/^ *//' | sed 's/\&amp;/\&/' | sed '/^$/d' | sed 's/$/",/' | sed 's/^/"/g' | tr '\n' ' '
@spencerwhyte
spencerwhyte / UITestDatePicker.swift
Created December 26, 2015 23:24
You have a date picker and you want to set the date on it using a NSDate object.
let dateObject = NSDate()
let dayFormatter = NSDateFormatter()
dayFormatter.dateFormat = "MMM dd"
let hourFormatter = NSDateFormatter()
hourFormatter.dateFormat = "HH"
let minuteFormatter = NSDateFormatter()
minuteFormatter.dateFormat = "mm"