Skip to content

Instantly share code, notes, and snippets.

@Sunnyztj
Sunnyztj / gist:54aefde94eaabb8bdb45
Created November 11, 2014 00:18
git search a single file history
git log --all -p file_path
@Sunnyztj
Sunnyztj / gist:5def7e65134849215ff8
Created November 14, 2014 02:14
remove stuff from core data before fetching again
// remove stuff from core data before fetching again
RKObjectManager *sharedObjectManager = [RKObjectManager sharedManager];
NSError *err = nil;
[sharedObjectManager.managedObjectStore resetPersistentStores:&err];
self.searchCollectionView.hidden = YES;
self.fetchedResultsController = nil;
[self.searchCollectionView reloadData];
@Sunnyztj
Sunnyztj / gist:6b48e8288efb1dc59e6f
Created November 14, 2014 05:44
objective c smart code for cell button to get indexpath
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *kStandardCellID = @"StandardCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kStandardCellID];
if (cell.accessoryView == nil) {
// Only configure the Checkbox control once.
cell.accessoryView = [[Checkbox alloc] initWithFrame:CGRectMake(0, 0, 25, 43)];
cell.accessoryView.opaque = NO;
cell.backgroundColor = [UIColor clearColor];
subl `bundle show sitemap_generator`
@Sunnyztj
Sunnyztj / gist:6d97bfa2bfeae8ebdce8
Created November 27, 2014 00:07
ruby debug process
testing -> code -> testing -> code ....
@Sunnyztj
Sunnyztj / gist:da596603ca220a956a24
Created November 27, 2014 01:39
git skpayment via IPA API
http://stackoverflow.com/questions/2894321/how-to-access-the-price-of-a-product-in-skpayment
@Sunnyztj
Sunnyztj / gist:8d20a90666b64293b0fe
Created December 9, 2014 02:15
如果使用GCD
// 原代码块一
self.indicator.hidden = NO;
[self.indicator startAnimating];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// 原代码块二
NSURL * url = [NSURL URLWithString:@"http://www.youdao.com"];
NSError * error;
NSString * data = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:&error];
if (data != nil) {
// 原代码块三
@Sunnyztj
Sunnyztj / gist:c0348c29e10ffe7a73f2
Created December 16, 2014 04:05
delete separator
self.tableView.tableFooterView = [[UIView alloc] init];
@Sunnyztj
Sunnyztj / gist:62d4ece2a4db50fee832
Last active August 29, 2015 14:11
enter in backend
bundle exec rails c production
tail -f production.log
@Sunnyztj
Sunnyztj / gist:fe8eb7cfd83d439b2a1b
Created December 22, 2014 01:15
UIScrollView 的好文章!
http://tech.glowing.com/cn/practice-in-uiscrollview/