I hereby claim:
- I am arthraim on github.
- I am arthurwxy (https://keybase.io/arthurwxy) on keybase.
- I have a public key ASDzdcG3WrWCSwZw_MKETFLenwyM6AGcVXEiPErXfo7Zygo
To claim this, I am signing this object:
| import Foundation | |
| func longRunningTask() async throws { | |
| // Simulate a long-running task | |
| print("Long-running task started") | |
| try await Task.sleep(nanoseconds: UInt64(60 * Double(NSEC_PER_SEC))) | |
| print("Long-running task completed") | |
| } | |
| func timerTask() async throws { |
| let JSON_COMMA = "," | |
| let JSON_COLON = ":" | |
| let JSON_LEFTBRACKET = "[" | |
| let JSON_RIGHTBRACKET = "]" | |
| let JSON_LEFTBRACE = "{" | |
| let JSON_RIGHTBRACE = "}" | |
| let JSON_QUOTE = "\"" | |
| let JSON_WHITESPACES: [String] = [" ", "\t", "\n", "\r"] | |
| let JSON_SYNTAX: [String] = [JSON_COMMA, JSON_COLON, |
| .attribution.hover-card-parent { | |
| display: none; | |
| } | |
| .tools.group { | |
| display: none; | |
| } | |
| .extras { | |
| display: none; | |
| } | |
| .dribbbles { |
| //: An extremely easy implementation of redux in Swift 4 | |
| // !!!! | |
| // THIS IMPLEMENTATION HAS BEEN MOVED TO https://github.com/Arthraim/redux.swift | |
| // !!!! | |
| typealias Reducer<S, A> = (_ state: S, _ action: A) -> S | |
| typealias Listener = () -> Void | |
| class Store<S, A> { |
I hereby claim:
To claim this, I am signing this object:
| /** | |
| * Width of hairline (1px on real device screen) | |
| * The dppx of screens can be found here http://dpi.lv/ | |
| * | |
| * @return CGFloat number to be set for "1px" | |
| */ | |
| + (CGFloat)hairLineWidth { | |
| if ([UIScreen mainScreen].bounds.size.width == 414.f) { // Plus | |
| return 1.f / 2.46f; // 2.46 is the dppx of plus screens | |
| } else { |
Can I do something like this?
@implementation NSObject (Tryable)
- (id)tryWithKey:(id)key {
if (!self) return [NSNull null];
if (![self isKindOfClass:NSDictionary.class]) return [NSNull null];
if (![(NSDictionary *)self objectForKey:key]
|| [(NSDictionary *)self objectForKey:key] == [NSNull null]) {
return [NSNull null];| + (UIImage *)compressForUpload:(UIImage *)original | |
| { | |
| // Calculate new size given scale factor. | |
| CGSize originalSize = original.size; | |
| CGFloat longerBorder = MAX(originalSize.width, originalSize.height); | |
| CGFloat scale = longerBorder > MAX_DISTANCE_OF_LONGER_EDGE ? longerBorder / MAX_DISTANCE_OF_LONGER_EDGE : 1; | |
| CGSize newSize = CGSizeMake(originalSize.width / scale, originalSize.height / scale); | |
| GPUImageLanczosResamplingFilter *resampleFilter = [[GPUImageLanczosResamplingFilter alloc] init]; | |
| [resampleFilter forceProcessingAtSize:newSize]; |
| # Description: | |
| # Get pnd monsters information by number | |
| # | |
| # Dependencies: | |
| # None | |
| # | |
| # Configuration: | |
| # None | |
| # | |
| # Commands: |
| # coding:utf-8 | |
| def calc(p_count, p_price, m_count, m_price, w_count, w_price, t_p_count, t_m_count, t_w_count, t_price): | |
| """计算各套餐价格 | |
| p_count -- 通话时间(分钟) | |
| p_price -- 通话价格 | |
| m_count -- 短信(条) | |
| m_price -- 短信价格 | |
| w_count -- 流量(mb) | |
| w_price -- 流量价格 | |
| t_p_count -- 套餐内通话时间 |