This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
// typedef | |
typedef NSString*(^ConvertBlock)(NSString *text); | |
@interface Thing : NSObject | |
@property (nonatomic, strong) void (^coolPropertyBlock)(NSString *text); // Property | |
// method param | |
- (void)doSomething:(void(^)(NSString *text))block with:(NSString *)person; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Understanding Value and Reference Types in Swift | |
/* | |
One of the coolest parts about Swift is how powerful all the types are. Structs are not like basic C structs, they have a lot of similarities with classes, and the same goes for the Enums. This is really good but also comes with the risk that newcomers doesn't know the differences between them. The oficial Swift blog has a great post about [Value and Reference Types](https://developer.apple.com/swift/blog/?id=10), read it. | |
In this post/playground I want to go step by step in some cases that will help newcomers understand how the different types work in Swift. It's good for people that comes form Objective-C to understand how Swift still has pointers, but hidden behind the language to make it safe. And for the newcomers, that doesn't know much about programming or *pointers*, will be good to understand what's actually happening behind the scenes. | |
## Categorization | |
Swift has two categories of Types: Value and Reference. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local wait = 60 | |
os.loadAPI("weather") | |
local city = "London,uk" | |
while true do | |
local commandBlock = peripheral.wrap("back") | |
local w = weather.getWeather(city) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import "Smiler.h" | |
@interface Amazing : NSObject <Smiler> | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri-plist' | |
require 'uri' | |
class SRLItem | |
attr_accessor :title | |
attr_accessor :url | |
attr_accessor :source | |
def initialize(dict) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Stack { | |
typealias Element | |
mutating func push(value: Element) | |
mutating func pop() -> Element? | |
} | |
struct ArrayStack<T>: Stack { | |
.... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
If you want to use blocks the only method that works is: | |
setImageWithURLRequest:placeholderImage:success:failure: | |
But you don't want to use URLRequest! | |
*/ | |
// .h | |
- (void)setImageWithURL:(NSURL *)url | |
placeholderImage:(UIImage *)placeholderImage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
while : | |
do | |
./querydb.sh | |
sleep 2 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// UIViewController+ModalCheck.h | |
// | |
// Created by Felipe Sabino on 06/14/11 | |
#import <UIKit/UIKit.h> | |
@interface UIViewController (ModalCheck) | |
-(BOOL)isPresentedAsModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
embed, iframe, object { max-width: 100%; } |
OlderNewer