This file contains hidden or 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
<?php | |
/** | |
* call back testing | |
* | |
* @return void | |
* @author saturngod | |
**/ | |
function callback_testing($callback) |
This file contains hidden or 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
CREATE TABLE IF NOT EXISTS `posts` ( | |
`id` INT NOT NULL AUTO_INCREMENT , | |
`title` VARCHAR(255) NULL , | |
`content` TEXT NULL , | |
PRIMARY KEY (`id`) ) | |
ENGINE = InnoDB; |
This file contains hidden or 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
$app = new Slim(); | |
//GET route | |
$app->get('/hello/:name', function ($name) { | |
echo "Hello, $name"; | |
}); | |
//POST route | |
$app->post('/person', function () { | |
//Create new Person |
This file contains hidden or 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
@interface Article : NSObject | |
@property (nonatomic, retain) NSString* title; | |
@property (nonatomic, retain) NSString* body; | |
@property (nonatomic, retain) NSString* author; | |
@property (nonatomic, retain) NSDate* publicationDate; | |
@end |
This file contains hidden or 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
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul); | |
dispatch_async(queue, ^{ | |
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:profile_img]]]; | |
dispatch_sync(dispatch_get_main_queue(), ^{ | |
[[cell imageView] setImage:image]; | |
[cell setNeedsLayout]; | |
}); | |
}); |
This file contains hidden or 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* usernamepwd =[NSString StringWithFormat:@"%@:%@",username,password]; | |
NSData* base64=[usernamepwd dataUsingEncoding:NSASCIIStringEncoding]; | |
NSString* authHeader=[NSString stringWithFormat:@"Basic %@", [base64 base64Encoding]]; | |
[request addValue:authHeader forHTTPHeaderField:@"Authorization"]; |
This file contains hidden or 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
// | |
// NSData+Additions.h | |
// | |
// Created by Samuel Chow on 4/26/11. | |
// Copyright 2011 MobyFab. All rights reserved. | |
// | |
@interface NSData (MBBase64) | |
+ (id)dataWithBase64EncodedString:(NSString *)string; // Padding '=' characters are optional. Whitespace is ignored. |
This file contains hidden or 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
NSLog(@"%@",[request allHTTPHeaderFields]); |
This file contains hidden or 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/UIKit.h> | |
@interface MBRoundProgressView : UIView | |
- (void)setProgress:(float)progress; | |
- (float)progress; | |
@end |
This file contains hidden or 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
var mysql= require('mysql'); | |
var client = mysql.createClient({ | |
user: 'root', | |
password: 'root', | |
host: 'localhost' | |
}); | |
client.query('USE sample'); |