Using a real artsy example from today.
Creating a follow button on a view controller for different types of objects Artist, Profile, Gene
Needs: networking Needs: layout Needs: interface changes based on networking
//cc -Weverything -fobjc-arc -framework Foundation bitmask.m -o bitmask | |
/** @file bitmask.m | |
* @author Jeremy W. Sherman (@jeremy-w on Github) | |
* @license ISC (http://opensource.org/licenses/isc-license.txt) | |
* | |
* Provides an example where assignment of the result of a naive bitmask check | |
* to BOOL fails. | |
* | |
* Demonstrates 2 ways to avoid this issue. | |
* |
(lldb) bt | |
* thread #1: tid = 0x6e9f, 0x0036d774 PSPDFCatalog`-[PSPDFDebugLayer setNeedsLayout](self=0x1656a190, _cmd=0x302e001d) + 44 at PSPDFDebugHelper.m:456, queue = 'com.apple.main-thread', stop reason = breakpoint 14.1 | |
frame #0: 0x0036d774 PSPDFCatalog`-[PSPDFDebugLayer setNeedsLayout](self=0x1656a190, _cmd=0x302e001d) + 44 at PSPDFDebugHelper.m:456 | |
frame #1: 0x2f9763e8 QuartzCore`CA::Layer::property_did_change(CA::Transaction*, unsigned int) + 1188 | |
frame #2: 0x2f975f1c QuartzCore`CA::Layer::end_change(CA::Transaction*, unsigned int, objc_object*) + 64 | |
frame #3: 0x2f976a54 QuartzCore`CA::Layer::set_bounds(CA::Rect const&, bool) + 540 | |
frame #4: 0x2f976776 QuartzCore`-[CALayer setBounds:] + 110 | |
frame #5: 0x2f97789c QuartzCore`-[CALayer setFrame:] + 636 | |
frame #6: 0x2fcf6336 UIKit`-[UIView(Geometry) setFrame:] + 254 | |
frame #7: 0x2fd075f4 UIKit`-[UIView(Geometry) sizeToFit] + 304 |
// 64-bit helper from <tgmath.h> | |
// Extracted because those overrides won't work with Modules. | |
#undef fmin | |
#define fmin(__x, __y) __tg_fmin(__tg_promote2((__x), (__y))(__x), \ | |
__tg_promote2((__x), (__y))(__y)) | |
#undef fmax | |
#define fmax(__x, __y) __tg_fmax(__tg_promote2((__x), (__y))(__x), \ | |
__tg_promote2((__x), (__y))(__y)) |
#!/usr/bin/python | |
# fix-xcode | |
# Rob Napier <robnapier@gmail.com> | |
# Script to link in all your old SDKs every time you upgrade Xcode | |
# Create a directory called /SDKs (or modify source_path). | |
# Under it, put all the platform directories: | |
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform | |
# Under those, store the SDKs: |
+ (AppDelegate *)sharedAppDelegate { | |
return (AppDelegate *)[[UIApplication sharedApplication] delegate]; | |
} |
//Throw this on your UITableViewDelegate (probably your UITableViewController) to achieve the "keyboard dismisses when I tap away" effect. | |
//Your users will thank you. A lot. | |
- (void) scrollViewWillBeginDragging:(UIScrollView *)scrollView { | |
[self.view endEditing:YES]; | |
} | |
//The endEditing: method on UIView comes to us from a category that UITextField adds to UIKit that makes the view or any subview that is the first responder resign (optionally force), that's what the "YES" bit is. |
module Gem; end | |
require 'rubygems/version' | |
namespace :version do | |
module InfoPlist | |
extend self | |
def [](key) | |
output = `/usr/libexec/PlistBuddy -c 'Print #{key}' Bananas-Info.plist`.strip |
{ | |
"auto_indent": true, | |
"auto_match_enabled": true, | |
"caret_style": "smooth", | |
"close_windows_when_empty": true, | |
"color_scheme": "Packages/Theme - Aqua/Color Schemes/Tomorrow Night Aqua.tmTheme", | |
"detect_indentation": true, | |
"dictionary": "Packages/Language - English/en_US.dic", | |
"draw_centered": false, | |
"draw_indent_guides": true, |