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
| You are Manus, an AI agent created by the Manus team. | |
| You excel at the following tasks: | |
| 1. Information gathering, fact-checking, and documentation | |
| 2. Data processing, analysis, and visualization | |
| 3. Writing multi-chapter articles and in-depth research reports | |
| 4. Creating websites, applications, and tools | |
| 5. Using programming to solve various problems beyond development | |
| 6. Various tasks that can be accomplished using computers and the internet |
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
| const pipe = (...funcs) => v => { | |
| return funcs.reduce((res, func) => { | |
| return func(res); | |
| }, v); | |
| }; | |
| pipe(add)(5) // 10 | |
| // https://medium.com/better-programming/functional-programming-and-the-pipe-function-in-javascript-c92833052057 |
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
| For example you can use Refs to Components approach like so: | |
| /* Child.js */ | |
| import React from 'react' | |
| import withStyles from 'isomorphic-style-loader/lib/withStyles' | |
| import s from './Child.css' | |
| class Child extends React.Component { | |
| componentDidMount() { | |
| this.props.onRef(this) |
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
| 'use strict'; | |
| /** | |
| * @param {Number} [baseFontSize = 100] - 基础fontSize, 默认100px; | |
| * @param {Number} [fontscale = 1] - 有的业务希望能放大一定比例的字体; | |
| */ | |
| const win = window; | |
| export default win.flex = (baseFontSize, fontscale) => { | |
| const _baseFontSize = baseFontSize || 100; | |
| const _fontscale = fontscale || 1; |
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
| @interface TNWeakWrapper : NSObject | |
| @property (nonatomic, weak) id obj; | |
| @end | |
| @implementation TNWeakWrapper | |
| @end | |
| - (void)setLogModel:(TNViewLogModel *)logModel { | |
| TNWeakWrapper *wrapper = nil; | |
| if (logModel) { |
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
| @interface TNWeakWrapper : NSObject | |
| @property (nonatomic, weak) id obj; | |
| @end | |
| @implementation TNWeakWrapper | |
| @end | |
| - (void)setLogModel:(TNViewLogModel *)logModel { | |
| TNWeakWrapper *wrapper = nil; | |
| if (logModel) { |
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
| Method original = class_getInstanceMethod(self, @selector(loadSource:onProgress:)); | |
| Method replacement = class_getInstanceMethod(self, @selector(loadSourceTinySDK:onProgress:)); | |
| if (class_addMethod(self, @selector(loadSource:onProgress:), method_getImplementation(replacement), method_getTypeEncoding(replacement))) { | |
| class_replaceMethod(self, @selector(loadSourceTinySDK:onProgress:), method_getImplementation(original), method_getTypeEncoding(original)); | |
| } else { | |
| const char *origType = method_getTypeEncoding(original); | |
| const char *newType = method_getTypeEncoding(replacement); | |
| IMP origIMP = class_replaceMethod(self, @selector(loadSource:onProgress:), method_getImplementation(replacement), newType); | |
| if (origIMP) |
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)load { | |
| Method original = class_getClassMethod([self class], @selector(bizPackageModel:)); | |
| Method dev = class_getClassMethod([self class], @selector(devBizPackageModel:)); | |
| const char *originalType = method_getTypeEncoding(original); | |
| const char *devType = method_getTypeEncoding(dev); | |
| Class metaClass = objc_getMetaClass(class_getName(self)); | |
| if (class_addMethod(metaClass, @selector(bizPackageModel:), method_getImplementation(dev), devType)) { | |
| class_replaceMethod(metaClass, @selector(devbizPackageModel:), method_getImplementation(original), originalType); | |
| } else { |
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
| #define MAIN_CALL(block) \ | |
| { \ | |
| if ([NSThread isMainThread]) \ | |
| { \ | |
| block(); \ | |
| return; \ | |
| } \ | |
| dispatch_async(dispatch_get_main_queue(), block); \ | |
| } \ | |
| } |
NewerOlder