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
/** | |
* Some sample code... | |
* User: fred | |
* Date: 8 févr. 2010 | |
* Time: 11:51:51 | |
*/ | |
// Create a new connection on localhost (assuming that a redis server is launched on default port) | |
Gredis g = new Gredis().connect() |
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
def generateMD5(String s) { | |
MessageDigest digest = MessageDigest.getInstance("MD5") | |
digest.update(s.bytes); | |
new BigInteger(1, digest.digest()).toString(16).padLeft(32, '0') | |
} |
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
/* | |
** Display image in UIWebView using loadHTMLString | |
*/ | |
- (void) showImageWithLoadHTMLString { | |
// Create URL string for image file location | |
NSString *imageName = [[NSBundle mainBundle] pathForResource:@"test_image" ofType:@"png"]; | |
NSURL *imageURL = [NSURL fileURLWithPath: imageName]; | |
// Create HTML string from image URL | |
// Width-value is arbitrary (and found experimentally): 900 works fine for me |
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
/* Selective / dynamic UI orientation | |
Simply add this method (updateOrientation) to your class and call it in: | |
-(void) viewWillAppear:(BOOL)animated | |
{ | |
[super viewWillAppear:animated]; | |
[self updateOrientation]; | |
} |
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
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 |
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
- (void) loadData { | |
dataLoaded = NO; | |
NSLog(@" thread launched"); | |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
[self loadDataFromURL:nil]; | |
dataLoaded = YES; | |
// reload de la tableview dans le thread principal: | |
[self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:YES]; |
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
// Regarde aux alentours de la ligne 267 de Facebook.m (ça dépends des versions toutefois): | |
// Le SSO foire avec SAFARI, donc désactive le redirect vers Safari... | |
- (void)authorize:(NSArray *)permissions | |
urlSchemeSuffix:(NSString *)urlSchemeSuffix { | |
self.urlSchemeSuffix = urlSchemeSuffix; | |
self.permissions = permissions; | |
// ICI | |
[self authorizeWithFBAppAuth:NO safariAuth:NO]; |
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
2014-04-22 08:47:39.475 puck[97176:507] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: open)' | |
*** First throw call stack: | |
( | |
0 CoreFoundation 0x00007fff9196725c __exceptionPreprocess + 172 | |
1 libobjc.A.dylib 0x00007fff8fabce75 objc_exception_throw + 43 | |
2 CoreFoundation 0x00007fff9186246e -[__NSDictionaryM setObject:forKey:] + 1102 | |
3 puck 0x000000010bb9e704 puck + 14084 | |
4 libdyld.dylib 0x00007fff944c95fd start + 1 | |
5 ??? 0x0000000000000008 0x0 + 8 | |
) |
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
// Ref: https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithBlocks/WorkingwithBlocks.html#//apple_ref/doc/uid/TP40011210-CH8-SW9 | |
if (type == SRFSideBarHeaderTypeClear) { | |
self.backgroundView.hidden = YES; | |
self.titleImageView.hidden = YES; | |
} | |
else { | |
NSString *imageName = ^{ | |
switch (type) { |
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
;; User keymap | |
;; ----------------------------- | |
;; Keymaps are stored as a set of diffs that are merged together together | |
;; to create the final set of keys. You can modify these diffs to either add | |
;; or subtract bindings. | |
;; | |
;; Like behaviors, keys are bound by tag. When objects with those tags are active | |
;; the key bindings are live. Keys can be bound to any number of Light Table commands, | |
;; allowing you the flexibility to execute multiple operations together. To see a list | |
;; of all the commands you can execute, start typing a word related to the thing you |
OlderNewer