Skip to content

Instantly share code, notes, and snippets.

View wujichao's full-sized avatar

Jichao Wu wujichao

  • Hangzhou, Zhejiang
View GitHub Profile
@mackuba
mackuba / wwdc16.md
Last active March 5, 2023 21:28
New stuff from WWDC 2016

Following the tradition from last year, here's my complete list of all interesting features and updates I could find in Apple's OSes, SDKs and developer tools that were announced at this year's WWDC. This is based on the keynotes, the "What's New In ..." presentations and some others, Apple's release notes, and blog posts and tweets that I came across in the last few weeks.

If for some reason you haven't watched the talks yet, I really recommend watching at least the "State of the Union" and the "What's New In" intros for the platforms you're interested in. The unofficial WWDC Mac app is great way to download the videos and keep track of what you've already watched.

If you're interested, here are my WWDC 2015 notes (might be useful if you're planning to drop support for iOS 8 now and start using some iOS 9 APIs).


OSX → macOS 10.12 Sierra

@dakeshi
dakeshi / Clean web data in WKWebView
Created June 10, 2016 06:17
Use an default WKWebView save all caches, cookies data in the app. So it make very critical issue such as infinite increase app size.
/// In AppDelegate.swift
/// Execute remove webdata method when the app receives the memory warning.
///
/// We can not avoid the infinitely get increased the app size issue
/// when users keep the web searching using the WKWebView.
/// So, you would get iOS full storage message.
///
/// Set WKWebsiteDataStore.nonPersistentDataStore in the configuration
/// can make lightweight WKWebView. But it can not apply every web site.
/// Imagine the web sites used the localStorage, IndexedDB features.
@sunnyxx
sunnyxx / attribute_overloadable_test.md
Last active July 18, 2018 04:59
__attribute__((overloadable)) test
__attribute__((overloadable)) NSString *descriptionFromValue(float value) {
    return @(value).stringValue;
}
__attribute__((overloadable)) NSString *descriptionFromValue(NSRange range) {
    return NSStringFromRange(range);
}
__attribute__((overloadable)) NSString *descriptionFromValue(id object) {
    return [object description];
}
@jawj
jawj / CAMediaTimingFunction+GMTimingBlock.h
Last active January 22, 2017 03:42
An easing category on CAMediaTimingFunction, with thanks to Mozilla
//
// CAMediaTimingFunction+GMTimingBlock.h
//
// Created by George MacKerron on 2015/06/11.
// Copyright (c) 2015 George MacKerron. All rights reserved.
//
#import <QuartzCore/QuartzCore.h>
// AFNetworking
[[AFHTTPSessionManager manager] GET:@"http://httpbin.org/ip" parameters:nil success:^(NSURLSessionDataTask *task, id JSON) {
NSLog(@"IP Address: %@", JSON[@"origin"]);
} failure:^(NSURLSessionDataTask *task, NSError *error) {
NSLog(@"Error: %@", error);
}];
// NSURLSession
NSURL *URL = [NSURL URLWithString:@"http://httpbin.org/ip"];
@jmoody
jmoody / export-crash-report.md
Last active May 21, 2017 08:57
Export a Crash Report From Xcode 6

Xcode 6

  1. Plug in the device and open Xcode
  2. Choose Window -> Devices from the Xcode menu
  3. Under the DEVICES section in the left column, choose the device
  4. To see crash logs, select the View Device Logs button under the Device Information section on the right hand panel
  5. Find your app in the Process column and select the Crash log to see the contents.
  6. IMPORTANT Be sure to symbolicate your crash report.
  7. Export the symbolicated crash report.
@staltz
staltz / introrx.md
Last active June 26, 2024 10:24
The introduction to Reactive Programming you've been missing
@jonfriskics
jonfriskics / gist:9360674
Created March 5, 2014 03:34
UIImagePickerController tints
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
// for light navigation item text, or UIBarStyleDefault for dark navigation item text
imagePickerController.navigationBar.barStyle = UIBarStyleBlack;
// the actual color will be affected by the translucency setting
imagePickerController.navigationBar.barTintColor = [UIColor blueColor];
// default is YES, but you could change to NO
imagePickerController.navigationBar.translucent = YES;
@iwillwen
iwillwen / co.js
Last active November 24, 2016 10:15
A simple version of co
/**
* A simple co
* @param {Function} fn Generator Function
* @return {Function} callback
*/
function co(fn) {
return function(done) {
done = done || function() {};
var gen = fn();
@mattt
mattt / uiappearance-selector.md
Last active June 4, 2024 13:28
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \