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
numbers :: Int -> Int -> Int -> [[Int]] | |
numbers _ _ 0 = [[]] | |
numbers start end num = [n:ns | n <- [start..end], ns <- numbers n end (num - 1)] |
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
NSString* urlString = @"javascript:(function(){var%20a='日本語';prompt(a);})();"; | |
//NSString* urlString = @"dpad://?text=日本語&title=タイトル"; | |
//NSString* urlString = @"dpad://bookmark?title=日本語&url=http://bricklife.com/日本語"; | |
NSString* decodeString = [urlString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; | |
NSLog(@"decodeString:\t%@", decodeString); | |
NSString* encodeString = [decodeString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; | |
NSLog(@"encodeString:\t%@", encodeString); | |
NSURL* url = [NSURL URLWithString:encodeString]; |
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
// making a string | |
NSMutableString *s = [[NSMutableString alloc] initWithCapacity:256]; | |
for (char c = 0x20; c < 0x7f; c++) { | |
[s appendFormat:@"%c", c]; | |
} | |
[s appendString:@"日本語"]; | |
NSString *original = [NSString stringWithString:s]; | |
NSLog(@"original:[%@]", original); | |
// setting a character set |
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
#include <my_global.h> | |
#include <mysql.h> | |
void TestMySQL() | |
{ | |
TRACE("MySQL client version: %s\n", mysql_get_client_info()); | |
MYSQL *conn = mysql_init(NULL); | |
if (conn == NULL) { | |
TRACE("Error %u: %s\n", mysql_errno(conn), mysql_error(conn)); |
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
NSArray *input = [NSArray arrayWithObjects: | |
@"dpad://?text=abc", | |
@"dpad:///insert?text=abc", | |
@"dpad://editor/?text=abc", | |
@"dpad://editor/insert?text=abc&location=overwrite", | |
@"dpad://bookmark/add?title=Google&url=http://www.google.com/", | |
@"dpad://clip/add?title=abc&code=ABC", | |
@"dpad://browser/open?url=http://www.google.com/", | |
@"dpad://clipboard/copy?text=abc", | |
nil]; |
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
# MyObject.h | |
@interface MyObject : NSObject | |
@property (nonatomic, copy) void (^block)(); | |
@property (nonatomic, copy) NSString *str; | |
- (void)performBlock; | |
@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
cat <file path> | openssl dgst -md5 -binary | openssl enc -base64 |
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
RAC(self, text) = self.textField.rac_textSignal; | |
=> | |
RACSubscriptingAssignmentTrampoline *trampoline = [[RACSubscriptingAssignmentTrampoline alloc] initWithTarget:self nilValue:nil]; | |
trampoline[@keypath(self, text)] = self.textField.rac_textSignal; | |
=> | |
[self.textField.rac_textSignal setKeyPath:@keypath(self, text) onObject:self nilValue:nil]; |
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 "TableViewController.h" | |
#import <ReactiveCocoa/ReactiveCocoa.h> | |
#import <ReactiveCocoa/RACDelegateProxy.h> | |
@interface TableViewController () | |
@property (nonatomic, strong) RACDelegateProxy *tableViewDelegate; | |
@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
import UIKit | |
class InputAccessoryTableViewController: UITableViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.tableView.becomeFirstResponder() | |
} | |
OlderNewer