Skip to content

Instantly share code, notes, and snippets.

View mingsai's full-sized avatar
🎯
Focusing

Tommie N. Carter, Jr. mingsai

🎯
Focusing
View GitHub Profile
@mingsai
mingsai / automator_script
Created March 23, 2014 23:11
Convert Chinese Characters to Pinyi
# Assumes you have rdef utility installed in /usr/local/bin
# rdef can be found here: https://github.com/mingsai/rdef
# See accompanying readme.txt for instructions to create MacOSX service
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin/:
export PATH
LC_CTYPE=UTF-8
x=$1
for ((i=0;i<${#x};i++)); do rdef "${x:i:1}" | awk -F '\|' 'BEGIN {ORS=" "}{ gsub(/^ | +?/, "", $2); if (length($2) > 0) print $2 ; exit}'; done
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2013 Peter Steinberger. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
#import <objc/runtime.h>
#import <objc/message.h>
// Compile-time selector checks.
//
// PSPDFThreadSafeMutableDictionary.m
//
// Copyright (c) 2013 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@mingsai
mingsai / MNGLayerExtensions.swift
Last active August 29, 2015 14:24
A swift extension that allows one to use gradient colors on all UIControls and UIViews and subviews (e.g. UIButton, etc. pretty much anything on screen)
//
// MNGLayerExtensions.swift
//
//
// Created by Tommie N. Carter, Jr., MBA on 6/21/15.
// Copyright © 2015 MING Technology. All rights reserved.
//
// Sample usage: self.view.layer.configureGradientBackground(UIColor.purpleColor().CGColor, UIColor.blueColor().CGColor, UIColor.whiteColor().CGColor)
// Nota Bene: Function can be applied to any UIControl that also has a view.layer property. Resolves the issue of gradient not covering full area on rotation by resizing the layer to a square
@mingsai
mingsai / MNGTextViewHandler.swift
Created July 2, 2015 23:53
A textview delegate to catch and throw messages as needed by textview events
//
// MNGTextViewHandler.swift
//
//
// Created by Tommie N. Carter, Jr., MBA on 6/18/15.
// Copyright © 2015 MING Technology. All rights reserved.
//
import UIKit
@mingsai
mingsai / MNGTextFieldHandler.swift
Created July 2, 2015 23:54
A textfield delegate used to catch and throw messages related to textfield events
//
// MNGTextFieldHandler.swift
//
//
// Created by Tommie N. Carter, Jr., MBA on 6/18/15.
// Copyright © 2015 MING Technology. All rights reserved.
//
import UIKit
@mingsai
mingsai / MNGCollectionViewHandler.swift
Created July 2, 2015 23:55
A delegate class to handle UICollectionView events
//
// MNGCollectionViewHandler.swift
//
//
// Created by Tommie N. Carter, Jr., MBA on 6/21/15.
// Copyright © 2015 MING Technology. All rights reserved.
//
import UIKit
@mingsai
mingsai / MNGApplicatioNExtensions.swift
Created July 2, 2015 23:57
Extensions to the UIApplication along with a convenient place to store global constants when needed
//
// MNGApplicationExtensions.swift
//
//
// Created by Tommie N. Carter, Jr., MBA on 6/22/15.
// Copyright © 2015 MING Technology. All rights reserved.
//
import UIKit
@mingsai
mingsai / MNGAVAudioSessionExtensions.swift
Created July 2, 2015 23:59
An AVAudioSession delegate to manage audio session events and an extension to the AVAudioSession to manage convenient setup for various audio profiles
//
// MNGAVAudioSessionExtensions.swift
//
//
// Created by Tommie Carter on 6/30/15.
// Copyright © 2015 MING Technology. All rights reserved.
//
import AVFoundation
@mingsai
mingsai / MNGRecorderHandler.swift
Created July 3, 2015 00:01
A swift delegate for managing an AVAudioRecorder and it's related events.
//
// MNGRecorderHandler.swift
//
//
// Created by Tommie Carter on 6/29/15.
// Copyright © 2015 MING Technology. All rights reserved.
//
import AVFoundation