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
# Using this script downloads ALL the videos in NSScreencast. | |
# Usage: `EMAIL=your email PASSWORD=your password.` | |
require 'HTTParty' | |
require 'Nokogiri' | |
require 'pry' | |
require "mechanize" | |
require "parallel" | |
class Scraper |
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
{"sig":"c6a6be6eb98d6b29698f316b63fcd77b2d6765cf0cfbf9a78470468071fd323717ae8a98542d9010b1d1d8f7e357ae8266eda3ae3c1d98c772cb74b7b085106f1","msghash":"3ebc75c4f9c26ca6b8a93d90167bc3aee62e5823e7033b307529cd451c8afe4f"} |
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
# This config file was created for myself (@shanskc). You may want to add or remove some rules to make efficient use of the Internet. | |
# Update: Rules and configuration tuning | |
# 从243开始Surge 加入了proxy和rule分离的配置Override,此文件为rules main.conf,在你的proxy中你可以引入此conf | |
# eg: 下面为你的proxy.conf,只需引入此main.conf 即可. | |
# -----START----- | |
# #!PROXY-OVERRIDE:main.conf | |
# | |
# [Proxy] | |
# Proxy = custom, ip, port, Methor, password | |
# -----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
float statusBarHeight = MIN([UIApplication sharedApplication].statusBarFrame.size.height, [UIApplication sharedApplication].statusBarFrame.size.width); |
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
+ (TZUser *)userWithUniqueUserId:(NSString *)uniqueUserId inManagedObjectContext:(NSManagedObjectContext *)context | |
{ | |
TZUser *user = nil; | |
NSFetchRequest *request = [[NSFetchRequest alloc] init]; | |
request.entity = [NSEntityDescription entityForName:@"TZUser" inManagedObjectContext:context]; | |
request.predicate = [NSPredicate predicateWithFormat:@"objectId = %@", uniqueUserId]; | |
NSError *executeFetchError = nil; | |
user = [[context executeFetchRequest:request error:&executeFetchError] lastObject]; |
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
SEL theSelector = NSSelectorFromString(@"setOrientation:animated:"); | |
NSInvocation *anInvocation = [NSInvocation | |
invocationWithMethodSignature: | |
[MPMoviePlayerController instanceMethodSignatureForSelector:theSelector]]; | |
[anInvocation setSelector:theSelector]; | |
[anInvocation setTarget:theMovie]; | |
UIInterfaceOrientation val = UIInterfaceOrientationPortrait; | |
BOOL anim = NO; | |
[anInvocation setArgument:&val atIndex:2]; |
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
UIFont *font = [UIFont fontWithName:@"Helvetica" size:30]; | |
NSDictionary *userAttributes = @{NSFontAttributeName: font, | |
NSForegroundColorAttributeName: [UIColor blackColor]}; | |
NSString *text = @"hello"; | |
... | |
const CGSize textSize = [text sizeWithAttributes: userAttributes]; |
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
int main(int argc, char *argv[]) { | |
@autoreleasepool { | |
NSString* dateString = @"2015/12/9 00:10:00"; | |
NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init]; | |
[dateFormatter setDateFormat:@"yyyy/MM/dd hh:mm:ss"]; | |
NSDate* date = [dateFormatter dateFromString:dateString]; | |
NSString * updatedStr = [dateFormatter stringFromDate:date]; | |
NSLog(@"time %@", updatedStr); | |
} | |
} |
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
sqlite3_stmt *statement = NULL; | |
sqlite3_prepare_v2(db, "SELECT strftime('%s', ?);", -1, &statement, NULL); | |
sqlite3_bind_text(statement, 1, [dateString UTF8String], -1, SQLITE_STATIC); | |
sqlite3_step(statement); | |
sqlite3_int64 interval = sqlite3_column_int64(statement, 0); | |
NSDate *date = [NSDate dateWithTimeIntervalSince1970:interval]; |
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
- (void)setExtraCellLineHidden: (UITableView *)tableView | |
{ | |
UIView *view =[ [UIView alloc]init]; | |
view.backgroundColor = [UIColor clearColor]; | |
[tableView setTableFooterView:view]; | |
[tableView setTableHeaderView:view]; | |
} |
NewerOlder