most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat| #!/bin/sh | |
| # Current as working as of 2012/4/17 | |
| # Xcode 4.3.2 | |
| PROJECT_ROOT="$HOME/SomeDirWhereYourProjectLives/XXXXXXXX" | |
| WORKSPACE="$PROJECT_ROOT/XXXXXXXX.xcodeproj/project.xcworkspace" | |
| CONFIG="AdHoc" | |
| SCHEME="XXXXXXXX" |
| #!/usr/bin/env python | |
| import argparse, os, re, subprocess | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('--sdk', default='', help='OS X or iOS SDK directory') | |
| parser.add_argument('--no-frameworks', action='store_true', default=False, help='do not print frameworks, only unprefixed classes') | |
| args = parser.parse_args() | |
| print_frameworks = not args.no_frameworks |
| // | |
| // OLD AND BUSTED | |
| // | |
| if ([self.zoomingDelegate respondsToSelector:@selector(zoomingWindow:didZoomOutViewController:)] == YES) | |
| { | |
| // Do something important. | |
| } | |
| // |
| @implementation BHSCollectionViewFlowLayout | |
| - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect { | |
| NSArray *allAttrs = [super layoutAttributesForElementsInRect:rect]; | |
| for (UICollectionViewLayoutAttributes *attributes in allAttrs) { | |
| attributes.frame = CGRectIntegral(attributes.frame); | |
| } | |
| return allAttrs; | |
| } |
| @interface DDDelegateProxy : NSProxy | |
| + (id)proxyForDelegate:(id)delegate conformingToProtocol:(Protocol *)protocol; | |
| @property (weak, readonly) id delegate; | |
| @property (strong, readonly) Protocol *protocol; | |
| /*! | |
| * Set a default return value for a method on the delegate's protocol. | |
| * \param value This must be a block that returns the default value. Bad Things will happen if it's not. |
| // http://stackoverflow.com/a/19277383 | |
| // | |
| - (void)textViewDidChange:(UITextView *)textView | |
| { | |
| CGRect line = [textView caretRectForPosition:textView.selectedTextRange.start]; | |
| CGFloat overflow = line.origin.y + line.size.height | |
| - ( textView.contentOffset.y + textView.bounds.size.height | |
| - textView.contentInset.bottom - textView.contentInset.top ); | |
| if (overflow > 0) { | |
| // We are at the bottom of the visible text and introduced a line feed, scroll down (iOS 7 does not do it) |
| BOOL MTDIsBoldTextEnabled(void) { | |
| static BOOL boldTextEnabled = NO; | |
| static dispatch_once_t onceToken; | |
| dispatch_once(&onceToken, ^{ | |
| // Hack that checks if the "bold text" flag in the accessibility settings is enabled | |
| UIFont *font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; | |
| boldTextEnabled = [font.fontName rangeOfString:@"MediumP4"].location != NSNotFound; | |
| }); |
| curl https://developer.apple.com/videos/wwdc/2014/ | grep -iIoh 'http.*._hd_.*dl=1">HD' | sed -e 's/\?dl=1">HD//g' | xargs -n1 wget -N g |
| // | |
| // CollectionViewDataSource.swift | |
| // Khan Academy | |
| // | |
| // Created by Andy Matuschak on 10/14/14. | |
| // Copyright (c) 2014 Khan Academy. All rights reserved. | |
| // | |
| import UIKit |