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
rails generate ckeditor:install --orm=active_record --backend=paperclip |
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
升级OSX的同学 运行这个代码就能修好postgresql | |
mkdir /usr/local/var/postgres/pg_tblspc | |
mkdir /usr/local/var/postgres/pg_twophase | |
mkdir /usr/local/var/postgres/pg_stat_tmp |
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
NSDateFormatter *startDateFormatter = [[NSDateFormatter alloc] init]; | |
[startDateFormatter setTimeZone:[NSTimeZone localTimeZone]]; | |
[startDateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"]; | |
NSDate *dateT = [startDateFormatter dateFromString:dateString]; |
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
https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ |
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
#define TimeZone [[NSTimeZone localTimeZone] name] | |
#define IS_IPHONE_6_PLUS ([[UIScreen mainScreen] respondsToSelector:@selector(nativeScale)] && [UIScreen mainScreen].nativeScale > 2.1) | |
#define IS_IPHONE_4 (fabs((double)[[UIScreen mainScreen]bounds].size.height - (double)480) < DBL_EPSILON) | |
#define IS_IPHONE_5 (fabs((double)[[UIScreen mainScreen]bounds].size.height - (double)568) < DBL_EPSILON) | |
#define IS_IPHONE_6 (fabs((double)[[UIScreen mainScreen]bounds].size.height - (double)667) < DBL_EPSILON) | |
#define IS_IPHONE5 (([[UIScreen mainScreen] bounds].size.height-568)?NO:YES) | |
#define IS_OS_5_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 5.0) | |
#define IS_OS_6_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 6.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
#pragma mark - UITextViewDelegate | |
- (void)textViewDidBeginEditing:(UITextView *)textView { | |
self.isTextViewEdit = YES; | |
_currentTextView = textView; | |
CGFloat distance; | |
distance = (self.firstURLDescriptionTextView == textView ? 70 : 180); | |
if (IS_IPHONE_6_PLUS) { | |
distance += 35.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
The main reason you use the default queue over the main queue is to run tasks in the background. | |
For instance, if I am downloading a file from the internet and I want to update the user on the progress of the download, I will run the download in the priority default queue and update the UI in the main queue asynchronously. | |
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){ | |
//Background Thread | |
dispatch_async(dispatch_get_main_queue(), ^(void){ | |
//Run UI Updates | |
}); | |
}); |
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)addTagGestureRecognizerToURLLabel { | |
// first image tag gesture recognizer setup | |
UITapGestureRecognizer *firstURLSingleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(url1TapEvent)]; | |
firstURLSingleTap.numberOfTapsRequired = 1; | |
self.link1Url.userInteractionEnabled = YES; | |
[self.link1Url addGestureRecognizer:firstURLSingleTap]; | |
UITapGestureRecognizer *secondURLSingleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(url2TapEvent)]; | |
secondURLSingleTap.numberOfTapsRequired = 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
`echo "#{row[7]}" >> #{Rails.root.join('missing_flavours.txt').to_s}` |
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
rake db:test:load |