I hereby claim:
- I am ahmattox on github.
- I am anthonymattox (https://keybase.io/anthonymattox) on keybase.
- I have a public key ASDnimJTesfRDN3xLlOqPK5HHKrY7eERguHRFkahNOmV-Ao
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
extension UITableView { | |
func animateSection<Element: Equatable>(section: Int, from:[Element], to: [Element], rowAnimation: UITableViewRowAnimation = .Top) { | |
assert(from.containsUniqueElements() && to.containsUniqueElements(), "\(#function) can only be used if all elements in the collection are unique.") | |
func path(index: Int) -> NSIndexPath { | |
return NSIndexPath(forRow: index, inSection: section) | |
} | |
// Find indexes in the old array that should be deleted |
// Resizes an image file to necessary sizes for iOS application icons. | |
// Accepts the path to the file to be resized, e.g. `swift icons.swift icon.png` | |
// Created by Anthony Mattox on 2016-02-11 | |
import Cocoa | |
extension NSImage { | |
func resize(size: CGSize) -> NSImage { | |
let cgImage = self.CGImageForProposedRect(nil, context: nil, hints: nil) |
function dsp(t) { | |
// return sinOsc(t, 220, .5); | |
return .3 * saw(t, 220, 4, .5) + saw(t, 221, 4, .5); | |
// return 0.1 * Math.sin(2 * Math.PI * t * 440); | |
} |
- (void) keyboardWillChangeFrame:(NSNotification *)notification { | |
CGRect originalKeyboardFrame = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; | |
CGRect keyboardFrame = [[[UIApplication sharedApplication] keyWindow] convertRect:originalKeyboardFrame toView:self]; | |
CGFloat keyboardHeight = CGRectIntersection(keyboardFrame, self.contentScrollView.frame).size.height; | |
[UIView animateWithDuration:[notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] floatValue] delay:0 options:[notification.userInfo[UIKeyboardAnimationCurveUserInfoKey] integerValue] animations:^{ | |
self.contentScrollView.scrollIndicatorInsets = UIEdgeInsetsMake(0, 0, keyboardHeight, 0); | |
self.contentScrollView.contentInset = UIEdgeInsetsMake(0, 0, keyboardHeight, 0); | |
} completion:nil]; | |
} |
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="3084" systemVersion="12C60" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="2"> | |
<dependencies> | |
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="2083"/> | |
</dependencies> | |
<scenes> | |
<!--View Controller--> | |
<scene sceneID="5"> | |
<objects> | |
<viewController id="2" customClass="TTViewController" sceneMemberID="viewController"> |
// | |
// FTWDropCapTextView.h | |
// | |
// Created by Anthony Mattox on 1/22/13. | |
// Copyright (c) 2013 Friends of The Web. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
@interface FTWDropCapTextView : UIView |
// | |
// UITextField+SelectionRanges.h | |
// Kitchen Unit Converter | |
// | |
// Created by Anthony Mattox on 1/5/13. | |
// Copyright (c) 2013 Friends of The Web. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> |
- (void) listFonts { | |
NSArray *familyNames = [UIFont familyNames]; | |
for (NSString *family in familyNames) { | |
NSLog(@"family: %@", family); | |
NSArray *styles = [UIFont fontNamesForFamilyName:family]; | |
for (NSString *style in styles) { | |
NSLog(@" - %@", style); | |
} | |
} | |
} |
// | |
// UIColor+Additions.h | |
// | |
// Created by Anthony Mattox on 9/28/12. | |
// Copyright (c) 2012 Friends of The Web. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
@interface UIColor (Additions) |