This template let's you easily implement a property getter like this:
- (UIView *)myView {
if (!_myView) {
_myView = [UIView new];
}
return _myView;
}
configure | |
# Configure Firewall | |
set firewall ipv6-name IPV6WAN_IN description 'IPV6WAN to internal' | |
set firewall ipv6-name IPV6WAN_IN default-action drop | |
set firewall ipv6-name IPV6WAN_IN rule 10 action accept | |
set firewall ipv6-name IPV6WAN_IN rule 10 state established enable | |
set firewall ipv6-name IPV6WAN_IN rule 10 state related enable | |
set firewall ipv6-name IPV6WAN_IN rule 10 log disable |
This template let's you easily implement a property getter like this:
- (UIView *)myView {
if (!_myView) {
_myView = [UIView new];
}
return _myView;
}
Storyboard Segues initially seem like a pretty cool way to construct interfaces using minimal glue code. But actually, ordinary nibs already support this, and in a much more flexible way.
Certainly, a Storyboard lets you bind a button action up to display a view controller with no code, but in practice you will usually want to pass some data to the new controller, depending on which button you used to get there, and this means implementing the -prepareForSegue:sender: method, which rapidly becomes a giant if/elseif statement of doom, negating most of the benefit of the codeless segue:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"modalSegue"])
{
ModalViewController *controller = (ModalViewController *)segue.destination;
controller.someProperty = someValue;
@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. |
typedef enum _UIBackgroundStyle { | |
UIBackgroundStyleDefault, | |
UIBackgroundStyleTransparent, | |
UIBackgroundStyleLightBlur, | |
UIBackgroundStyleDarkBlur, | |
UIBackgroundStyleDarkTranslucent | |
} UIBackgroundStyle; | |
@interface UIApplication (UIBackgroundStyle) | |
-(void)_setBackgroundStyle:(UIBackgroundStyle)style; |
// | |
// Dynamic properties in categories | |
// | |
// @see http://www.davidhamrick.com/2012/05/28/Adding-Properties-to-an-Objective-C-Category-Revisted.html | |
// @see https://twitter.com/nicklockwood/status/384088702768922625 | |
// @see http://www.tuaw.com/2013/04/10/devjuice-better-objective-c-associated-objects/ | |
// @see http://stackoverflow.com/questions/16020918/avoid-extra-static-variables-for-associated-objects-keys | |
// | |
// Remember to add #import <objc/runtime.h> in implementation. | |
// |
#define self \ | |
( \ | |
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wunused-value\"") self, \ | |
/* Depends on _cmd being a const copy, like other captured variables. */ \ | |
_Pragma("clang diagnostic pop") (*(_cmd = _cmd, &self)) \ | |
) | |
// Replace libextobjc's @weakify with one that's aware of the "self" macro. | |
#undef ext_weakify_ | |
#define ext_weakify_(INDEX, CONTEXT, VAR) \ |
In order for this to work you need ffmpeg. I tried with version 1.2.1. | |
1) Play the video you want to download in the browser | |
2) Inspect the video element on the page | |
3) Copy the video url from the page source (something like http://devstreaming.apple.com/videos/wwdc/2013/.../101/ref.mov) | |
4) In this url replace "ref.mov" with "iphone_c.m3u8" (for 960x540 resolution) or "atp.m3u8" if you want more (probably 720p?) | |
5) Execute `ffmpeg -y -i http://devstreaming.apple.com/videos/wwdc/2013/.../101/iphone_c.m3u8 output.mp4` | |
6) There is your video :) |
// Defines a yet undocumented method to add a warning if super isn't called. | |
#ifndef NS_REQUIRES_SUPER | |
#if __has_attribute(objc_requires_super) | |
#define NS_REQUIRES_SUPER __attribute((objc_requires_super)) | |
#else | |
#define NS_REQUIRES_SUPER | |
#endif | |
#endif |