Skip to content

Instantly share code, notes, and snippets.

@Sunnyztj
Sunnyztj / gist:8686815
Created January 29, 2014 12:19
Rspec command line
rake db:drop db:create db:migrate RAILS_ENV=test
bundle exec rspec .
shift+command+'R'
@Sunnyztj
Sunnyztj / gist:8927438
Last active August 29, 2015 13:56
navigation bar and search bar hide_show code
mbcoll
- (id)viewController
{
UIResponder *nextResponder =[[self superview] nextResponder];
if ([nextResponder isKindOfClass:[StoreListViewController class]]) {
return (StoreListViewController*)nextResponder;
}
else if ([nextResponder isKindOfClass:[OfferListViewController class]]){
return (OfferListViewController*)nextResponder;
@Sunnyztj
Sunnyztj / gist:8947661
Created February 12, 2014 00:47
google map
1.get center of map coordinate
CGPoint point = mapView.center;
CLLocationCoordinate2D coor = [mapView.projection coordinateForPoint:point];
@Sunnyztj
Sunnyztj / gist:9105614
Created February 20, 2014 01:59
how to get application frame
- (IBAction)loadDataButtonClicked:(id)sender {
if (_scaledDown) {
[self _beginReleaseAnimation];
}
[_delegate draggableViewTouched:self];
self.hideBtn.hidden = YES;
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
@Sunnyztj
Sunnyztj / gist:9661609
Created March 20, 2014 11:14
compare time in objective c
+(int)compareOneDay:(NSDate *)oneDay withAnotherDay:(NSDate *)anotherDay
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd-MM-yyyy"];
NSString *oneDayStr = [dateFormatter stringFromDate:oneDay];
NSString *anotherDayStr = [dateFormatter stringFromDate:anotherDay];
NSDate *dateA = [dateFormatter dateFromString:oneDayStr];
NSDate *dateB = [dateFormatter dateFromString:anotherDayStr];
NSComparisonResult result = [dateA compare:dateB];
NSLog(@"date1 : %@, date2 : %@", oneDay, anotherDay);
git tag 1.0.6
git push --tags
@Sunnyztj
Sunnyztj / gist:3488724b18f583d0c6cc
Created May 6, 2014 08:04
ThinkingSphinx::ConnectionError rails
ThinkingSphinx::ConnectionError rails
rake ts:rebuild
@Sunnyztj
Sunnyztj / gist:cd85d73bc41e59b33720
Created June 3, 2014 06:08
command not found: subl
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/.rvm/bin/subl
@Sunnyztj
Sunnyztj / gist:8c236402fe15c4a4c90a
Created June 4, 2014 04:38
fix imagemagick issue
brew uninstall jpeg
brew install jpeg
brew uninstall libtool
brew install libtool
@Sunnyztj
Sunnyztj / gist:d23aab96cd0dd77080b3
Created October 14, 2014 05:41
activeadmin add editor for text attribute
gem 'active_admin_editor'