Skip to content

Instantly share code, notes, and snippets.

View tsraveling's full-sized avatar

Tim Raveling tsraveling

View GitHub Profile
@tsraveling
tsraveling / Procfile
Created May 7, 2017 14:58
Python Twitter Bot
worker: python3 tweetbot.py
@tsraveling
tsraveling / CIFilterType.swift
Created May 9, 2017 17:35
Core Image Filter Types
enum CIFilterType : String {
case BoxBlur = "CIBoxBlur"
case DiscBlur = "CIDiscBlur"
case GaussianBlur = "CIGaussianBlur"
case MaskedVariableBlur = "CIMaskedVariableBlur"
case MedianFilter = "CIMedianFilter"
case MotionBlur = "CIMotionBlur"
case NoiseReduction = "CINoiseReduction"
case ZoomBlur = "CIZoomBlur"
case ColorClamp = "CIColorClamp"
@tsraveling
tsraveling / AppDelegate.swift
Created May 11, 2017 18:25
Play sound through speakers
// Play sound through speakers
do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord)
} catch _ {
}
do {
try AVAudioSession.sharedInstance().setActive(true)
} catch _ {
}
do {
static var audioPlayer : AVPlayer?
@tsraveling
tsraveling / matches-username-at-end.txt
Last active July 14, 2017 19:21
Regex pattern check
@.*[a-zA-z0-9_]$
@tsraveling
tsraveling / todo.sh
Created July 20, 2017 15:45
TODO Xcode Run Script
TAGS="TODO:|FIXME:"
echo "searching ${SRCROOT} for ${TAGS}"
find "${SRCROOT}" \( -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/"
@tsraveling
tsraveling / implementation.md
Last active July 25, 2017 15:46
Slideout Menu

1. Add pod:

pod 'SWRevealViewController', '~> 2.3'

2. Set up storyboard:

  • Set up a SWRevealViewController as the parent VC
  • Custom reveal set segue to menu with id sw_rear
  • Custom reveal set segue to main view with id sw_front
import UIKit
import MessageUI
extension UIViewController : MFMailComposeViewControllerDelegate, MFMessageComposeViewControllerDelegate, UINavigationControllerDelegate {
func sendEmail(_ to: [String], defaultSubject: String, defaultBody: String, _ completion : ((_ result: MFMailComposeResult) -> Void)? = nil) {
if MFMailComposeViewController.canSendMail() {
let mail = MFMailComposeViewController()
mail.mailComposeDelegate = self
mail.setToRecipients(to)
let string_id = UUID().uuidString
@tsraveling
tsraveling / Date+Styling.swift
Created September 9, 2017 22:03
Date Formatter
let globalDateFormatter : DateFormatter = {
let df = DateFormatter()
df.dateFormat = "MMMM d, yyyy"
return df
}()
extension Date {
static func fromString(_ source : String) -> Date? {