├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── SUMMARY.md ├── android ├── 360-jiagu.md ├── AndroidManifest.xml.md ├── README.md ├── action-mode.md ├── activity.md ├── adapter.md ├── adb.md ├── android-clean.md ├── android-library.md ├── android-studio-javadoc.md ├── android-studio.md ├── androidx.md ├── app-links.md ├── code-style.md ├── debug.md ├── deep-links.md ├── deploy.md ├── distribute-library.md ├── emulator.md ├── flow.md ├── fresco.md ├── full-screen.md ├── gif.md ├── gradle-upgrade-5.md ├── gradle-usage.md ├── gradle.md ├── hot-fix.md ├── image.md ├── intent.md ├── interview.md ├── jcenter.md ├── key-event.md ├── launch-mode.md ├── layout.md ├── lint.md ├── local-notification.md ├── mac-android-env.md ├── maven.md ├── oom.md ├── other.md ├── proguard.md ├── pull-to-refresh.md ├── questions.md ├── request-permission-at-run-time.md ├── search-path-directory.md ├── service.md ├── sha1.md ├── signature.md ├── size.md ├── sonatype-nexus.md ├── storage.md ├── tools.md ├── touch-event.md ├── translucent-status-bar.md └── view.md ├── appBetter ├── test-framework.md ├── test-platform.md └── ui-test.md ├── apple ├── README.md ├── app-previews.md ├── apple-bussiness.md ├── codesign.md ├── create-developer-account.md ├── custom-app.md ├── developer-id-application.md ├── expedite-review.md ├── m1-adapter.md ├── mac-pro-change-ssd.md ├── opa-install.md ├── review.md ├── rss-app-reviews.md ├── send-story-to-appstore-today.md ├── size.md ├── transfer-app.md └── wwdc-2019.md ├── assets ├── 14a74c04e7ac28d57893d552d5969934c3d756a523cc89e62199942cbe4ac8aa60d12d556cf603ea94e80e366f1ccf01130c8335c83f9360b60.png └── 14a74c04e7ac28d57893d552d5969934c3d756a523cc89e62199942cbe4ac8aa60d12d556cf603ea94e80e366f1ccf01130c8335c83f9360b61.png ├── back-end ├── README.md ├── RESTful-API.md ├── centos-redis.md ├── gretty.md ├── grpc.md ├── interview.md ├── java-service.md ├── java-tec.md ├── jwt.md ├── mongodb-usage.md ├── mongodb.md ├── mysql-mac.md ├── mysql-ubuntu.md ├── mysql-useage.md ├── mysql.md ├── nginx-centos.md ├── nginx-mac.md ├── nginx-ubuntu.md ├── nginx.md ├── operations.md ├── phpMyAdmin.md ├── postgresql.md ├── redis-mac.md ├── redis-questions.md ├── redis.md ├── tomcat-mac.md ├── tomcat.md └── url-uri.md ├── big-front ├── README.md ├── native-js-android.md └── native-to-js-ios.md ├── book.json ├── boostnote.json ├── chat ├── node.js.md ├── real-time.md ├── socket.io.md └── third-real-time.md ├── ci ├── drone.md ├── gitlab-ci.md ├── jenkins-advanced-useage.md ├── jenkins-api.md ├── jenkins-hook-gitlab.md ├── jenkins-q-a.md ├── jenkins.md ├── travis-update-gh-pages.md └── travis.md ├── dev-ops ├── README.md ├── auto-launch.md ├── background-task.md ├── batch-delete.md ├── centos-zh-cn.md ├── curl.md ├── ddns.md ├── docker-dockerfile.md ├── docker-mac.md ├── docker.md ├── du.md ├── ftp-server.md ├── gitlab-cli.md ├── gitlab-install.md ├── host-info.md ├── iptables.md ├── jmx-exporter.md ├── k8s.md ├── kibana.md ├── logrotate.md ├── mac-sha256sum.md ├── modify-string.md ├── network.md ├── port.md ├── rsync.md ├── ssh.md ├── sudo.md ├── tar.md └── user-group.md ├── file-format ├── README.md ├── aspose.md ├── csv.md ├── json-to-xml.md ├── markdown.md ├── ms-cfb.md ├── ms-doc.md ├── ms-office.md ├── ms-oshared.md ├── office-file-preview.md ├── office-open-xml.md ├── pdf.md ├── poi.md ├── xls.md ├── zip.md └── zlib.md ├── front-end ├── PostCSS.md ├── README.md ├── angular.md ├── babel.md ├── bootstrap.md ├── cache.md ├── chrome-apps.md ├── chrome.md ├── commonJS.md ├── cordova-analyze.md ├── cordova.md ├── css-modules.md ├── css-usage.md ├── css.md ├── debug.md ├── editorConfig.md ├── error-catch.md ├── eslint.md ├── favicon.ico.md ├── fetch.md ├── fis.md ├── gulp-webpack.md ├── gulp.md ├── html.md ├── interview.md ├── jQuery.md ├── other.md ├── phonegap.md ├── requireJS.md ├── screen-adaptive.md ├── scss.md ├── single-page-application.md ├── storage.md ├── web-game.md ├── web-to-app.md ├── webpack.md └── webstorm.md ├── gateway ├── CentOS-denote.md ├── CentOS-ss5.md ├── README.md ├── Resource │ └── autossh.sh ├── autossh-nginx.md ├── centos-srelay.md ├── github-proxy.md ├── public-to-internal.md ├── shadowsocks.md └── ssh-ss5.md ├── git ├── branch.md ├── checkout.md ├── clean.md ├── clone-local.md ├── commit.md ├── diff.md ├── flow.md ├── git-log.md ├── git-merge-remote.md ├── git-server.md ├── git-stash.md ├── gitbook-usage.md ├── github.md ├── merge.md ├── patch.md ├── questions.md ├── readme.md ├── rebase.md ├── resource │ └── progit-zh.936.pdf ├── rollback.md ├── submodule.md ├── tag.md ├── update-gitignore.md └── worktree.md ├── go └── README.md ├── host-server ├── README.md ├── bandwagonhost.md ├── host-node.js.md ├── hosthatch.md ├── hostus.md └── openshift.md ├── ios ├── js-bridge.md ├── 3d-touch.md ├── Cocoapods.md ├── Other.md ├── README.md ├── action-extension.md ├── app-store-review.md ├── apple-login.md ├── apple-pay.md ├── audio.md ├── ci.md ├── comment.md ├── crash.md ├── cupertino.md ├── document-provider-extension.md ├── download-background.md ├── dynamic-type.md ├── editing-menu.md ├── external-keyborad.md ├── fast-build.md ├── fastlane.md ├── file-provider.md ├── framework-design.md ├── gcd.md ├── gesture-recognizer.md ├── handoff.md ├── heic-hevc.md ├── iPad分屏.md ├── iap.md ├── import-export.md ├── interview.md ├── ios-13.md ├── ios-run-on-mac.md ├── iphonex-adaptive.md ├── key-command.md ├── keyboard.md ├── layout.md ├── libextobjc.md ├── mac-catalyst.md ├── masonry.md ├── multi-window.md ├── new-build-system.md ├── oc-js.md ├── oclint.md ├── parse-crash-log.md ├── pod-lib-create.md ├── popover.md ├── presentation-controller.md ├── pull-to-refresh.md ├── questions.md ├── remote-notification.md ├── retain-circle.md ├── scanner.md ├── search-path-directory.md ├── selector.md ├── service-work.md ├── share-extension.md ├── sharine-extension.md ├── smooth-view.md ├── speech-recognizer.md ├── split-view-controller.md ├── static-analyzers.md ├── submit-app.md ├── swift.md ├── tools.md ├── touch-id-and-face-id.md ├── unit-test.md ├── universal-links.md ├── view-controller-manager.md ├── visual-effect.md ├── websocket.md ├── wkwebview-intercept.md ├── wkwebview-questions.md ├── wkwebview-usage.md ├── xcode-select.md ├── xcodebuild-deploy.md └── xcrun.md ├── java ├── README.md ├── assert-exception.md ├── chaining-optionals.md ├── check-style.md ├── collection.md ├── coroutine.md ├── disruptor.md ├── find-bugs.md ├── format.md ├── high-concurrence.md ├── high-precision-calculation.md ├── http-client.md ├── java-servlet.md ├── junit.md ├── jvm.md ├── lombok.md ├── pmd.md ├── profiler.md ├── quasar.md ├── queue.md ├── reflection.md ├── run.md ├── spot-bugs.md ├── visual-vm.md └── zip.md ├── javascript ├── ES6.md ├── Q&A.md ├── README.md ├── dots.md ├── high-precision-calculation.md ├── jsdoc.md ├── typescript.md └── web-kernel.md ├── kotlin └── README.md ├── mac ├── Other.md ├── apache.md ├── auto-launch.md ├── brew.md ├── command.md ├── crash.md ├── launch.md ├── mac-clean.md ├── macos-big-sur.md ├── macports.md ├── shortcut.md └── spotlight.md ├── nodejs ├── Koa2.md ├── Q-A.md ├── README.md ├── artTemplate.md ├── bluebird.md ├── crush.md ├── es6-support.md ├── express.md ├── jest.md ├── log4js.md ├── mocha.md ├── mongoose.md ├── nodejs-github-front-end.md ├── nodemon.md ├── npm.md ├── npm5.md ├── nvm.md ├── optimize-nginx.md ├── passport.md ├── pm2.md ├── private-npm.md ├── spawn-exec.md └── why-nodejs.md ├── objective-c ├── README.md ├── arc.md ├── clang-format.md ├── cloc.md ├── high-precision-calculation.md ├── macro.md └── runtime.md ├── other ├── README.md ├── ads.md ├── company.md └── qq-protocol.md ├── package.json ├── php ├── Atom4PHP.md ├── Illuminate-Database.md ├── README.md ├── WorkerMan.md ├── async.md ├── composer.md ├── docker-php.md ├── framework-for-restfull.md ├── high-precision-calculation.md ├── interview.md ├── laravel-api-auth-analyze.md ├── laravel-usage.md ├── laravel-web-auth-analyze.md ├── laravel.md ├── linux-install-php7.md ├── linux-install.md ├── mac-install-php7.md ├── mac-install.md ├── mail.md ├── pecl.md ├── phinx.md ├── php-mongo.md ├── php-redis.md ├── phpdoc.md ├── phpstorm.md ├── resources │ ├── laravel-auth-analyze-login.dot │ ├── laravel-auth-analyze-logout.dot │ └── laravel-auth-analyze-register.dot ├── slim.md ├── tool.md ├── xdebug.md └── yii.md ├── python ├── README.md └── pip.md ├── react-native ├── README.md ├── appium.md ├── build-from-source.md ├── comment.md ├── component-to-native.md ├── console.md ├── debug.md ├── font.md ├── image.md ├── inderview.md ├── js-bridge.md ├── key-command.md ├── layout.md ├── monorepo-support.md ├── native-modules-advanced.md ├── native-modules-analyze.md ├── native-modules.md ├── native-to-js.md ├── native-to-rn.md ├── network.md ├── pasteboard.md ├── pull-to-refresh.md ├── questions.md ├── react-native-screens.md ├── status-bar.md ├── touch-event-and-gesture.md ├── upgrade-47.md ├── upgrade-60.md ├── usage.md └── yoga.md ├── react ├── README.md ├── antd.md ├── create-react-app.md ├── react-redux.md ├── react-router-redux.md ├── react-router.md ├── react-usage.md └── redux.md ├── ruby ├── Gemfile.md ├── Other.md ├── README.md ├── bundler.md ├── gem.md └── gets.md ├── rust ├── README.md ├── cargo-instruments.md └── rust-cli.md ├── scripts ├── README.md ├── build.sh ├── dependences.sh ├── deploy.sh ├── publish.sh ├── push-docs.sh └── push.sh ├── shell ├── README.md ├── bash-auto-complete.md ├── exit.md ├── mail.md ├── operator.md ├── other.md ├── parameters.md ├── stat.md ├── string.md ├── vi.md └── zsh-auto-complete.md ├── technology ├── Ajax.md ├── README.md ├── algorithm.md ├── api-doc.md ├── auto-generate-summary.md ├── compile.md ├── cookie.md ├── cors.md ├── cross-origin.md ├── design-patterns.md ├── float.md ├── fonte-end-back-end-separate.md ├── hybrid-app.md ├── incremental-update.md ├── json.md ├── oop.md ├── programming-ideas.md ├── resource │ └── 人月神话.pdf ├── upload-file.md ├── video.md └── web_proxy.md ├── ue ├── Axure.md ├── adobe-bridge.md ├── axure-libraries.md ├── axure-team-svn.md ├── icon-resource.md ├── photoshop-variable.md ├── photoshop.md ├── sketch.md ├── tools.md └── zeplin.md ├── util ├── Gnuplot.md ├── Graphviz.md ├── Resource │ ├── gnuplot.pdf │ ├── test.dot │ ├── test.mmd │ ├── test.plt │ └── test.png ├── api-test.md ├── appium.md ├── arcanist.md ├── asciiflow.md ├── atom.md ├── crypto.md ├── fabric.md ├── free-ssl.md ├── ietf.md ├── let-us-encrypt.md ├── lottie.md ├── markdown.md ├── mermaid.md ├── openssl.md ├── other.md ├── pay.md ├── phabricator.md ├── plantuml.md ├── search.md ├── smarty.md ├── ssl.md ├── svn-client-usage.md ├── svn.md ├── vs-code.md └── weixin-scheme.md ├── vue ├── README.md ├── element-ui.md ├── vue-devtools.md ├── vue-env.md ├── vue-loader.md ├── vue-router.md └── vuex.md ├── weapp └── README.md ├── weex └── README.md ├── wex5 ├── README.md └── ui2.md └── xcode ├── Instruments.md ├── Other.md ├── README.md ├── Resource ├── @keypath.codesnippet ├── @strongify.codesnippet ├── @weakify.codesnippet └── Instruments.pdf ├── agvtool.md ├── asset-catalog.md ├── code-snippets-library.md ├── debug.md ├── groups-vs-folder-references.md ├── import.md ├── merge-pbxproj.md ├── plist-buddy.md ├── plugin.md ├── project-pbxproj.md ├── warning.md ├── xcconfig.md ├── xcode-clean.md ├── xcode-install.md ├── xcode10.md ├── xcode8-ios7.md ├── xcodeproj.md └── xcversion.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## npm 2 | node_modules 3 | package-lock.json 4 | 5 | # gitbook 6 | _book 7 | 8 | # OS X 9 | .DS_Store 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | before_install: 2 | - "./scripts/dependences.sh" 3 | script: 4 | - "travis_wait 120 sh ./scripts/build.sh" 5 | after_success: 6 | - "./scripts/deploy.sh" 7 | -------------------------------------------------------------------------------- /android/360-jiagu.md: -------------------------------------------------------------------------------- 1 | # 360 加固保 2 | 3 | * [官网](http://jiagu.360.cn) 4 | 5 | ## 流程 6 | 7 | ``` 8 | 签名 > 加固 > 再签名 9 | ``` 10 | 11 | ## 界面方式加固 12 | 13 | * [下载加固助手](http://jiagu.360.cn/qcms/help.html#!id=89) 14 | * [加固助手使用说明](http://jiagu.360.cn/qcms/help.html#!id=90) 15 | 16 | ## 命令行方式加固 17 | 18 | * [下载加固助手](http://jiagu.360.cn/qcms/help.html#!id=89) 19 | * [加固助手使用说明](http://jiagu.360.cn/qcms/help.html#!id=90) 20 | 21 | ```sh 22 | java -jar jiagu.jar -help 23 | ``` 24 | -------------------------------------------------------------------------------- /android/AndroidManifest.xml.md: -------------------------------------------------------------------------------- 1 | # AndroidManifest.xml 2 | 3 | 应用清单文件 4 | 5 | * [官方文档](https://developer.android.com/guide/topics/manifest/manifest-intro.html) 6 | -------------------------------------------------------------------------------- /android/action-mode.md: -------------------------------------------------------------------------------- 1 | # ActionMode 2 | -------------------------------------------------------------------------------- /android/activity.md: -------------------------------------------------------------------------------- 1 | # Activity 2 | 3 | 4 | 5 | # launchMode 6 | 7 | 启动模式 8 | 9 | * [ 基础总结篇之二:Activity的四种launchMode ](http://blog.csdn.net/liuhe688/article/details/6754323) 10 | 11 | ## standard 12 | 13 | 默认的启动模式 14 | 15 | 每次跳转系统都会在task中生成一个新的FirstActivity实例,并且放于栈结构的顶部,当我们按下后退键时,才能看到原来的FirstActivity实例。 16 | 17 | 这就是standard启动模式,不管有没有已存在的实例,都生成新的实例。 18 | 19 | ## singleTop 20 | 21 | 跳转时系统会先在栈结构中有一个FirstActivity实例且位于栈顶,则不再生成新的,而是直接使用,否则重新生成 22 | 23 | ## singleTask 24 | 25 | 如果发现有对应的Activity实例,则使此Activity实例之上的其他Activity实例统统出栈,使此Activity实例成为栈顶对象,显示到幕前。 26 | 27 | ## singleInstance 28 | 29 | 启用一个新的栈结构,将Acitvity放置于这个新的栈结构中,并保证不再有其他Activity实例进入。 30 | -------------------------------------------------------------------------------- /android/adapter.md: -------------------------------------------------------------------------------- 1 | # Adapter 2 | 3 | 适配器 4 | 5 | * [Android设计模式源码解析之适配器(Adapter)模式](https://github.com/simple-android-framework-exchange/android_design_patterns_analysis/tree/master/adapter/mr.simple) 6 | 7 | ## Adapter模式 8 | 9 | 将一个类的接口转换成客户希望的另外一个接口,Adapter 模式使得原本由于接口不兼容而不能一起工作的那些类可以一起工作。 10 | -------------------------------------------------------------------------------- /android/adb.md: -------------------------------------------------------------------------------- 1 | # adb 命令 2 | 3 | * [ADB Commands](https://adbshell.com/) 4 | 5 | ## 安装 apk 6 | 7 | ```sh 8 | # 查看设备列表 9 | adb devices 10 | # 安装 apk 11 | adb install 12 | ``` 13 | 14 | ## shell 15 | 16 | ```sh 17 | # 获取 root 权限,否则 adb shell 后运行任何命令提示 “Permission denied” 18 | adb root 19 | # 查看设备列表 20 | adb devices 21 | # 进入设备 shell 22 | adb -s emulator-5554 shell 23 | ``` 24 | 25 | ## logcat 26 | 27 | ## 传输文件 28 | 29 | 获取文件 30 | 31 | ```sh 32 | adb pull 33 | ``` 34 | 35 | 上传文件 36 | 37 | ```sh 38 | adb push 39 | ``` 40 | 41 | [Android File Transfer](https://www.android.com/filetransfer/) 图形界面上传获取文件 42 | -------------------------------------------------------------------------------- /android/android-clean.md: -------------------------------------------------------------------------------- 1 | # 清理磁盘 - Android 2 | 3 | 删除无用镜像 4 | 5 | ``` 6 | ls ~/Library/Android/sdk/system-images 7 | ``` 8 | -------------------------------------------------------------------------------- /android/android-library.md: -------------------------------------------------------------------------------- 1 | # Android library 2 | 3 | ## Reference 4 | 5 | * 6 | -------------------------------------------------------------------------------- /android/android-studio.md: -------------------------------------------------------------------------------- 1 | # Android Studio 2 | 3 | * [Configure Your Build](https://developer.android.com/studio/build/index.html) 4 | 5 | ## 快捷 6 | 7 | | 快捷 | 说明 | 8 | | :---: | :---: | 9 | | 按两下 shift | 搜索文件 | 10 | | command + shift + o | 前往文件 | 11 | 12 | ## 自动显示提示 13 | 14 | `Android Studio > Preferences > Editor > General > Other > Show quick doc on mouse move Delay` 15 | 16 | ## 删除 Module 17 | 18 | 1. 选中Module右击,选择 Open Module Settings,打开Project Structure 窗。(或者选中Module,按F4打开Project Structure窗口) 19 | 2. 或者选中Module按Delete键。 OK 20 | 21 | ## 格式化代码 22 | 23 | ``` 24 | Android Studio > Preferences > Editor > Code > Java 25 | ``` 26 | 27 | * `Tab size` tab 占空格数。 2 28 | * `Indent` 缩进空格数。2 29 | * `Continuation indent` 一行没完的语句换行空格数。 4 30 | 31 | ## 查看 APK 包 32 | 33 | ``` 34 | Build > Analyze APK 35 | ``` 36 | -------------------------------------------------------------------------------- /android/androidx.md: -------------------------------------------------------------------------------- 1 | # AndroidX 2 | 3 | * [AndroidX 概览](https://developer.android.com/jetpack/androidx) 4 | * [迁移到 AndroidX](https://developer.android.com/jetpack/androidx/migrate) 5 | 6 | ## React Native 7 | 8 | * [AndroidX Support](https://facebook.github.io/react-native/blog/2019/07/03/version-60#androidx-support) 9 | 10 | ## References 11 | 12 | * [Android:你好,androidX!再见,android.support](https://www.jianshu.com/p/41de8689615d) 13 | -------------------------------------------------------------------------------- /android/app-links.md: -------------------------------------------------------------------------------- 1 | # App Links 2 | 3 | 通过 URL 打开 App 4 | 5 | ## Create Deep Links to App Content 6 | 7 | 8 | ## Declare website associations 9 | 10 | ```sh 11 | keytool -list -v -keystore my-release-key.keystore 12 | ``` 13 | 14 | 取 sha256 15 | 16 | assetlinks.json 17 | 18 | ``` 19 | [{ 20 | "relation": ["delegate_permission/common.handle_all_urls"], 21 | "target": { 22 | "namespace": "android_app", 23 | "package_name": "com.example", 24 | "sha256_cert_fingerprints": 25 | ["14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5"] 26 | } 27 | }] 28 | ``` 29 | 30 | 传到 31 | 32 | ## References 33 | 34 | * [Handling Android App Links](https://developer.android.com/training/app-links/) 35 | -------------------------------------------------------------------------------- /android/code-style.md: -------------------------------------------------------------------------------- 1 | # 编码规范 2 | 3 | * [android code style](http://source.android.com/source/code-style.html) 4 | * [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html) [翻译](http://www.hawstein.com/posts/google-java-style.html) 5 | * [project_and_code_guidelines](https://github.com/ribot/android-guidelines/blob/master/project_and_code_guidelines.md) 6 | 7 | ## java-code-styles 8 | 9 | [java-code-styles](https://github.com/square/java-code-styles)  下载 Android Studio 代码格式化配置文件。 10 | 11 | 1. install.sh 12 | 2. Android Studio > Preferences > Editor > Code Style > Scheme > SquareAndroid 13 | -------------------------------------------------------------------------------- /android/debug.md: -------------------------------------------------------------------------------- 1 | # 调试 2 | 3 | ## 断点 4 | 5 | `Run > View Breakpoints...` 查看所有断点 6 | 7 | * Java Exception Breakpoints 8 | * Exception Breakpoints 9 | 10 | 11 | ## 打印自定义数据 12 | 13 | `alt+F8` 14 | -------------------------------------------------------------------------------- /android/deep-links.md: -------------------------------------------------------------------------------- 1 | # Deep Links 2 | -------------------------------------------------------------------------------- /android/deploy.md: -------------------------------------------------------------------------------- 1 | # 发包 2 | 3 | ## 签名 4 | 5 | ## 混淆 6 | 7 | 代码混淆通常将代码中的各种元素(变量、函数、类名等)改为无意义的名字,使得阅读的人无法通过名称猜测其用途,增大反编译者的理解难度。 8 | 虽然代码混淆可以提高反编译的门槛,但是对开发者本身也增大了调试除错的难度。开发人员通常需要保留原始未混淆代码用于调试。 9 | 10 | ## 加固 11 | 12 | 加固之后就啥也看不见了,常用的三方加固工具有360加固。 13 | 14 | 加固前不需要特意混淆,直接提交安装包进行加固即可。 15 | 16 | 加固是多维度的安全防护方案,包括反破解、反逆向、防篡改等,可以防止应用被各类常见破解工具逆向,安全性要远大于单纯的代码混淆。 17 | 18 | ## 反编译 19 | 20 | ## 工具 21 | 22 | * [360加固保](http://jiagu.360.cn/) 23 | 24 | ## References 25 | 26 | * [Android APP 防破解进化史](http://jiagu.360.cn/1101141392.php?dtid=1101141786&did=1101262105) 27 | * [加固和混淆](https://www.qcloud.com/document/product/283/4103) 28 | -------------------------------------------------------------------------------- /android/full-screen.md: -------------------------------------------------------------------------------- 1 | # 全面屏 2 | 3 | 1.声明 Maximum Aspect Ratio 4 | 5 | Android 标准接口中,支持应用声明其支持的最大屏幕高宽比(maximum aspect ratio)。具体声明如下,其中的 ratio_float 被定义为是高除以宽,以 16:9 为例,ratio_float = 16/9 = 1.778 (18.5:9则为2.056)。 6 | 7 | 若开发者没有声明该属性,ratio_float 的默认值为1.86 8 | 9 | ```xml 10 | 12 | ``` 13 | 14 | ## References 15 | 16 | * [支持多种屏幕](https://developer.android.com/guide/practices/screens_support.html) 17 | * [小米文档中心-全面屏及虚拟键适配说明](https://dev.mi.com/console/doc/detail?pId=1160) 18 | -------------------------------------------------------------------------------- /android/gif.md: -------------------------------------------------------------------------------- 1 | # Gif 2 | 3 | android默认是不支持gif动画的,webview实际上是使用了webkit的功能来显示gif动画,虽然不能显示gif,但是不影响上传文件,你不要decode成bitmap来上传数据,直接用FileInputStream转成数组来上传,绝对没有问题的 4 | -------------------------------------------------------------------------------- /android/gradle-upgrade-5.md: -------------------------------------------------------------------------------- 1 | # gradle 升级到 5 2 | 3 | ## 升级 4 | 5 | 参考 [The Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html),运行 6 | 7 | ```bash 8 | $ gradle wrapper --gradle-version 5.5 --distribution-type all 9 | ``` 10 | 11 | 升级到 5.5 12 | 13 | ## 问题 14 | 15 | ### 问题 1 16 | 17 | ```bash 18 | $ ./gradlew --stacktrace 19 | Caused by: java.lang.NoSuchMethodError: org.gradle.api.tasks.TaskInputs.dir(Ljava/lang/Object;)Lorg/gradle/api/tasks/TaskInputs; 20 | at org.jetbrains.kotlin.gradle.plugin.KotlinPluginKt.configureJavaTask(KotlinPlugin.kt:667) 21 | ``` 22 | 23 | 解决 24 | 25 | 升级 `kotlin-gradle-plugin` 到最新版 26 | -------------------------------------------------------------------------------- /android/intent.md: -------------------------------------------------------------------------------- 1 | # Intent 2 | 3 | * [启动另一个 Activity](https://developer.android.com/training/basics/firstapp/starting-activity.html?hl=zh-cn) 4 | * [Intent 和 Intent 过滤器](https://developer.android.com/guide/components/intents-filters.html?hl=zh-cn) 5 | -------------------------------------------------------------------------------- /android/jcenter.md: -------------------------------------------------------------------------------- 1 | # JCenter 2 | 3 | JCenter 和 Maven Central 一样是标准的Android library文件服务器。由于 JCenter 相比 Maven Central 有很多优势,Android Stdio 已经把默认的库换成了 JCenter. 4 | 5 | * [官网](https://bintray.com/) 6 | * [镜像](https://bintray.com/bintray/jcenter) 7 | -------------------------------------------------------------------------------- /android/key-event.md: -------------------------------------------------------------------------------- 1 | # KeyEvent 按键事件 2 | 3 | ## References 4 | 5 | * [KeyEvent](https://developer.android.com/reference/android/view/KeyEvent.html) 6 | * [KeyEvent.Callback](https://developer.android.com/reference/android/view/KeyEvent.Callback.html) 7 | 8 | * [Handling Keyboard Actions](https://developer.android.com/training/keyboard-input/commands.html) 9 | -------------------------------------------------------------------------------- /android/launch-mode.md: -------------------------------------------------------------------------------- 1 | # Activity 四种启动模式 2 | 3 | ## standard 4 | 5 | 应用内,每次打开 Activity 都新建一个 Activity 6 | 7 | * 用于可以打开多个的 Activity 8 | * 用于 MainActivity,这样每次通过桌面打开应用不会重新新建一个 Activity 9 | 10 | ## singleTop 11 | 12 | 应用内,如果 Activity 在任务栈栈顶,直接打开,不重新创建 13 | 14 | 多用于打开 App,但不做任何处理 15 | 16 | ## singleTask 17 | 18 | 应用内和多应用之间,如果 Activity 在任务栈中,把该 Activity 顶部的所有 Activity 移除。 19 | 20 | ## singleInstance 21 | 22 | 应用内和多应用之间,开启新的栈,使用同一个 Activity 23 | 24 | ## 用例 25 | 26 | singleTask 和 singleInstance 多用于接受其它 App 打开的 Activity,也就是 `android:exported="true"` 的 Activity,这样不会从任务列表看到多个任务栈 27 | 28 | * MainActivity: standard 29 | * FirstActivity: standard 30 | * ShareReceiverActivity: singleInstance | singleTask 31 | 32 | ## References 33 | -------------------------------------------------------------------------------- /android/lint.md: -------------------------------------------------------------------------------- 1 | # Android Lint 2 | 3 | > Android 静态代码分析工具, 代码质量检测 4 | 5 | * [Improve Your Code with Lint](https://developer.android.com/studio/write/lint.html) 6 | 7 | ## lint.xml 8 | 9 | lint 规则 10 | 11 | ## Android Studio 12 | 13 | ### 配置 lint 14 | 15 | `Android Studio > Preferences > Editor > Inspections` 16 | 17 | ### lint 18 | 19 | `Analyze > Inspect Code` 20 | 21 | ## CLI 22 | 23 | `~/Library/Android/sdk/tools/bin/lint` 是 Android 自带的 lint 工具。 24 | -------------------------------------------------------------------------------- /android/local-notification.md: -------------------------------------------------------------------------------- 1 | # 本地通知 2 | 3 | ## AlarmManager 4 | 5 | 全局定时器(又称为闹钟),在特定的时刻为我们广播一个指定的Intent 6 | 7 | ## Notification 8 | 9 | 10 | ## Intent 11 | 12 | Intent是一个意图,一个描述了想要启动一个Activity、Broadcast或是Service的意图。 13 | 14 | ## PendingIntent 15 | 16 | PendingIntent可以认为是对Intent的包装,实际上就是,供当前App或之外的其他App调用,而常见的是供外部App使用,外部App执行这个 PendingIntent时,间接地调用里面的Intent,即外部App延时执行PendingIntent中描述的Intent及其最终行为 17 | 18 | ## References 19 | 20 | * [AlarmManager+Notification实现定时通知提醒功能](https://www.jianshu.com/p/fdb4e8c009b7) 21 | -------------------------------------------------------------------------------- /android/maven.md: -------------------------------------------------------------------------------- 1 | # maven 2 | 3 | * maven可以管理你的依赖包 4 | * 打包成apklib,管理自己的组件库 5 | * 动态配置你的发布渠道(此点非常方便) 6 | * 签名,打包,混淆一条龙服务. 7 | 8 | * [官网](https://maven.apache.org/) 9 | 10 | ## 下载 11 | 12 | 13 | 14 | ## 安装 15 | 16 | 17 | 18 | ## docker 19 | 20 | 21 | 22 | ### 私有 maven 库 23 | 24 | * [docker-maven](https://hub.alauda.cn/repos/library/maven) 25 | * [docker-maven GitHub](https://github.com/carlossg/docker-maven) 26 | -------------------------------------------------------------------------------- /android/oom.md: -------------------------------------------------------------------------------- 1 | # 内存溢出 2 | 3 | ## 查看内存 4 | 5 | Android Studio 开启 monitor 6 | 7 | ``` 8 | Android Studio > Tools > Android > Enable ADB Integration 9 | ``` 10 | 11 | 查看内存使用情况 12 | 13 | ``` 14 | Android Studio > Android Monitor > Monitors > Memory 15 | ``` 16 | 17 | Memory 的 `Dump java heap` 按钮可以导出并查看内存堆栈 18 | 19 | ## 解决内存溢出 20 | 21 | `AndroidManifest.xml` 中添加 22 | 23 | ```xml 24 | 25 | android:hardwareAccelerated="false" 26 | 27 | android:largeHeap="true" 28 | ``` 29 | 30 | 参考 31 | 32 | ## References 33 | 34 | * [在Android中解决内存溢出 – OutOfMemoryError](http://blog.chengdazhi.com/index.php/89) 35 | * [ Android高效加载大图、多图解决方案,有效避免程序OOM ](http://blog.csdn.net/guolin_blog/article/details/9316683) 36 | -------------------------------------------------------------------------------- /android/other.md: -------------------------------------------------------------------------------- 1 | # 杂七杂八 2 | 3 | ## Gson格式化输出JSON字符串 4 | 5 | ``` 6 | Gson gson = new GsonBuilder().setPrettyPrinting().create(); 7 | String jsonOutput = gson.toJson(someObject); 8 | ``` 9 | 10 | ### Reference 11 | 12 | * [gson](https://github.com/google/gson) 13 | * [Compact Vs. Pretty Printing for JSON Output Format](https://github.com/google/gson/blob/master/UserGuide.md#compact-vs-pretty-printing-for-json-output-format) 14 | * [Gson格式化输出JSON字符串 ](http://liumh.com/2014/07/21/gson-pretty-printing/?utm_source=tuicool&utm_medium=referral) 15 | -------------------------------------------------------------------------------- /android/proguard.md: -------------------------------------------------------------------------------- 1 | # 混淆(Proguard) 2 | 3 | * [压缩代码和资源](https://developer.android.com/studio/build/shrink-code.html?hl=zh-cn) 4 | 5 | 6 | ``` 7 | buildTypes { 8 | debug { 9 | 10 | } 11 | release { 12 | minifyEnabled true // 是否混淆 13 | shrinkResources true // 是否去除无效的资源文件 14 | // 混淆的配置文件 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 16 | } 17 | } 18 | ``` 19 | 20 | ## 说明 21 | 22 | 应用程序经过proguard混淆处理后会输出一个mapping.txt文件,该文件可用于恢复混淆前的堆栈信息。proguard提供了一个方便的恢复工具(retrace),通过这些文件我们可以方便的还原出混淆之前的堆栈信息,从而更好的定位出问题。 23 | 24 | * mapping.txt —> 表示混淆前后代码的对照表 25 | * dump.txt —> 描述apk内所有class文件的内部结构 26 | * seeds.txt —> 列出了没有被混淆的类和成员 27 | * usage.txt —> 列出了源代码中被删除在apk中不存在的代码 28 | 29 | ## 结论 30 | 31 | 一般直接加固就可以了,不用混淆 32 | 33 | ## References 34 | 35 | * [APK反逆向之二:四种基本加固方式 ](https://segmentfault.com/a/1190000007314624) 36 | -------------------------------------------------------------------------------- /android/pull-to-refresh.md: -------------------------------------------------------------------------------- 1 | # 下拉刷新 2 | 3 | ## SwipeRefreshLayout 4 | -------------------------------------------------------------------------------- /android/service.md: -------------------------------------------------------------------------------- 1 | # Service 2 | -------------------------------------------------------------------------------- /android/sha1.md: -------------------------------------------------------------------------------- 1 | # Android 获取 md5 sha1 2 | 3 | ## keytool 4 | 5 | ``` 6 | keytool -list -v -keystore .keystore 7 | ``` 8 | 9 | ## signingReport 10 | 11 | ``` 12 | ./gradlew signingReport 13 | ``` 14 | 15 | 这个命令会列出所有环境包的 md5 sha1 16 | -------------------------------------------------------------------------------- /android/storage.md: -------------------------------------------------------------------------------- 1 | # 存储 2 | 3 | * [Android中关于外部存储的一些重要函数 ](http://hubingforever.blog.163.com/blog/static/1710405792012816103948907/) 4 | * [Android中关于内部存储的一些重要函数](http://hubingforever.blog.163.com/blog/static/171040579201281895042802/) 5 | 6 | ## 访问外部存储的权限 7 | 8 |   从Android 1.0开始,写操作受权限WRITE_EXTERNAL_STORAGE保护。 9 | 10 |   从Android 4.1开始,读操作受权限READ_EXTERNAL_STORAGE保护。 11 | 12 |   从Android 4.4开始,应用可以管理在它外部存储上的特定包名目录,而不用获取WRITE_EXTERNAL_STORAGE权限。 13 | 14 |   比如,一个包名为com.example.foo的应用,可以自由访问外存上的Android/data/com.example.foo/目录。 15 | 16 | ## Android 存储目录 17 | 18 | ### Environment.getExternalCacheDir() 19 | -------------------------------------------------------------------------------- /android/tools.md: -------------------------------------------------------------------------------- 1 | # 实用工具 2 | 3 | ## References 4 | -------------------------------------------------------------------------------- /appBetter/test-framework.md: -------------------------------------------------------------------------------- 1 | # 测试框架 2 | 3 | ## UI 测试 (UI Testing) 4 | 5 | `XCTest` 6 | 7 | ## 单元测试 (Unit Test) 8 | 9 | `XCTest` 10 | 11 | ## 相关资料 12 | 13 | * 14 | -------------------------------------------------------------------------------- /appBetter/test-platform.md: -------------------------------------------------------------------------------- 1 | # 测试平台 2 | 3 | * [阿里云测](http://mqc.aliyun.com/) 4 | * [腾讯优测](http://remote.utest.qq.com/) 5 | * [腾讯](http://wetest.qq.com) 6 | * [百度APP测试服](https://bce.baidu.com/product/mat.html) 7 | * [TestIn](http://testin.cn/) 8 | 9 | ## 相关资料 10 | 11 | * 12 | -------------------------------------------------------------------------------- /apple/README.md: -------------------------------------------------------------------------------- 1 | # Apple 2 | 3 | * [Guides and Sample Code](https://developer.apple.com/library/content/navigation/) 4 | 5 | ## 10.3 更新 6 | 7 | * [iOS 10.3 Release Notes](https://developer.apple.com/library/content/releasenotes/General/RN-iOSSDK-10.3/index.html) 8 | * [What's New in iOS](https://developer.apple.com/library/content/releasenotes/General/WhatsNewIniOS/Articles/iOS10_3.html) 9 | 10 | `SKStoreReviewController` 评价 App 11 | 12 | 苹果开源的项目 13 | 14 | ## 模拟器上安装 iPa 15 | 16 | ```shell 17 | xcrun simctl install booted shimo.app 18 | ``` 19 | 20 | App Store 下载的包是 ARM 平台的包,不支持 X86 或者 i386, 所以安装了也打不开。 21 | 22 | ## iPhone CPU 架构 23 | 24 | * [iOS Support Matrix](http://iossupportmatrix.com/) 25 | -------------------------------------------------------------------------------- /apple/app-previews.md: -------------------------------------------------------------------------------- 1 | # App Previews 2 | 3 | * [Creating App Previews with Final Cut Pro X](https://developer.apple.com/support/app-previews/final-cut-pro/) 4 | * [Final Cut Pro X 帮助](http://help.apple.com/finalcutpro/mac/10.2/) 5 | * [Show More with App Previews](https://developer.apple.com/app-store/app-previews/) 6 | * [Creating Videos for App Previews](https://developer.apple.com/support/app-previews/) 7 | * [App 预览属性](https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide_zh_CN/Chapters/Properties.html#//apple_ref/doc/uid/TP40016325-CH26-SW10) 格式要求 8 | 9 | ## 查看视频信息 10 | 11 | Quick time 打开,command + i 查看视频信息 12 | 13 | ## 录制 14 | 15 | iOS Apps 16 | 17 | 1. Connect your iOS device to your Mac with a Lightning cable 18 | 1. Open QuickTime Player 19 | 1. Choose File > New Movie Recording 20 | 1. Click on the down arrow next to the Record button 21 | 1. Select your device under Camera and Microphone 22 | 1. Record 23 | 24 | ## 编辑 25 | 26 | 用 QuickTime or iMovie or Final Cut Pro X, 27 | -------------------------------------------------------------------------------- /apple/custom-app.md: -------------------------------------------------------------------------------- 1 | # 自定 App 2 | 3 | 开发者提供 App 给 `Apple 商务管理` 4 | 5 | * [分发定制商务 App](https://developer.apple.com/cn/custom-apps/) 6 | * [在 Apple 商务管理和 Apple 校园教务管理上分发 App](https://developer.apple.com/cn/support/volume-purchase-and-custom-apps/) 7 | 8 | ## 分发 9 | 10 | `https://appstoreconnect.apple.com` > 我的 App > 选择 App > App Store > 价格与销售范围 > 向企业和教育机构分发 11 | -------------------------------------------------------------------------------- /apple/developer-id-application.md: -------------------------------------------------------------------------------- 1 | # Developer ID Application 2 | 3 | ## 证书制作 4 | 5 | 参考 [Developer ID Application证书制作](https://www.jianshu.com/p/d4d82c1e427f) 6 | 7 | ## 证书下载 8 | 9 | 1. 打开 [苹果开发者网站](https://developer.apple.com/account/resources/certificates/list) 10 | 2. 点击 Type 为 `Developer ID Application` 的 Certificate 11 | 3. Download 12 | -------------------------------------------------------------------------------- /apple/expedite-review.md: -------------------------------------------------------------------------------- 1 | # 审核加急 2 | 3 | ## 方法一 4 | 5 | [itunesconnect](https://itunesconnect.apple.com/) > 联系我们 > Please choose from the following topics: App Review > Please choose from the following topics: App Store Review > Please choose from the following topics: Request Expedited Review > Click [Request an Expedited App Review](https://developer.apple.com/contact/app-store/?topic=expedite) 6 | 7 | ## 方法二 8 | 9 | 直接打开 10 | -------------------------------------------------------------------------------- /apple/m1-adapter.md: -------------------------------------------------------------------------------- 1 | # M1 适配 2 | 3 | ## Xcode 4 | 5 | ### `building for iOS Simulator, but linking in object file built for iOS, for architectur` 6 | 7 | * 方法一: Xcode > 右击 > 使用 Rosetta 打开 8 | * 方法二: Xcode > Buil Settings > Build Options - Validate Workspace 改为Yes 9 | 10 | ### 运行在 My Mac(Designed for iPad) 11 | 12 | 要运行在 Mac 上必须满足下面条件 13 | 14 | * Xcode 不要使用 Rosetta 打开 15 | * developer.apple.com 添加 M1 设备 ID,Provisioning Profiles 添加对应设备 16 | 17 | ## node 18 | 19 | ### npm i 特别慢 20 | 21 | 参考 升级 node 到 14 以上,可以加速很多 22 | 23 | ## M1 上字体变小问题 24 | 25 | 没找到解决方法 26 | 27 | ## Android Studio 28 | 29 | * 参考 30 | * [Android Emulator Apple Silicon Preview](https://androidstudio.googleblog.com/2020/12/android-emulator-apple-silicon-preview.html) 31 | -------------------------------------------------------------------------------- /apple/mac-pro-change-ssd.md: -------------------------------------------------------------------------------- 1 | # Mac Pro 换 SSD 2 | 3 | ## 查看 SSD 型号 4 | 5 | Apple > 关于本机 > 系统报告 > 硬件 > SATA/SATA Express 6 | 7 | SSD的接口是苹果专门定制的PCIE的接口,不是普通的接口,需要买定制的 SSD,或者加转接口。 8 | 9 | ## 推荐 10 | 11 | * [创见(Transcend)820苹果升级专用PCI-e 3D-TLC SSD 960G(无外接盒)](https://item.jd.com/5489060.html#crumb-wrap) 12 | * [OWC Solid State Drives](https://eshop.macsales.com/shop/ssd/owc/macbook-pro-retina-display/2013-2014-2015) 13 | 14 | ## References 15 | 16 | * [2015款的macbook pro能换固态硬盘么?](https://www.zhihu.com/question/65900336) 17 | -------------------------------------------------------------------------------- /apple/review.md: -------------------------------------------------------------------------------- 1 | # 审核 2 | 3 | ## PLA 1.2 4 | 5 | * [AppStore PLA 1.2的解决方案](http://www.qingpingshan.com/rjbc/ios/232210.html) 6 | * [被拒描述 PLA 1.2](https://github.com/wg689/Solve-App-Store-Review-Problem/blob/master/app_not_associate.md) 7 | * [PLA 1.2 协议被拒,近期金融产品避不开的版权审核难题!](https://www.chandashi.com/blog/?p=2995) 8 | 9 | 金融类 App 必须用公司账户发布,如果是个人账户发布的,可以让账户管理员联系苹果客服申请升级到公司账户。 10 | -------------------------------------------------------------------------------- /apple/send-story-to-appstore-today.md: -------------------------------------------------------------------------------- 1 | # 发布文章到 AppStore 的 Today 板块 2 | 3 | 进入 [探索全新的 App Store](https://developer.apple.com/cn/app-store/discoverability/) > 拖到最下面 “分享您的故事” > [联系我们](https://developer.apple.com/contact/app-store/promote/) 4 | 5 | 或者直接进入 [Contact the App Store Team](https://developer.apple.com/contact/app-store/promote/) 6 | -------------------------------------------------------------------------------- /apple/wwdc-2019.md: -------------------------------------------------------------------------------- 1 | # WWDC 2019 2 | 3 | ## iPad OS 4 | 5 | ## Project Catalyst 6 | 7 | Marzipan 技术, iOS/iPad App 迁移到 macOS 8 | 9 | ## SwiftUI 10 | 11 | * [官方文档](https://developer.apple.com/xcode/swiftui/) 12 | * [View 布局](https://developer.apple.com/documentation/swiftui/view) 13 | 14 | 所有基础组件重写 15 | -------------------------------------------------------------------------------- /assets/14a74c04e7ac28d57893d552d5969934c3d756a523cc89e62199942cbe4ac8aa60d12d556cf603ea94e80e366f1ccf01130c8335c83f9360b60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greedbell/blog/20e19572eaece27174f718ef4bdf62b48050bd26/assets/14a74c04e7ac28d57893d552d5969934c3d756a523cc89e62199942cbe4ac8aa60d12d556cf603ea94e80e366f1ccf01130c8335c83f9360b60.png -------------------------------------------------------------------------------- /assets/14a74c04e7ac28d57893d552d5969934c3d756a523cc89e62199942cbe4ac8aa60d12d556cf603ea94e80e366f1ccf01130c8335c83f9360b61.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greedbell/blog/20e19572eaece27174f718ef4bdf62b48050bd26/assets/14a74c04e7ac28d57893d552d5969934c3d756a523cc89e62199942cbe4ac8aa60d12d556cf603ea94e80e366f1ccf01130c8335c83f9360b61.png -------------------------------------------------------------------------------- /back-end/README.md: -------------------------------------------------------------------------------- 1 | # 后端开发 2 | -------------------------------------------------------------------------------- /back-end/centos-redis.md: -------------------------------------------------------------------------------- 1 | # CentOS 安装 redis 2 | 3 | ```sh 4 | yum install redis 5 | ``` 6 | 7 | 配置文件路径:`/etc/redis.conf` 8 | 9 | ## 开机自启动 10 | 11 | ``` 12 | #设置为开机自启动服务器 13 | chkconfig redis on 14 | #打开服务 15 | service redis start 16 | #查看运行状态 17 | service redis status 18 | #关闭服务 19 | service redis stop 20 | ``` 21 | -------------------------------------------------------------------------------- /back-end/gretty.md: -------------------------------------------------------------------------------- 1 | # Gretty 2 | 3 | Gradle 使用 gretty 插件运行 web 项目 4 | 5 | * ~~[Gretty Github](https://github.com/akhikhl/gretty)~~ 6 | * [Greet Github](https://github.com/gretty-gradle-plugin/gretty) 7 | 8 | 9 | ## 安装 10 | 11 | * 12 | 13 | ## 配置 14 | 15 | * [Gretty configuration](https://gretty-gradle-plugin.github.io/gretty-doc/Gretty-configuration.html) 16 | 17 | ## jetty 18 | 19 | * [Jetty Github](https://github.com/eclipse/jetty.project) 20 | -------------------------------------------------------------------------------- /back-end/java-service.md: -------------------------------------------------------------------------------- 1 | # Java 服务 2 | 3 | * Jetty 是一个纯粹的基于 Java 的网页服务器和 Java Servlet 容器。 4 | * Gretty, Gradle 插件,它不仅支持 Jetty servlet 容器,还支持 Tomcat servlet 等多种容器.配置也相对简单。 5 | 6 | ## IntelliJ 调试 Gretty 7 | 8 | 参考 9 | 10 | ## References 11 | 12 | * [Jetty 的工作原理以及与 Tomcat 的比较 ](https://www.ibm.com/developerworks/cn/java/j-lo-jetty/index.html) 13 | * [Jetty](https://www.eclipse.org/jetty/) 14 | * [Gretty documentation](http://akhikhl.github.io/gretty-doc/index.html) 15 | -------------------------------------------------------------------------------- /back-end/java-tec.md: -------------------------------------------------------------------------------- 1 | # Java 后端技术栈 2 | 3 | ## 开发框架 4 | 5 | * Spring 6 | 7 | ## 测试框架 8 | 9 | * JUnit 10 | 11 | ## Java Web 容器 12 | 13 | * tomcat 14 | * jetty 15 | 16 | ## 网络 17 | 18 | * Netty: 异步网络通信库 19 | 20 | ### 介绍 21 | 22 | 本质上是一个 servlet 容器,即可以在其上运行 Java Web 的应用程序 23 | 24 | ## 消息队列 25 | 26 | * kafka 27 | * RabbitMq 28 | 29 | ## RPC 框架 30 | 31 | * dubbo 32 | 33 | ### 介绍 34 | 35 | RPC 是指远程过程调用,也就是说两台服务器A,B,一个应用部署在A服务器上,想要调用B服务器上应用提供的函数/方法,由于不在一个内存空间,不能直接调用,需要通过网络来表达调用的语义和传达调用的数据。 36 | 37 | * 核心知识点 38 | * 注册中心,服务注册、服务发现、负载均衡、序列化、反序列化、编码、解码等核心概念 39 | 40 | * 适用场景 41 | * 在相对复杂的应用服务网络中,扮演服务治理,服务解耦,负责均衡,简化服务调用方式的作用 42 | 43 | ## 日志 44 | 45 | * Log4j 46 | * SLF4J 47 | 48 | 49 | ## References 50 | 51 | * [Java后端技术栈梳理](https://zhuanlan.zhihu.com/p/47914139) 52 | -------------------------------------------------------------------------------- /back-end/jwt.md: -------------------------------------------------------------------------------- 1 | # json web token 2 | 3 | * [json-web-token](http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html) 4 | * [node-jsonwebtoken](https://github.com/auth0/node-jsonwebtoken) 5 | * [JSON Web Token - 在Web应用间安全地传递信息 ](http://blog.leapoahead.com/2015/09/06/understanding-jwt/) 6 | 7 | ## JWT的组成 8 | 9 | 一个JWT实际上就是一个字符串,它由三部分组成,头部、载荷与签名。 10 | 11 | ## 载荷(Payload) 12 | 13 | * iss: 该JWT的签发者 14 | * sub: 该JWT所面向的用户 15 | * aud: 接收该JWT的一方 16 | * exp(expires): 什么时候过期,这里是一个Unix时间戳 17 | * nbf(Not Before): 开始生效时间,这里是一个Unix时间戳 18 | * iat(issued at): 在什么时候签发的 19 | 20 | ```JSON 21 | { 22 | "iss": "John Wu JWT", 23 | "iat": 1441593502, 24 | "exp": 1441594722, 25 | "aud": "www.example.com", 26 | "sub": "jrocket@example.com", 27 | "from_user": "B", 28 | "target_user": "A" 29 | } 30 | ``` 31 | 32 | ## 头部(Header) 33 | 34 | * alg 签名算法 35 | 36 | ```JSON 37 | { 38 | "typ": "JWT", 39 | "alg": "HS256" 40 | } 41 | ``` 42 | 43 | ## 签名(签名) 44 | 45 | 通过密钥加密载荷和头部生成的字符串 46 | 47 | ## logout 48 | 49 | 一般用redis来缓存这些已经登出但没有失效的token 50 | -------------------------------------------------------------------------------- /back-end/mysql-ubuntu.md: -------------------------------------------------------------------------------- 1 | # ubuntu 安装 mysql 2 | 3 | 下载APT Repo 或 deb 包 4 | 5 | ```sh 6 | wget http://dev.mysql.com/get/mysql-apt-config_0.8.1-1_all.deb 7 | ``` 8 | 9 | 安装所得 deb 包 10 | 11 | ```sh 12 | dpkg -i mysql-apt-config_0.8.1-1_all.deb 13 | ``` 14 | 15 | 安装 mysql 16 | 17 | ```sh 18 | apt-get update 19 | apt-get install mysql-server 20 | ``` 21 | -------------------------------------------------------------------------------- /back-end/mysql-useage.md: -------------------------------------------------------------------------------- 1 | # mysql 使用 2 | 3 | 登录 4 | 5 | ```shell 6 | $ mysql -uroot -p 7 | ``` 8 | 9 | 列出所有数据库 10 | 11 | ```SQL 12 | show databases; 13 | ``` 14 | 15 | 创建数据库 16 | 17 | ```SQL 18 | CREATE DATABASE abccs; 19 | ``` 20 | 21 | 切换数据库 22 | 23 | ```SQL 24 | use databasename; 25 | ``` 26 | 27 | 查看当前数据库 28 | 29 | ```SQL 30 | SELECT database(); 31 | ``` 32 | 33 | 列出所有表 34 | 35 | ```SQL 36 | show tables; 37 | ``` 38 | 39 | 查看表结构 40 | 41 | ```SQL 42 | desc tablename; 43 | ``` 44 | 45 | 创建用户 46 | 47 | ```SQL 48 | CREATE USER 'username'@'host' IDENTIFIED BY 'password'; 49 | CREATE USER 'username'@'%' IDENTIFIED BY 'password'; 50 | ``` 51 | 52 | 给用户授权 53 | 54 | ```SQL 55 | GRANT privileges ON databasename.tablename TO 'username'@'host' 56 | GRANT ALL ON *.* TO 'bell'@'%'; 57 | ``` 58 | -------------------------------------------------------------------------------- /back-end/nginx.md: -------------------------------------------------------------------------------- 1 | # nginx 2 | 3 | * [官网](http://nginx.org/) 4 | * [下载](http://nginx.org/en/download.html) 5 | 6 | ## 图片处理 7 | 8 | * [ngx_http_image_filter_module](http://nginx.org/en/docs/http/ngx_http_image_filter_module.html) 9 | * [Nginx dynamic image resizing with caching](https://stumbles.id.au/nginx-dynamic-image-resizing-with-caching.html) 10 | 11 | ## location 12 | 13 | * [location 官方文档](http://nginx.org/en/docs/http/ngx_http_core_module.html#location) 14 | * [nginx配置location总结及rewrite规则写法](http://seanlook.com/2015/05/17/nginx-location-rewrite/) 15 | -------------------------------------------------------------------------------- /back-end/redis-questions.md: -------------------------------------------------------------------------------- 1 | # redis-questions 2 | 3 | ## hash expire 4 | 5 | * 6 | 7 | ``` 8 | redis 127.0.0.1:6379> hset expire:me name tom 9 | (integer) 0 10 | redis 127.0.0.1:6379> hget expire:me name 11 | "tom" 12 | 13 | redis 127.0.0.1:6379> expire expire:me 10 14 | (integer) 1 15 | redis 127.0.0.1:6379> ttl expire:me 16 | (integer) 8 17 | 18 | ... 19 | ... 20 | ... 21 | 22 | redis 127.0.0.1:6379> ttl expire:me 23 | (integer) -1 24 | redis 127.0.0.1:6379> hget expire:me name 25 | (nil) 26 | ``` 27 | -------------------------------------------------------------------------------- /back-end/tomcat-mac.md: -------------------------------------------------------------------------------- 1 | # Tomca For Mac 2 | 3 | ## 安装 4 | 5 | ``` 6 | brew install tomcat@8 7 | ``` 8 | 9 | 安装地址: 10 | 11 | ``` 12 | /usr/local/opt/tomcat\@8/ -> /usr/local/Cellar/tomcat\@8/8.5.41/ 13 | ``` 14 | 15 | 启动服务 16 | 17 | ``` 18 | brew tap homebrew/services 19 | brew services start tomcat 20 | ``` 21 | 22 | ## Debug 23 | 24 | https://www.mkyong.com/intellij/intellij-idea-run-debug-web-application-on-tomcat/ 25 | -------------------------------------------------------------------------------- /back-end/tomcat.md: -------------------------------------------------------------------------------- 1 | # Tomcat 2 | 3 | ## 请求处理方式 4 | 5 | * BIO: 每个请求都要创建一个线程来处理 6 | * NIO: 是一个基于缓冲区、并能提供非阻塞I/O操作的Java API,它拥有比传统I/O操作(bio)更好的并发运行性能。Tomcat8 以上默认 7 | * APR: 从操作系统级别解决异步IO问题,大幅度的提高服务器的处理和响应性能, 也是Tomcat运行高并发应用的首选模式。 8 | -------------------------------------------------------------------------------- /back-end/url-uri.md: -------------------------------------------------------------------------------- 1 | # URL 与 URI 的区别 2 | 3 | URI,是uniform resource identifier,统一资源标识符,用来唯一的标识一个资源。而URL是uniform resource locator,统一资源定位器,它是一种具体的URI。 4 | 5 | URI实例可以代表绝对的,也可以是相对的,只要它符合URI的语法规则。而URL类则不仅符合语义,还包含了定位该资源的信息,因此它不能是相对的,scheme必须被指定 6 | 7 | URI抽象结构: 8 | 9 | ``` 10 | [scheme:]scheme-specific-part[#fragment] 11 | [scheme:][//authority][path][?query][#fragment] 12 | ``` 13 | 14 | authority为[user-info@]host[:port] 15 | -------------------------------------------------------------------------------- /big-front/README.md: -------------------------------------------------------------------------------- 1 | # 大前端 2 | -------------------------------------------------------------------------------- /boostnote.json: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "key": "9864ac277b390621ef85", 5 | "color": "#6AA5E9", 6 | "name": "Default" 7 | } 8 | ], 9 | "version": "1.0" 10 | } 11 | -------------------------------------------------------------------------------- /chat/node.js.md: -------------------------------------------------------------------------------- 1 | # node.js 2 | 3 | 4 | 5 | 需要python2.6 or 2.7 6 | 7 | 8 | ## 编译好的文件安装 9 | 10 | ```shell 11 | wget https://nodejs.org/dist/v4.2.2/node-v4.2.2-linux-x64.tar.gz --no-check-certificate 12 | tar zxvf node-v4.2.2-linux-x64.tar.gz 13 | mv node-v4.2.2-linux-x64 node 14 | ./node/bin/npm --version 15 | ``` 16 | 17 | ## 源码安装 18 | 19 | ```shell 20 | wget https://nodejs.org/dist/v4.2.2/node-v4.2.2.tar.gz --no-check-certificate 21 | 22 | tar zxvf node-v4.2.2.tar.gz 23 | mv node-v4.2.2-linux-x64 node 24 | ./node/bin/npm --version 25 | ``` 26 | 27 | ## Q 28 | 29 | ``` 30 | Error: Python executable "python2" is v2.4.3, which is not supported by gyp. 31 | ``` 32 | 33 | # 版本选择 34 | 35 | `bluehost`的`python`版本是`Python 2.4.3`,` node-v4.2.2`需要`Python 2.6 or 2.7` 36 | -------------------------------------------------------------------------------- /chat/real-time.md: -------------------------------------------------------------------------------- 1 | # 实时聊天的实现 2 | 3 | 用 websocket 就可以了吧,如果不用 php 做后端的话,最简单的方案就是用 socket.io,或者架一个 mqtt 协议的服务器,现在http 的话新的方法就是基于 websocket 的,不用 http 的话可以考虑 mqtt 协议,http 长连接/websocket 方案用 swoole 或者 socket.io 都可以实现,mqtt 协议就找个 mqtt 服务器端来改,客户端有相应的 mqtt 库 4 | 5 | ## php 6 | 7 | 用`websocket`。`Swoole` , `Workerman` 可实现websocket,swoole需要编译,虚拟机上没法实现,Workerman需要php cli 8 | 9 | Workerman 10 | php 11 | 12 | ape 13 | C,编译不了 14 | 15 | socketo 16 | php 17 | 18 | ### php+websocket 19 | 20 | php有可用的websocket库,不需要php-fpm。 21 | 目前比较成熟的有swoole(swoole.com),和workman(workman.net) 22 | swoole是c写的php扩展, 效率比nodejs还要高,workman是纯php实现,两者都号称可以实现并发百万TCP连接。 23 | 24 | ## 非php 25 | 26 | ` socket.io` ,`mqtt` 27 | 28 | ### socket.io 29 | 30 | * 服务器 31 | 32 | 基于 Node.js 实现 33 | 34 | 35 | 36 | * 客户端 37 | 38 | 自动使用 WebSocket、轮循 39 | 40 | 41 | 42 | ### SockJS 43 | 44 | 只有js版 45 | 46 | ## 总结 47 | 48 | socket.io 49 | -------------------------------------------------------------------------------- /chat/socket.io.md: -------------------------------------------------------------------------------- 1 | # socket.io 2 | 3 | * 服务器 4 | 5 | 6 | 7 | * 客户端 8 | 9 | 10 | 11 | ## 安装 12 | -------------------------------------------------------------------------------- /chat/third-real-time.md: -------------------------------------------------------------------------------- 1 | # 第三方实时聊天实现 2 | 3 | ## 方案 4 | 5 | ### Urban Airship 6 | 7 | 太贵了 8 | 9 | ### Parse 10 | 11 | 也贵 12 | 13 | ### Push Woosh 14 | 15 | 可以免费 16 | 17 | ### 个推 18 | 19 | ### 融云 20 | 21 | 22 | 23 | 服务器地址: [api.cn.ronghub.com](api.cn.ronghub.com) 24 | 25 | 状态码是数字,但是美国ping值太高。 26 | 27 | 官方说法服务器在AWS上,会自动选择服务器 28 | 29 | ## 总结 30 | 31 | 融云 32 | -------------------------------------------------------------------------------- /ci/drone.md: -------------------------------------------------------------------------------- 1 | # Drone 2 | 3 | * [GitHub](https://github.com/drone/drone) 4 | -------------------------------------------------------------------------------- /ci/gitlab-ci.md: -------------------------------------------------------------------------------- 1 | # centos 安装 gitlab ci 2 | 3 | 用 git 用户安装 4 | 5 | * 6 | 7 | ## 安装 gitlab-ci-runner 8 | 9 | * 10 | 11 | ```shell 12 | curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.rpm.sh | sudo bash 13 | yum install -y gitlab-ci-multi-runner 14 | ``` 15 | 16 | ## docker 方式安装 gitlab-ci-runner 17 | 18 | * 19 | 20 | ## 配置 21 | 22 | * [.gitlab-ci.yml 配置](http://192.168.1.11/help/ci/yaml/README.md) 23 | 24 | ### 概念 25 | 26 | Pipeline > Stages > Jobs 27 | 28 | ## References 29 | 30 | * [用 GitLab CI 进行持续集成](https://scarletsky.github.io/2016/07/29/use-gitlab-ci-for-continuous-integration/) 31 | -------------------------------------------------------------------------------- /ci/jenkins-hook-gitlab.md: -------------------------------------------------------------------------------- 1 | # Jenkins 监听 Gitlab 事件 2 | 3 | 使用 `GitLab Branch Source Plugin` 4 | 5 | ## Reference 6 | 7 | * [Jenkins Gitlab插件的使用](https://juejin.im/post/5dce6b3a5188254eed5b23a2) 8 | * [gitlab触发jenkins构建(最佳?)实践](https://zhuanlan.zhihu.com/p/109423597) 9 | * [Push Notification From Repository](https://plugins.jenkins.io/git/#push-notification-from-repository) 10 | * [GitLab Branch Source Plugin](https://github.com/jenkinsci/gitlab-branch-source-plugin) 11 | -------------------------------------------------------------------------------- /dev-ops/README.md: -------------------------------------------------------------------------------- 1 | # 运维 2 | 3 | * [Linux命令大全](http://man.linuxde.net/) 4 | 5 | ## profile .bash_profile .bashrc 区别 6 | 7 | /etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行. 8 | 并从/etc/profile.d目录的配置文件中搜集shell的设置. 9 | 10 | ~/.bash_profile:每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该 11 | 文件仅仅执行一次!默认情况下,他设置一些环境变量,执行用户的.bashrc文件. 12 | 13 | ~/.bashrc:该文件包含专用于你的bash shell的bash信息,当登录时以及每次打开新的shell时,该 14 | 该文件被读取. 15 | 16 | ~/.bash_logout:当每次退出系统(退出bash shell)时,执行该文件. 17 | 18 | 另外,/etc/profile中设定的变量(全局)的可以作用于任何用户,而~/.bashrc等中设定的变量(局部)只能继承/etc/profile中的变量,他们是\"父子\"关系. 19 | 20 | ## .bash_profile 与 .bashrc 的区别 21 | 22 | * `.bash_profile` login shells 23 | * `.bashrc` non-login shells 24 | 25 | ### login shell 与 non-login shell 的区别 26 | 27 | 1. 当你直接在机器login界面登陆、使用ssh登陆或者su切换用户登陆时,.bash_profile 会被调用来初始化shell环境 28 | 29 | Note:.bash_profile文件默认调用.bashrc文件 30 | .bash_profile中有如下内容 31 | if [ -f ~/.bashrc ]; then 32 | . ~/.bashrc 33 | fi 34 | 35 | 2. 当你不登陆系统而使用ssh直接在远端执行命令,.bashrc 会被调用 36 | 3. 当你已经登陆系统后,每打开一个新的Terminal时,.bashrc 都会被再次调用。 37 | -------------------------------------------------------------------------------- /dev-ops/auto-launch.md: -------------------------------------------------------------------------------- 1 | # Centos 自启动 2 | 3 | ## 方法一 4 | 5 | `/etc/rc.d/rc.local` 6 | 7 | ## 方法二 8 | 9 | `/etc/rc.d/rc.sysinit` 10 | 11 | ## 方法三 12 | 13 | `chkconfig` 14 | 15 | ## References 16 | 17 | * [CentOS 程序开机自启动方法总结 ](http://blog.csdn.net/nightelve/article/details/17386345) 18 | -------------------------------------------------------------------------------- /dev-ops/batch-delete.md: -------------------------------------------------------------------------------- 1 | # 批量删除 2 | 3 | ```bash 4 | find . -name ".git" -exec rm -rf "{}" \; 5 | ``` 6 | -------------------------------------------------------------------------------- /dev-ops/curl.md: -------------------------------------------------------------------------------- 1 | # curl 2 | 3 | ## 下载文件 4 | 5 | * -O 下载文件并以原名保存到当前目录中 6 | * -o 指定下载后文件的名字 7 | * -C 断点续传 8 | 9 | eg: 10 | ``` 11 | $ curl https://progit2.s3.amazonaws.com/zh/2015-12-02-9d8a9/progit-zh.936.pdf -O -C 0 12 | ``` 13 | 14 | ## GET 请求 15 | 16 | ```sh 17 | $ curl example.com/form.cgi?data=xxx 18 | ``` 19 | 20 | ## POST 请求 21 | 22 | ```sh 23 | $ curl -X POST --data "data=xxx" example.com/form.cgi 24 | ``` 25 | 26 | ## 其它参数 27 | 28 | * `--user-agent` 29 | * `--cookie` 30 | * `--header` 31 | -------------------------------------------------------------------------------- /dev-ops/ddns.md: -------------------------------------------------------------------------------- 1 | # 动态DNS 2 | 3 | 英语:Dynamic DNS,简称DDNS 4 | 5 | 在互联网的管理层面来说,动态DNS更新是指创建一个DNS系统,能够自动更新传统的DNS记录,而不需要手动编辑。 6 | 7 | 在客户端来说,动态DNS提供了一个轻量化机制,让本地DNS数据库可以即时的更新。 8 | 9 | 它能把互联网域名指往一个可能经常改变的IP地址,让经常改变位置及配置的设备,能够持续性的更新IP地址。 10 | -------------------------------------------------------------------------------- /dev-ops/docker-dockerfile.md: -------------------------------------------------------------------------------- 1 | # Dockerfile 使用 2 | 3 | ## 编译镜像 4 | 5 | ```shell 6 | docker build -t 7 | ``` 8 | 9 | ## 查看镜像 10 | 11 | ```shell 12 | docker images 13 | ``` 14 | 15 | ## 修改 tag 16 | 17 | ```shell 18 | docker tag 19 | ``` 20 | 21 | Example: `docker tag ca1b6b825289 registry.cn-test.aliyuncs.com/xxxxxxx:v1.0` 22 | 23 | ## 创建容器 24 | 25 | ```shell 26 | docker run -d -p : 27 | ``` 28 | 29 | ## 查看容器 30 | 31 | ```sh 32 | docker ps -a 33 | ``` 34 | -------------------------------------------------------------------------------- /dev-ops/docker-mac.md: -------------------------------------------------------------------------------- 1 | # Docker For Mac 2 | 3 | ## Install 4 | 5 | ### 方法一 6 | 7 | 参考 8 | 9 | ### 方法二 brew 10 | 11 | ```sh 12 | brew cask install docker 13 | ``` 14 | 15 | -------------------------------------------------------------------------------- /dev-ops/du.md: -------------------------------------------------------------------------------- 1 | # du 计算文件/文件夹大小 2 | 3 | 按大小逆序排列 4 | 5 | ```sh 6 | # mac 用 du -hs * | sort -hr 7 | $ du -hs * | gsort -hr 8 | 36G Developer 9 | 29G Android 10 | 14G Application Support 11 | 4.7G Containers 12 | 4.6G Caches 13 | 1.0G Logs 14 | 679M Mail 15 | 103M Preferences 16 | 32M Safari 17 | ``` 18 | -------------------------------------------------------------------------------- /dev-ops/gitlab-cli.md: -------------------------------------------------------------------------------- 1 | # Gitlab CLI 2 | 3 | Gitlab API 中的 Project ID 是工程名 URL encode 4 | 5 | * `/` 转成 `%2F` 6 | 7 | ## git push 里提示创建 merge request 8 | 9 | ``` 10 | gitlab > Settings > General > Merge request > 勾选 Show link to create/view merge request when pushing from the command line 11 | ``` -------------------------------------------------------------------------------- /dev-ops/host-info.md: -------------------------------------------------------------------------------- 1 | # 查看主机信息 2 | 3 | 查看内核操作系统版本 4 | 5 | ````shell 6 | # uname -a 7 | Linux cp-43.webhostbox.net 2.6.32-531.23.3.lve1.3.6.el5h.x86_64 #1 SMP Mon Sep 29 18:16:21 CEST 2014 x86_64 x86_64 x86_64 GNU/Linux 8 | # cat /proc/version 9 | Linux version 2.6.32-531.23.3.lve1.3.6.el5h.x86_64 (mockbuild@build.cloudlinux.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-54)) #1 SMP Mon Sep 29 18:16:21 CEST 2014 10 | # getconf LONG_BIT 11 | 64 12 | ```` 13 | 14 | 查看glibc版本 15 |  16 | ```shell 17 | rpm -qi glibc 18 | rpm -qa | grep glibc 19 | ls -l /lib/libc.so.6 20 | # ls -l /lib/libc.so.* 21 | lrwxrwxrwx 1 root root 11 08-18 00:01 /lib/libc.so.6 -> libc-2.5.so* 22 | # ls -l /lib64/libc.so.* 23 | lrwxrwxrwx 1 root root 11 08-18 00:01 /lib64/libc.so.6 -> libc-2.5.so* 24 | ``` 25 | -------------------------------------------------------------------------------- /dev-ops/iptables.md: -------------------------------------------------------------------------------- 1 | # iptables 2 | 3 | Linux防火墙 4 | 5 | ## 查看 6 | 7 | ```shell 8 | # iptables -L 9 | ``` 10 | 11 | ## 开启与关闭 12 | 13 | ### 重启系统生效 14 | 15 | #### 开启 16 | 17 | ```shell 18 | # chkconfig iptables on 19 | ``` 20 | 21 | #### 关闭 22 | 23 | ```shell 24 | # chkconfig iptables off 25 | ``` 26 | 27 | ### 即时生效,重启后失效 28 | 29 | #### 开启 30 | 31 | ```shell 32 | # service iptables start 33 | ``` 34 | 35 | #### 关闭 36 | 37 | ```shell 38 | # service iptables stop 39 | ``` 40 | 41 | ## 配置文件 42 | 43 | /etc/sysconfig/iptables 44 | 45 | ## 添加端口 46 | 47 | iptables -A INPUT -p tcp -m tcp --dport 3001 -j ACCEPT 48 | 49 | service iptables restart 50 | -------------------------------------------------------------------------------- /dev-ops/jmx-exporter.md: -------------------------------------------------------------------------------- 1 | # JMX Exporter 2 | 3 | * [GitHub](https://github.com/prometheus/jmx_exporter) 4 | 5 | ## 集成步骤 6 | 7 | 1. 下载 jmx_prometheus_javaagent-0.12.0.jar 8 | 2. 参考 配置 jmx_exporter.yml 9 | 3. 配置 JAVA_OPTS ` -javaagent:/your/path/to/jmx_prometheus_javaagent.jar=2112:/your/path/to/jmx_exporter.yml` 10 | 11 | 运行 java 程序,通过 2112 端口查看 JVM 信息 12 | 13 | ## References 14 | 15 | * [使用Prometheus+Grafana监控JVM](https://chanjarster.github.io/post/prom-grafana-jvm/) 16 | * [在k8s集群中,利用prometheus的jmx_exporter进行tomcat的JVM性能监控,并用grafana作前端展示](https://www.cnblogs.com/aguncn/p/10106453.html) 17 | -------------------------------------------------------------------------------- /dev-ops/kibana.md: -------------------------------------------------------------------------------- 1 | # kibana 2 | 3 | ## lucene 查询语法 4 | -------------------------------------------------------------------------------- /dev-ops/logrotate.md: -------------------------------------------------------------------------------- 1 | # Logrotate 管理日志 2 | 3 | * 命令路径:`/usr/sbin/logrotate` 4 | * 配置路径:`/etc/logrotate.conf` `/etc/logrotate.d/*` 5 | 6 | ## Reference 7 | 8 | * [被遗忘的Logrotate](http://huoding.com/2013/04/21/246) 9 | * [Linux的日志文件管理工具——logrotate](http://linuxzkq.blog.51cto.com/9379412/1659731) 10 | * [logrotate](http://linuxcommand.org/man_pages/logrotate8.html) 11 | -------------------------------------------------------------------------------- /dev-ops/mac-sha256sum.md: -------------------------------------------------------------------------------- 1 | # Mac 生成 sha256sum 2 | 3 | ## 生成毫秒时间戳 4 | 5 | mac 下的 date 无法生成毫秒时间戳,所以需要安装 gdate 6 | 7 | ```sh 8 | brew install coreutils 9 | ``` 10 | 11 | 生成毫秒 12 | 13 | ```sh 14 | expr $(gdate +%s%N) / 1000000 15 | ``` 16 | 17 | ## 生成 HMAC SHA256 18 | 19 | ```sh 20 | MESSAGE=$(expr $(gdate +%s%N) / 1000000) 21 | SECRET="secret" 22 | 23 | echo -n $MESSAGE | openssl dgst -sha256 -hmac $SECRET -binary | base64 24 | ``` 25 | 26 | 27 | ## References 28 | 29 | * [Examples of creating base64 hashes using HMAC SHA256 in different languages](https://www.jokecamp.com/blog/examples-of-creating-base64-hashes-using-hmac-sha256-in-different-languages/#shell) 30 | -------------------------------------------------------------------------------- /dev-ops/modify-string.md: -------------------------------------------------------------------------------- 1 | # Mac 批量修改字符串 2 | 3 | ## 列出所有.m文件 4 | 5 | ```shell 6 | $ find ./ -name *.m 7 | ``` 8 | 9 | ## vi中批量替换 10 | 11 | ```shell 12 | :g#sourceString#s##targetString#g 13 | ``` 14 | 15 | ## sed命令下批量替换文件内容 16 | 17 | 格式: sed "s/查找字段/替换字段/g" 18 | 19 | ```shell 20 | $ sed -i "" "s/sourceString/targetString/g" test.m 21 | ``` 22 | 23 | * `-i`: 直接修改原文 24 | 25 | ## 批量替换 26 | 27 | ```shell 28 | #bin/sh 29 | target_files=`find ./ -name *.m` 30 | for target_file in ${target_files} 31 | do 32 | echo ${target_file} 33 | sed -i "" "s/sourceString/targetString/g" ${target_file} 34 | done 35 | ``` 36 | -------------------------------------------------------------------------------- /dev-ops/network.md: -------------------------------------------------------------------------------- 1 | # 网络相关命令 2 | 3 | ## netperf 4 | 5 | 网络性能测试 6 | 7 | ```sh 8 | # server 9 | service netperf start 10 | 11 | # client 12 | # 测试tcp吞吐 13 | netperf -t TCP_STREAM -H ip_of_server -l 10 14 | ``` 15 | 16 | ## iperf 17 | 18 | 测试带宽 19 | 20 | ```sh 21 | # server 22 | iperf -s 23 | 24 | # client 25 | iperf -c ip_of_server 26 | ``` 27 | 28 | ## netcat 29 | 30 | ```sh 31 | # server 32 | nc -l -p 22222 < /dev/zero 33 | 34 | # client 35 | nc ip_of_server 22222 > | pv 36 | ``` 37 | 38 | ## nmap 39 | 40 | 扫描 IP 端口等信息 41 | 42 | ```sh 43 | nmap -v -sn 172.16.1-254.1-254 44 | ``` 45 | 46 | ping 172.16.1.1 到 172.16.254.254 范围内的所有 IP 47 | 48 | ## References 49 | 50 | * [netperf 与网络性能测量](https://www.ibm.com/developerworks/cn/linux/l-netperf/) 51 | * [通过netcat或iperf测试网络带宽](https://blog.tankywoo.com/linux/2014/03/18/test-bandwidth-by-netcat.html) 52 | -------------------------------------------------------------------------------- /dev-ops/port.md: -------------------------------------------------------------------------------- 1 | ## 端口相关命令 2 | 3 | 查看端口占用情况的命令 4 | 5 | ``` 6 | lsof -i 7 | ``` 8 | 9 | 查看某一端口的占用情况 10 | 11 | ``` 12 | lsof -i:21 13 | ``` 14 | 15 | 结束占用端口的进程 16 | 17 | ``` 18 | killall pure-ftpd 19 | ``` 20 | 21 | 也可使用命令: 22 | 23 | ``` 24 | netstat -apn|grep <端口号> 25 | ``` 26 | 27 | 找到进程号以后,再使用以下命令查看详细信息: 28 | ``` 29 | ps -aux|grep <进程号> 30 | ``` 31 | -------------------------------------------------------------------------------- /dev-ops/rsync.md: -------------------------------------------------------------------------------- 1 | # rsync 2 | 3 | 同步文件 4 | 5 | 6 | ```sh 7 | # 本地文件同步到远端 8 | rsync [OPTION]... [SRC]... [USER@]HOST::DEST 9 | 10 | # 远端文件同步到本地 11 | rsync [OPTION]... [USER@]HOST::DEST [SRC]... 12 | ``` 13 | 14 | ## 参数 15 | 16 | ``` 17 | -a, --archive 归档模式,表示以递归方式传输文件,并保持所有文件属性,等于-rlptgoD。 18 | -v, --verbose 详细模式输出。 19 | -r, --recursive 对子目录以递归模式处理。 20 | -z, --compress 传递的时候先压缩 21 | --delete 删除那些DST中SRC没有的文件。 22 | --delete-excluded 同样删除接收端那些被该选项指定排除的文件。 23 | --exclude=PATTERN 指定排除不需要传输的文件模式。 24 | --include=PATTERN 指定不排除而需要传输的文件模式。 25 | ``` 26 | 27 | ## Reference 28 | 29 | * [rsync命令](http://man.linuxde.net/rsync) 30 | -------------------------------------------------------------------------------- /dev-ops/ssh.md: -------------------------------------------------------------------------------- 1 | # SSH 2 | 3 | ## SSH 互信 4 | 5 | ```shell 6 | ssh-keygen -t rsa 7 | cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys 8 | chmod 755 ~/.ssh 9 | chmod 600 ~/.ssh/authorized_keys 10 | ``` 11 | 12 | ## 配置 SSH 不自动关闭 13 | 14 | 在服务端 15 | 16 | 打开 17 | /etc/ssh/sshd_config 18 | 找到 19 | ClientAliveInterval 20 | 参数,如果没有就自己加一行 21 | 数值是秒,比如你设置为540,就是9分钟. 22 | ClientAliveInterval 540 23 | 24 | 对于 25 | ClientAliveCountMax 26 | 指如果发现客户端没有相应,则判断一次超时,这个参数设置允许超时的次数。比如10 27 | ClientAliveInterval 540 28 | ClientAliveCountMax 10; 29 | 30 | 则代表允许超时 5400秒 = 90分钟 31 | 32 | ``` 33 | service sshd restart 34 | ``` 35 | 36 | ## ssh-agent 37 | 38 | 在 Mac OS X 上,当系统重新启动后,ssh-agent 再次启动时会 “忘记” 这个密钥。不过您可以通过以下命令将您的 SSH 密钥导入到密钥链中: 39 | 40 | ```sh 41 | eval `ssh-agent -s` 42 | ssh-add -K 您的密钥 43 | ``` 44 | 45 | ## References 46 | 47 | * [SSH keys (简体中文)](https://wiki.archlinux.org/index.php/SSH_keys_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)) 48 | -------------------------------------------------------------------------------- /dev-ops/sudo.md: -------------------------------------------------------------------------------- 1 | # 为普通用户添加 sudo 权限 2 | 3 | ```sh 4 | # sudoedit /etc/sudoers 5 | ``` 6 | 7 | 找到 root ALL=(ALL) ALL这一行,在后面再加上一行就可以了(不用引号): 8 | “username ALL=(ALL) ALL” 9 | -------------------------------------------------------------------------------- /dev-ops/tar.md: -------------------------------------------------------------------------------- 1 | # tar 2 | 3 | 范例一:将整个 /etc 目录下的档案全部打包成为 /tmp/etc.tar 4 | 5 | ```sh 6 | [root@linux ~]# tar -cvf /tmp/etc.tar /etc <==仅打包,不压缩! 7 | [root@linux ~]# tar -czvf /tmp/etc.tar.gz /etc <==打包后,以 gzip 压缩 8 | [root@linux ~]# tar -cjvf /tmp/etc.tar.bz2 /etc <==打包后,以 bzip2 压缩 9 | ``` 10 | 11 | 范例二:查阅上述 /tmp/etc.tar.gz 档案内有哪些档案? 12 | 13 | ```sh 14 | [root@linux ~]# tar -tzvf /tmp/etc.tar.gz 15 | ``` 16 | 17 | 范例三:将 /tmp/etc.tar.gz 档案解压缩在 /usr/local/src 底下 18 | 19 | ```sh 20 | [root@linux ~]# cd /usr/local/src 21 | [root@linux src]# tar -xzvf /tmp/etc.tar.gz 22 | ``` -------------------------------------------------------------------------------- /dev-ops/user-group.md: -------------------------------------------------------------------------------- 1 | # 用户和群组管理 2 | 3 | * 4 | 5 | ## 创建用户 6 | 7 | ```shell 8 | # useradd -s /bin/bash -m user 9 | # passwd user 10 | ``` 11 | 12 | ## 删除用户 13 | 14 | ``` 15 | # userdel user 16 | ``` 17 | 18 | ## 创建群组 19 | 20 | ```sh 21 | # groupadd group 22 | ``` 23 | 24 | ## 给已有的用户增加工作组 25 | 26 | ```shell 27 | # gpasswd -a user group 28 | ``` 29 | 30 | 或 31 | 32 | ```shell 33 | # usermod -a -G group user 34 | ``` 35 | 36 | ## 查看用户所在群组 37 | 38 | ```shell 39 | $ groups 40 | ``` 41 | 42 | 或 43 | 44 | ```shell 45 | # groups user 46 | ``` 47 | 48 | ## 配置文件 49 | 50 | /etc/passwd 注:用户(user)的配置文件; 51 | /etc/shadow 注:用户(user)影子口令文件; 52 | /etc/group 注:用户组(group)配置文件; 53 | /etc/gshadow 注:用户组(group)的影子文件; 54 | -------------------------------------------------------------------------------- /file-format/README.md: -------------------------------------------------------------------------------- 1 | # 文件格式转换 2 | 3 | * [pandoc](https://github.com/jgm/pandoc) 支持很多种格式间转换 4 | * [ONLYOFFICE](https://github.com/ONLYOFFICE) 开源 Office 5 | 6 | ## Apache 7 | 8 | ### Apache FOP 9 | 10 | XSL-FO to PDF 11 | 12 | ### Apache Batik 13 | 14 | 使用 SVG 实现各种功能 15 | 16 | ```sh 17 | java -jar batik-ttf2svg.jar /usr/home/myFont.ttf -l 48 -h 57 -id MySVGFont -o mySVGFont.svg -testcard 18 | ``` 19 | 20 | ### Apache XML Graphics 21 | 22 | 集成 FOP Batik 23 | 24 | ## aspose 25 | 26 | ## EMF to SVG 27 | 28 | * [ucancode](http://www.ucancode.net/Convert_EMF_TO_SVG.htm) 29 | 30 | ## TIFF to SVG 31 | 32 | 33 | * [FreeHEP VectorGraphics ](http://java.freehep.org/vectorgraphics/) 34 | 35 | ## ImageMagick 36 | 37 | ## References 38 | 39 | * [The differences between export formats](https://www.graphpad.com/guides/prism/7/user-guide/index.htm?chosing_an_export_format.htm) 40 | -------------------------------------------------------------------------------- /file-format/aspose.md: -------------------------------------------------------------------------------- 1 | # Aspose 2 | 3 | 一个强大的文件格式转化工具,收费 4 | 5 | ## Cells 6 | 7 | ### 问题 8 | 9 | * xls 转 xlsx 的时候筛选器 autoFilter 会丢失 colorFilter 字段 10 | 11 | ## References 12 | 13 | * [Aspose 官网](www.aspose.com) 14 | * [Spreadsheet File Formats](https://wiki.fileformat.com/specification/spreadsheet/) 15 | * [Aspose.Cells for Java Example](https://github.com/aspose-cells/Aspose.Cells-for-Java) 16 | -------------------------------------------------------------------------------- /file-format/csv.md: -------------------------------------------------------------------------------- 1 | # CSV 2 | 3 | Example 4 | 5 | | Year | Make | Model | Description | Price | 6 | | :------ | :------ | :------ | :------ | :------ | 7 | | 1997 | Ford | E350 | "ac, abs, moon" | 3000.00 | 8 | | 1999 | Chevy | Venture "Extended Edition" | | 4900.00 | 9 | | 1999 | Chevy | Venture "Extended Edition, Very Large" | | 5000.00 | 10 | | 1996 | Jeep | Grand Cherokee | MUST SELL!
air, moon roof, loaded | 4799.00 | 11 | 12 | 转成 CSV 13 | 14 | ```CSV 15 | Year,Make,Model,Description,Price 16 | 1997,Ford,E350,"ac, abs, moon",3000.00 17 | 1999,Chevy,"Venture ""Extended Edition""","",4900.00 18 | 1999,Chevy,"Venture ""Extended Edition, Very Large""",,5000.00 19 | 1996,Jeep,Grand Cherokee,"MUST SELL! 20 | air, moon roof, loaded",4799.00 21 | ``` 22 | 23 | ## References 24 | 25 | * [wikipedia](https://en.wikipedia.org/wiki/Comma-separated_values) 26 | * [IETF 标准](https://tools.ietf.org/html/rfc4180) 27 | -------------------------------------------------------------------------------- /file-format/json-to-xml.md: -------------------------------------------------------------------------------- 1 | # JSON 转 XML 2 | 3 | ## Java 4 | 5 | * [JSON-java](https://github.com/stleary/JSON-java) 6 | * [Json-lib](http://json-lib.sourceforge.net/) 7 | 8 | ## References 9 | 10 | * 11 | -------------------------------------------------------------------------------- /file-format/markdown.md: -------------------------------------------------------------------------------- 1 | # Markdown 2 | 3 | ## 相关资料 4 | 5 | * [Choosing the Right Markdown Parser](https://css-tricks.com/choosing-right-markdown-parser/) 6 | * [npm trends markdown-it vs marked vs showdown](https://www.npmtrends.com/markdown-it-vs-marked-vs-showdown) 7 | * [Markdown 规范](https://tools.ietf.org/html/rfc7763) 8 | 9 | ## Markdown 库 10 | 11 | * [marked](https://github.com/markedjs/marked) Markdown 解析编译库 12 | * [markdown-it](https://github.com/markdown-it/markdown-it) Markdown 解析编译库 13 | * [showdown](https://github.com/showdownjs/showdown) 14 | 15 | ## Markdown 在线编辑器 16 | 17 | * [stackedit](https://github.com/benweet/stackedit) 依赖 markdown-it 18 | * [dillinger](https://github.com/joemccann/dillinger) 依赖 markdown-it 19 | * [editor.md](https://github.com/pandao/editor.md) 20 | 21 | ## Q&A 22 | 23 | * [Markdown 支持 SVG](https://stackoverflow.com/a/16462143/5266652) 24 | -------------------------------------------------------------------------------- /file-format/ms-office.md: -------------------------------------------------------------------------------- 1 | # Microsoft Office 2 | 3 | Microsoft Office 是对 Office Open XML 的扩展 4 | 5 | 6 | ## VBA 7 | 8 | 在 Office 中运行的 VB 脚本 9 | 10 | * [Office VBA Reference](https://docs.microsoft.com/en-us/office/vba/api/overview/) 11 | * [Office VBA 参考](https://docs.microsoft.com/zh-cn/office/vba/api/overview/) 12 | 13 | ## OFfice 加载项(add-ins) 14 | 15 | * [Office 加载项文档](https://docs.microsoft.com/zh-cn/office/dev/add-ins/) 16 | 17 | ## Macro 18 | 19 | http://dmcritchie.mvps.org/excel/getstarted.htm 20 | 21 | ## References 22 | 23 | * [Office File Formats](https://docs.microsoft.com/en-us/openspecs/office_file_formats/ms-offfflp/8aea05e3-8c1e-4a9a-9614-31f71e679456) Office 文件格式 24 | * [Office Protocols](https://docs.microsoft.com/en-us/openspecs/office_protocols/ms-offprotlp/5859f0f1-a929-475b-9b23-554994675456) Office 协议 25 | * [My Excel Pages -- David McRitchie](http://dmcritchie.mvps.org/excel/excel.htm) 26 | -------------------------------------------------------------------------------- /file-format/ms-oshared.md: -------------------------------------------------------------------------------- 1 | # MS-OSHARED 2 | 3 | 微软办公常用数据类型和对象结构 4 | 5 | ## Structures(数据结构) 6 | 7 | ### Data Types(数据类型) 8 | 9 | #### Common Data Types(通用数据类型) 10 | 11 | - 12 | 13 | ### Common Objects(通用对象) 14 | 15 | #### Toolbar Customization 16 | 17 | #### Hyperlinks 18 | 19 | ### Common Algorithms(通用算法) 20 | 21 | #### Unicode String to Unsigned Integer Hash 22 | 23 | #### Hyperlink Hash 24 | 25 | #### MsoCrc32Compute 26 | 27 | #### Date/Time Format from Format Index 28 | 29 | ## Reference 30 | 31 | - [[MS-OSHARED]: Office Common Data Types and Objects Structures](https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-oshared/d93502fa-5b8f-4f47-a3fe-5574046f4b8d) 32 | -------------------------------------------------------------------------------- /file-format/office-file-preview.md: -------------------------------------------------------------------------------- 1 | # Office 文件预览 2 | 3 | * [Hancom](https://office.hancom.com/) 4 | -------------------------------------------------------------------------------- /file-format/pdf.md: -------------------------------------------------------------------------------- 1 | # PDF 2 | 3 | * [PDF 协议](https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf) 4 | 5 | ## Java 库 6 | 7 | * [Apache FOP](https://xmlgraphics.apache.org/fop/) java 8 | * [PDFBox](https://pdfbox.apache.org/) java 9 | * [iText](https://itextpdf.com/) java 10 | 11 | 参考 [Compare these products for PDF generation with Java given requirements inside: iText, Apache PDFBox or FOP?](https://stackoverflow.com/questions/6625849/compare-these-products-for-pdf-generation-with-java-given-requirements-inside-i) 选择 `iText` 12 | 13 | ## JS 库 14 | 15 | * [jsPDF](https://github.com/MrRio/jsPDF) 16 | * [PDFKit](https://github.com/foliojs/pdfkit) 17 | 18 | ## Html to PDF 19 | 20 | * [wkhtmltopdf](https://github.com/wkhtmltopdf/wkhtmltopdf) 21 | 22 | ## 其它库 23 | 24 | * [PDF Code Library](http://www.pdf-technologies.com/pdf-code-library/) .net 收费 25 | -------------------------------------------------------------------------------- /file-format/poi.md: -------------------------------------------------------------------------------- 1 | # POI 2 | 3 | 解析 Office java 库 4 | 5 | - https://poi.apache.org/ 6 | 7 | ## 文件类型 8 | 9 | 参考 [Apache POI - Text Extraction](https://poi.apache.org/text-extraction.html) 10 | 11 | - HWPF: doc WordPress 12 | - doc: `Word 97 - Word 2003`: `org.apache.poi.hwpf.extractor.WordExtractor` 13 | - doc: `Word 6 and Word 95`: `org.apache.poi.hwpf.extractor.Word6Extractor` 14 | - XWPF: docx 15 | - docx: `org.apache.poi.xwpf.extractor.XPFFWordExtractor` 16 | - HSSF: xls `org.apache.poi.hssf.extractor.ExcelExtractor,` 17 | - XSSF: xlsx `org.apache.poi.xssf.extractor.XSSFExcelExtractor` 18 | - SXSSF: 大表格解决方案 19 | - SL: ppt `org.apache.poi.sl.extractor.SlideShowExtractor.SlideShowExtractor` 20 | - HPSF: pptx 21 | -------------------------------------------------------------------------------- /file-format/zlib.md: -------------------------------------------------------------------------------- 1 | # Zlib 2 | 3 | 是一种数据格式,用于存储压缩后的数据,采用压缩算法 Deflate 来压缩数据。Inflate 是与 Deflate 对应的解压缩算法。 4 | 5 | ## 结构 6 | 7 | | 名字 | 长度 | 说明 | 8 | | --------------- | -------- | ------------------------ | 9 | | CMF | 1 byte | | 10 | | FLG | 1 byte | | 11 | | DICTID | 4 byte | FLG.FDICT 为 1 时才有 | 12 | | compressed data | variable | Deflate 算法压缩后的数据 | 13 | | ADLER32 | 4 byte | Adler-32 checksum | 14 | 15 | ## References 16 | 17 | - [ZLIB Compressed Data Format Specification version 3.3](https://www.rfc-editor.org/rfc/rfc1950) 18 | - [ZLIB 压缩数据格式规范 v3.3](https://blog.csdn.net/ftswsfb/article/details/114594641) 19 | -------------------------------------------------------------------------------- /front-end/PostCSS.md: -------------------------------------------------------------------------------- 1 | # PostCSS 2 | 3 | css预编译器 4 | 5 | * [GitHub](https://github.com/postcss/postcss) 6 | * [gulp-postcss](https://github.com/postcss/gulp-postcss) 7 | 8 | ## 插件 9 | 10 | ### [Autoprefixer](https://github.com/postcss/autoprefixer) 11 | 12 | * [Autoprefixer](https://github.com/postcss/autoprefixer) 自动添加浏览器私有前缀,支持浏览器配置参考 [browserslist](https://github.com/ai/browserslist) 13 | 14 | ### [postcss-modules](https://github.com/css-modules/postcss-modules) 15 | 16 | 支持 css modules 17 | 18 | ## 使用 19 | 20 | css预编译器和PostCSS可以协同使用。有一个流行的用法就是Sass编译后再接PostCSS的Autoprefixer 21 | 22 | ## 参考 23 | 24 | * [在css预编译器之后,PostCSS](http://acgtofe.com/posts/2015/05/modular-transforming-with-postcss) 25 | -------------------------------------------------------------------------------- /front-end/angular.md: -------------------------------------------------------------------------------- 1 | # angular.js 2 | 3 | * [GitHub](https://github.com/angular/angular) 4 | -------------------------------------------------------------------------------- /front-end/bootstrap.md: -------------------------------------------------------------------------------- 1 | # Bootstrap 2 | 3 | 响应式布局 4 | 5 | * [GitHub](https://github.com/twbs/bootstrap) 6 | * [Bootstrap 官网](http://getbootstrap.com/) 7 | * [Bootstrap 中文网](http://www.bootcss.com/) 8 | * [Bootstrap 中文文档](http://v3.bootcss.com/) 9 | -------------------------------------------------------------------------------- /front-end/cache.md: -------------------------------------------------------------------------------- 1 | # Web缓存 2 | 3 | * [浅谈Web缓存](http://www.alloyteam.com/2016/03/discussion-on-web-caching/) 4 | * [HTTP 缓存](https://developers.google.cn/web/fundamentals/performance/optimizing-content-efficiency/http-caching?hl=zh-cn) 5 | * [浏览器缓存知识小结及应用](https://www.cnblogs.com/lyzg/p/5125934.html) 6 | 7 | ## header 8 | 9 | 页面的缓存状态是由header决定的,header的参数有四种: 10 | 11 | ### Cache-Control 12 | 13 | * max-age 14 | 15 | ### Expires 16 | 17 | ### Last-modified 18 | 19 | ### ETag 20 | 21 | ## 强缓存和协商缓存 22 | 23 | * 当浏览器对某个资源的请求命中了强缓存时,返回的http状态为200,在chrome的开发者工具的network里面size会显示为from cache 24 | * 当浏览器对某个资源的请求没有命中强缓存,就会发一个请求到服务器,验证协商缓存是否命中,如果协商缓存命中,请求响应返回的http状态为304并且会显示一个Not Modified的字符串 25 | 26 | ## chrome 27 | 28 | * chrome 开发工具 > Network > Disable cache 开启关闭缓存 29 | * 查看 chrome 缓存: 30 | * [Chrome cache View](https://my.oschina.net/xiaojichao/blog/137538) 查看二进制 chrome 缓存文件 31 | 32 | ## 用户操作行为与缓存 33 | 34 | ## References 35 | 36 | * [js清除浏览器缓存的几种方法](http://www.haorooms.com/post/js_llq_hc) 37 | -------------------------------------------------------------------------------- /front-end/chrome-apps.md: -------------------------------------------------------------------------------- 1 | # Chrome Apps 2 | 3 | * [官网](https://developer.chrome.com/apps) 4 | * [GitHub](https://github.com/MobileChromeApps/mobile-chrome-apps) 5 | -------------------------------------------------------------------------------- /front-end/chrome.md: -------------------------------------------------------------------------------- 1 | # chrome 调试 2 | 3 | ## 导出文件 4 | 5 | chrome 调试的时候可以改 html,css 等,改好后可以从 Sources 里选择指定文件,右击 save as 保存到本地。 6 | -------------------------------------------------------------------------------- /front-end/commonJS.md: -------------------------------------------------------------------------------- 1 | # CommonJS 2 | 3 | * [官网](http://www.commonjs.org/) 4 | 5 | JavaScript 是一种模板规范,NodeJS是这种规范的实现 6 | 7 | 1. 所有要输出的对象统统挂载在 module.exports 上,然后暴露给外界 8 | 2. 通过 require 加载别的模块,require 的返回值就是模块暴露的对象 9 | 3. CommonJS 是一个单对象输出,单对象加载的模型 10 | -------------------------------------------------------------------------------- /front-end/css-modules.md: -------------------------------------------------------------------------------- 1 | # CSS Modules 2 | 3 | CSS 模块化 4 | 5 | * [GitHub](https://github.com/css-modules/css-modules) 6 | * [react-css-modules](https://github.com/gajus/react-css-modules) 通过高阶函数的形式来避免重复输入 styles.** 7 | 8 | ## 安装 9 | 10 | ```sh 11 | npm install webpack -g 12 | npm install webpack --save-dev 13 | ``` 14 | 15 | ## 使用 16 | 17 | 监控模式 18 | 19 | ```sh 20 | webpack --progress --colors --watch 21 | ``` 22 | 23 | ## References 24 | 25 | * [webpack with CSS Modules](https://github.com/webpack/css-loader/#css-modules) webpack 使用 css modules 26 | * [CSS Modules Webpack Demo](https://github.com/css-modules/webpack-demo) 27 | 28 | * [CSS Modules入门Ⅰ:它是什么?为什么要使用它?](https://zhuanlan.zhihu.com/p/23571898) 29 | * [CSS Modules入门Ⅱ:快速上手](https://zhuanlan.zhihu.com/p/23602046) 30 | * [CSS Modules入门Ⅲ:与React协同](https://zhuanlan.zhihu.com/p/23618974) 31 | 32 | * [CSS Modules 用法教程](http://www.ruanyifeng.com/blog/2016/06/css_modules.html) 33 | * [CSS Modules 详解及 React 中实践](https://github.com/camsong/blog/issues/5) 34 | -------------------------------------------------------------------------------- /front-end/css-usage.md: -------------------------------------------------------------------------------- 1 | # css 使用 2 | 3 | text-align:center 只是将元素下面的内联元素居中显示 4 | -------------------------------------------------------------------------------- /front-end/editorConfig.md: -------------------------------------------------------------------------------- 1 | # EditorConfig 2 | 3 | EditorConfig 是一套用于统一代码格式的解决方案 4 | 5 | * [官网](http://editorconfig.org) 6 | * [EditorConfig介绍翻译](http://www.alloyteam.com/2014/12/editor-config/) 7 | * [EditorConfig 介绍](http://www.jianshu.com/p/712cea0ef70e) 8 | 9 | ## 解释 10 | 11 | * indent_style:tab为hard-tabs,space为soft-tabs。 12 | * indent_size:设置整数表示规定每级缩进的列数和soft-tabs的宽度(译注:空格数)。如果设定为tab,则会使用tab_width的值(如果已指定)。 13 | * tab_width:设置整数用于指定替代tab的列数。默认值就是indent_size的值,一般无需指定。 14 | * end_of_line:定义换行符,支持lf、cr和crlf。 15 | * charset:编码格式,支持latin1、utf-8、utf-8-bom、utf-16be和utf-16le,不建议使用uft-8-bom。 16 | * trim_trailing_whitespace:设为true表示会除去换行行首的任意空白字符,false反之。 17 | * insert_final_newline:设为true表明使文件以一个空白行结尾,false反之。 18 | * root:表明是最顶层的配置文件,发现设为true时,才会停止查找.editorconfig文件。 19 | 20 | ## Example 21 | 22 | ``` 23 | root = true 24 | 25 | [*] 26 | end_of_line = lf 27 | charset = utf-8 28 | trim_trailing_whitespace = true 29 | insert_final_newline = true 30 | indent_style = space 31 | indent_size = 2 32 | ``` 33 | -------------------------------------------------------------------------------- /front-end/error-catch.md: -------------------------------------------------------------------------------- 1 | # 错误捕获 2 | 3 | * [前端代码异常日志收集与监控](http://www.cnblogs.com/hustskyking/p/fe-monitor.html) 4 | * [JSTracker:前端异常数据采集 ](http://taobaofed.org/blog/2015/10/28/jstracker-how-to-collect-data/) 5 | 6 | ## 第三方工具 7 | 8 | * [betterJS](https://github.com/BetterJS/doc) 腾讯的 9 | * [sentry](https://sentry.io/welcome/) 10 | * [google Analytics](https://www.google.com/analytics/) 11 | -------------------------------------------------------------------------------- /front-end/favicon.ico.md: -------------------------------------------------------------------------------- 1 | # favicon.ico 2 | 3 | 缩略的网站标志 4 | 5 | ## 制作 6 | 7 | * [favicon.ico 在线制作](http://www.favicon-icon-generator.com/) 8 | 16×16像素 加 32×32像素 9 | -------------------------------------------------------------------------------- /front-end/fis.md: -------------------------------------------------------------------------------- 1 | # fis 2 | 3 | ## sourcemap 4 | 5 | * 6 | -------------------------------------------------------------------------------- /front-end/gulp-webpack.md: -------------------------------------------------------------------------------- 1 | # gulp 结合 webpack 2 | 3 | * [gulp + webpack 构建多页面前端项目](https://github.com/fwon/blog/issues/17) 4 | * [gulp & webpack整合,鱼与熊掌我都要!](http://www.jianshu.com/p/9724c47b406c) 5 | -------------------------------------------------------------------------------- /front-end/html.md: -------------------------------------------------------------------------------- 1 | # html 2 | 3 | * [MDN-HTML](https://developer.mozilla.org/zh-CN/docs/Web/HTML) 4 | 5 | ## 显示空格换行 6 | 7 | 用 `pre` 8 | -------------------------------------------------------------------------------- /front-end/jQuery.md: -------------------------------------------------------------------------------- 1 | # jQuery 2 | 3 | * [官网](http://jquery.com/) 4 | * [官方文档](http://api.jquery.com/) 5 | * [中文文档](http://jquery.cuishifeng.cn/) 6 | -------------------------------------------------------------------------------- /front-end/other.md: -------------------------------------------------------------------------------- 1 | # other 2 | 3 | ## react 不后台做后台 4 | 5 | react做后台不合适,比较麻烦,用其他双向绑定的框架要简单很多,angular和vue都比react合适,之前我也尝试过用react开发后台,但是发现开发成本和维护成本要比其他双向绑定的高很多 6 | 7 | 大型的单页应用还是react靠谱一些 8 | -------------------------------------------------------------------------------- /front-end/phonegap.md: -------------------------------------------------------------------------------- 1 | # PhoneGap 2 | 3 | * [官网](http://phonegap.com/) 4 | 5 | ## PhoneGap VS Cordova 6 | 7 | * [PhoneGap, Cordova, and what’s in a name?](http://phonegap.com/blog/2012/03/19/phonegap-cordova-and-whate28099s-in-a-name/) 8 | 9 | 基于 Apache Cordova,多了 `remote build` 等功能: 10 | 11 | ``` 12 | remote build 13 | remote install 14 | remote login,logout 15 | remote run 16 | serve 17 | ``` 18 | 19 | 20 | ## 开发方法 21 | 22 | ### App 嵌 PhoneGap 23 | 24 | #### iOS 25 | 26 | * [Embedding the Webview - iOS](http://docs.phonegap.com/tutorials/develop/1-embed-webview/ios/) 27 | 28 | #### Android 29 | 30 | * [Embedding the Webview - Android](http://docs.phonegap.com/tutorials/develop/1-embed-webview/android/) 31 | -------------------------------------------------------------------------------- /front-end/scss.md: -------------------------------------------------------------------------------- 1 | # scss 2 | 3 | * [官网](http://sass-lang.com/) 4 | * [教程](http://www.ruanyifeng.com/blog/2012/06/sass.html) 5 | 6 | .sass和.scss。这两种的区别在于.sass文件对代码的排版有着非常严格的要求,而且没有大括号,没有分号,以缩进方式显示。推荐用 scss 7 | 8 | ## 变量 9 | 10 | 所有变量以$开头 11 | 12 | ## 计算功能 13 | 14 | ## 嵌套 15 | 16 | 17 | ## 继承 18 | 19 | @extend 20 | 21 | ## Mixin 22 | 23 | 代码块 24 | 25 | 使用@include命令,调用这个mixin。 26 | 27 | ## 颜色函数 28 | 29 | ``` 30 | lighten(#cc3, 10%) // #d6d65c 31 | darken(#cc3, 10%) // #a3a329 32 | grayscale(#cc3) // #808080 33 | complement(#cc3) // #33c 34 | ``` 35 | 36 | ## 插入文件 37 | 38 | @import 39 | 40 | ## 高级用法 41 | 42 | @if @else @for @while @each 43 | 44 | ## 自定义函数 45 | 46 | @function @return 47 | -------------------------------------------------------------------------------- /front-end/web-game.md: -------------------------------------------------------------------------------- 1 | # 网页游戏 2 | 3 | ## 引擎 4 | 5 | 第一、性能,webGL模式远超Canvas数倍。DOM模式就不适合用于真正的游戏开发,更不用提。 6 | 第二、3D方向,webGL模式理论上可以制作2D和3D游戏,Canvas和DOM模式下只能制作2D游戏。 7 | 第三、普及率,webGL的普及率已经非常高了,尤其是支持webGL的腾讯TBS-Blink内核已在4月19日发布,并逐步在微信、QQ空间、QQ浏览器、手机QQ等APP中采用静默安装方式全面升级。这个普及率在国内带来的影响,;你懂的…… 8 | 9 | 在webGL的2D渲染性能方面,pixi.js的性能处于当前的顶级。在webGL的3D渲染性能方面,Three.js非常优秀。在runtime方面Cocos2d-js也有着原生级的表现, 10 | 11 | Phaser.js 用到了 pixi.js 12 | 13 | ### References 14 | 15 | * [phaser](https://github.com/photonstorm/phaser) 16 | * [pixi.js](https://github.com/pixijs/pixi.js) 17 | * [Which HTML5 Game Engine is right for you?](https://html5gameengine.com/) 18 | * [目前有哪些比较成熟的 HTML5 游戏引擎?](https://www.zhihu.com/question/20079322) 19 | * [HTML5游戏引擎深度测评](http://www.jianshu.com/p/0469cd7b1711) 20 | -------------------------------------------------------------------------------- /front-end/web-to-app.md: -------------------------------------------------------------------------------- 1 | # Web 调起 App 2 | 3 | ## Android 4 | 5 | ### 微信通过应用宝调起 6 | 7 | 参考 8 | 9 | * 要想通过应用宝跳转,应用必须在应用宝市场上线并开通了“微下载”功能,同时移动端必须安装了应用宝并安装了最新的App,才可实现流畅跳转。 10 | 11 | 参考 [3.3 Applink能力](http://wiki.open.qq.com/index.php?title=mobile/%E5%BA%94%E7%94%A8%E5%AE%9D%E5%BE%AE%E4%B8%8B%E8%BD%BD#3.3_Applink.E8.83.BD.E5.8A.9B) 12 | 13 | 微下载能力不仅能够帮助开发者在微信等场景进行一键下载安装,目前已支持直接拉起应用的指定内容页,帮助开发者缩短内容触达路径,提升产品活跃和用户体验;(需要额外申请,根据应用资质进行审批,申请请联系工作人员QQ群1:670572083 QQ群2:166230738) 14 | 15 | 16 | 以下四点任意满足一点即可。 17 | —— 应用评级达到B级; 18 | —— 应用微下载日访问量达到10W/天; 19 | —— 项目/应用参加腾讯“双百”扶持计划; 20 | —— 应用由腾讯投资占股。 21 | 22 | ## References 23 | 24 | * [AppLink接入](http://wiki.open.qq.com/index.php?title=AppLink%E6%8E%A5%E5%85%A5) 25 | * 26 | * 27 | -------------------------------------------------------------------------------- /gateway/CentOS-denote.md: -------------------------------------------------------------------------------- 1 | # CentOS 下安装 denote 2 | 3 | ## 下载 4 | 5 | 6 | 7 | ## 配置 8 | 9 | 10 | 11 | ## 安装 12 | 13 | ```shell 14 | wget https://www.inet.no/dante/files/dante-1.4.1.tar.gz 15 | tar zxvf dante-1.4.1.tar.gz 16 | cd dante-1.4.1 17 | ./configure 18 | make 19 | make install 20 | ``` 21 | 22 | ``` 23 | /etc/sockd.conf 24 | ``` 25 | 26 | ## 查看端口占用情况 27 | 28 | ``` 29 | netstat -lp 30 | kill -0 [pid] 31 | ``` 32 | ## 关闭进程 33 | 34 | ``` 35 | killall sockd 36 | ``` 37 | # 连不上啊 38 | -------------------------------------------------------------------------------- /gateway/CentOS-ss5.md: -------------------------------------------------------------------------------- 1 | # CentOS 下安装 ss5 2 | 3 | ## 下载 4 | 5 | 6 | 7 | ## 配置 8 | 9 | 10 | 11 | ## 安装 12 | 13 | ```shell 14 | wget https://www.inet.no/dante/files/dante-1.4.1.tar.gz 15 | tar zxvf dante-1.4.1.tar.gz 16 | cd dante-1.4.1 17 | ./configure 18 | make 19 | make install 20 | ``` 21 | 22 | ``` 23 | /etc/sockd.conf 24 | ``` 25 | 26 | ## 查看端口占用情况 27 | 28 | ``` 29 | netstat -lp 30 | kill -0 [pid] 31 | ``` 32 | ## 关闭进程 33 | 34 | ``` 35 | killall sockd 36 | ``` 37 | # 连不上啊 38 | -------------------------------------------------------------------------------- /gateway/README.md: -------------------------------------------------------------------------------- 1 | # 翻墙 2 | 3 | ## VPS 4 | 5 | ### buyVM 6 | 7 | * https://buyvm.net/ 8 | * 第一天连接很快,第二电信的网可以连,移动网几乎连不上。 9 | 10 | #### 价格 11 | $2/月 12 | 13 | ### SugarHosts 14 | 15 | * https://www.sugarhosts.com/ 16 | 17 | #### 价格 18 | ¥24.5/月 19 | 20 | ### hostinger 21 | 22 | * https://www.hostinger.com.hk/ 23 | 24 | #### 价格 25 | ¥27.39/月 26 | 27 | ### BandwagonHost 28 | 29 | * https://bwh81.net/ 30 | 31 | #### 价格 32 | 33 | $49.99/年 34 | -------------------------------------------------------------------------------- /gateway/Resource/autossh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Auth:bell@greedlab.com 3 | 4 | PATH=$PATH:$HOME/bin 5 | PATH=$PATH:/usr/sbin 6 | echo $PATH 7 | 8 | # 远程服务器的地址 9 | AUTO_SSH_ADDRESS="" 10 | # 登录远程服务器的用户名 11 | AUTO_SSH_USER="" 12 | # 本地端口 13 | AUTO_SSH_PORT=7070 14 | # 日志路径 15 | AUTO_SSH_LOG_FILE=~/log/ss5.log 16 | 17 | function startssh() 18 | { 19 | echo $(date): ssh to $AUTO_SSH_USER@$AUTO_SSH_ADDRESS 20 | AUTO_SSH_SCRIPT="ssh -D 0.0.0.0:$AUTO_SSH_PORT -p22 -N $AUTO_SSH_USER@$AUTO_SSH_ADDRESS" 21 | echo $(date): $AUTO_SSH_SCRIPT 22 | nohup ${AUTO_SSH_SCRIPT} >> $AUTO_SSH_LOG_FILE 2>&1 & 23 | echo $(date): connected 24 | } 25 | 26 | AUTO_SSH_RESULT=$(netstat -AaLlnW | grep $AUTO_SSH_PORT |wc -l) 27 | if [[ $AUTO_SSH_RESULT -eq 0 ]]; then 28 | echo $(date): ssh is stoped 29 | startssh 30 | else 31 | echo $(date): ssh is running 32 | fi 33 | -------------------------------------------------------------------------------- /gateway/centos-srelay.md: -------------------------------------------------------------------------------- 1 | # Centos 安装 srelay 2 | 3 | 4 | 5 | # 安装 6 | 7 | 拷贝文件 8 | 9 | `` 10 | /usr/local/sbin/srelay 11 | /usr/local/etc/srelay.conf 12 | /usr/local/etc/srelay.passwd 13 | /var/lock/subsys/srelay 14 | ``` 15 | 16 | 查看日志 17 | 18 | ``` 19 | tail -f /var/log/messages 20 | ``` 21 | -------------------------------------------------------------------------------- /gateway/public-to-internal.md: -------------------------------------------------------------------------------- 1 | # 外网访问内网 2 | 3 | 4 | 5 | 6 | * [外网访问内网](#外网访问内网) 7 | * [DDNS](#ddns) 8 | * [localtunnel](#localtunnel) 9 | * [安装](#安装) 10 | * [使用](#使用) 11 | * [后台使用](#后台使用) 12 | * [ngrok](#ngrok) 13 | * [autossh + Nginx](#autossh-nginx) 14 | 15 | 16 | 17 | ## DDNS 18 | 19 | 路由器动态上传 IP 到服务器,域名指向该 IP 20 | 21 | 电信禁止外网访问动态 IP,所以该方法无法实现 22 | 23 | ## localtunnel 24 | 25 | * [GitHub](https://github.com/localtunnel/localtunnel) 26 | 27 | 可行,访问比较慢 28 | 29 | ### 安装 30 | 31 | ```sh 32 | npm install -g localtunnel 33 | ``` 34 | 35 | ### 使用 36 | 37 | ```sh 38 | lt --port 8080 39 | ``` 40 | 41 | ### 后台使用 42 | 43 | ```sh 44 | nohup lt -p 8080 >> ${HOME}/.lt.log g 2>&1 & 45 | ``` 46 | 47 | ## ngrok 48 | 49 | * 50 | 51 | ## autossh + Nginx 52 | -------------------------------------------------------------------------------- /git/branch.md: -------------------------------------------------------------------------------- 1 | # git branch 2 | 3 | * `git branch` 列出本地已经存在的分支 4 | * `git branch -r` 列出远程分支 5 | * `git branch -a` 列出本地分支和远程分支 6 | * `git branch -a` 列出本地分支和远程分支 7 | * `git branch -d ` 删除分支 8 | * `git branch -D ` 强制删除分支 9 | 10 | ## 创建分支 11 | 12 | ``` 13 | git branch / 基于当前HEAD创建分支 14 | git checkout 15 | git push origin 16 | ``` 17 | 18 | ## 本地分支与远程分支对应 19 | 20 | ### git branch 21 | 22 | ```shell 23 | git branch (--set-upstream-to= | -u ) [] 24 | ``` 25 | 26 | ### git push 27 | 28 | `-u` == `--set-upstream` 29 | 30 | ```shell 31 | git push -u 32 | ``` 33 | 34 | ### 查看 35 | 36 | ```shell 37 | git branch -vv 38 | ``` 39 | 40 | ## 查看分支是否 41 | 42 | ```shell 43 | # 查看未合并分支 44 | git branch --no-merged 45 | # 查看已合并分支 46 | git branch --merged 47 | ``` 48 | -------------------------------------------------------------------------------- /git/checkout.md: -------------------------------------------------------------------------------- 1 | # git checkout 2 | 3 | ## 创建新分支 4 | 5 | * `git checkout -b ` 6 | * `git checkout -B ` = `git checkout -b -f ` 7 | -------------------------------------------------------------------------------- /git/clean.md: -------------------------------------------------------------------------------- 1 | # git clean 2 | 3 | ```sh 4 | $ git clean -h 5 | usage: git clean [-d] [-f] [-i] [-n] [-q] [-e ] [-x | -X] [--] ... 6 | 7 | -q, --quiet do not print names of files removed 8 | -n, --dry-run dry run 9 | -f, --force force 10 | -i, --interactive interactive cleaning 11 | -d remove whole directories 12 | -e, --exclude 13 | add to ignore rules 14 | -x remove ignored files, too 15 | -X remove only ignored files 16 | ``` 17 | 18 | ## 只删除 git 仓库里修改的内容 19 | 20 | ``` 21 | git clean -fd 22 | ``` 23 | 24 | ## 删除 git 仓库里修改的内容和所有 gitignore 的内容 25 | 26 | ``` 27 | git clean -xfd 28 | ``` 29 | -------------------------------------------------------------------------------- /git/clone-local.md: -------------------------------------------------------------------------------- 1 | # clone 本地代码 2 | 3 | 有两种方式实现 clone 本地代码 4 | 5 | ## -l 参数 6 | 7 | ```shell 8 | $ git clone -l ~/Documents/Gitlab/pod-template/ WFT-social 9 | ``` 10 | 11 | ## .git 12 | 13 | ```shell 14 | $ git clone ~/Documents/Gitlab/pod-template/.git WFT-social 15 | ``` 16 | -------------------------------------------------------------------------------- /git/commit.md: -------------------------------------------------------------------------------- 1 | # git-commit 2 | 3 | `git commit` 不加 `-m` 会弹出输入提交信息的界面。第一行标题,空行,再输入正文。每个 `commit` 尽可能少些功能。 4 | 5 | 1. 用一个空行隔开标题和正文 6 | 2. 限制标题字数在 50 个字符内 7 | 3. 用大写字母写标题行 8 | 4. 不要用句号结束标题行 9 | 5. 在标题行使用祈使语气 10 | 6. 正文在 72 个字符处换行 11 | 7. 使用正文解释是什么和为什么,而不是如何做 12 | 13 | ## Reference 14 | 15 | * [Commit message 和 Change log 编写指南](http://www.ruanyifeng.com/blog/2016/01/commit_message_change_log.html) 16 | * [写好Git Commit信息的7个建议](http://h2ex.com/175) 17 | * [AngularJS Git Commit Message Conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit) 18 | * [Git Commit Msg](http://karma-runner.github.io/0.12/dev/git-commit-msg.html) 19 | -------------------------------------------------------------------------------- /git/diff.md: -------------------------------------------------------------------------------- 1 | # git diff 的使用 2 | 3 | `git diff`后者对前者的修改 4 | 5 | ## 比较两个分支 6 | 7 | bell分支相对master分支的修改 8 | 9 | ``` 10 | $ git diff origin/master origin/bell 11 | ``` 12 | 13 | ## 比较两个tag 14 | 15 | ``` 16 | $ git diff 0.0.1 0.0.2 17 | ``` 18 | 19 | 0.0.1,0.0.2为tag 20 | 21 | ## 工作目录与上次提交时之间的差别 22 | 23 | ```shell 24 | $ git diff HEAD 25 | ``` 26 | 27 | ## 用其它工具查看 diff 28 | 29 | ```sh 30 | git difftool 31 | ``` 32 | 33 | ## Reference 34 | 35 | * 36 | -------------------------------------------------------------------------------- /git/flow.md: -------------------------------------------------------------------------------- 1 | # git flow 2 | 3 | * [GitHub](https://github.com/nvie/gitflow) 4 | * [基于git的源代码管理模型——git flow](http://www.ituring.com.cn/article/56870) 5 | -------------------------------------------------------------------------------- /git/git-log.md: -------------------------------------------------------------------------------- 1 | # 提交记录 2 | 3 | ## 查看提交记录 4 | 5 | ```shell 6 | $ git log 7 | ``` 8 | 9 | ### graph 10 | 11 | ```shell 12 | $ git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative 13 | ``` 14 | 15 | ## 查看记录详情 16 | 17 | ```shell 18 | $ git show 19 | ``` 20 | 21 | ## 切换到指定版本 22 | 23 | ```shell 24 | $ git checkout 25 | ``` 26 | 27 | `` 为`git log`对应的`commit` 28 | -------------------------------------------------------------------------------- /git/git-merge-remote.md: -------------------------------------------------------------------------------- 1 | # Git合并其它仓库的代码 2 | 3 | ## 增加新仓库 4 | 5 | ```shell 6 | $ git remote add pod-template git@github.com:CocoaPods/pod-template.git 7 | ``` 8 | 9 | `pod-template`为本地新增加的仓库 10 | 11 | ## 查看新仓库 12 | 13 | ``` 14 | $ git remote -v 15 | origin git@github.com:GreedBell/pod-template.git (fetch) 16 | origin git@github.com:GreedBell/pod-template.git (push) 17 | pod-template git@github.com:CocoaPods/pod-template.git (fetch) 18 | pod-template git@github.com:CocoaPods/pod-template.git (push) 19 | ``` 20 | 21 | 多了`pod-template` 22 | 23 | ## fetch 新仓库 24 | 25 | ``` 26 | $ git fetch pod-template 27 | ``` 28 | 29 | ## 合并新仓库 30 | 31 | ``` 32 | $ git merge pod-template/master 33 | ``` 34 | 35 | ## 提交 36 | 37 | ### 提交到自己仓库 38 | 39 | ``` 40 | $ git push origin master 41 | ``` 42 | 43 | ### 提交到新仓库 44 | 45 | 如果有权限的话 46 | 47 | ``` 48 | $ git push pod-template master 49 | ``` 50 | 51 | ## 相关资料 52 | 53 | * 54 | -------------------------------------------------------------------------------- /git/git-server.md: -------------------------------------------------------------------------------- 1 | # ssh 方式架设 git 服务 2 | 3 | ## 服务器 4 | 5 | ### 创建 git 用户 6 | 7 | 8 | ### 初始化 /git 目录 9 | 10 | ```shell 11 | $ sudo mkdir /git 12 | $ sudo chown -R git:staff /git/ 13 | ``` 14 | 15 | ### 初始化仓库 16 | 17 | ```shell 18 | $ su - git 19 | $ git init --bare --shared=group /git/test.git 20 | ``` 21 | 22 | ## 客户端 23 | 24 | 这里都以服务器在本地为例,所以在使用的时候记得把 localhost 换成对应服务器地址。 25 | 26 | ### 建立 ssh 互信 27 | 28 | 拷贝本地公钥到服务器的`/home/git/.ssh/authorized_keys` 29 | 30 | ```shell 31 | $ ssh git@localhost "mkdir ~/.ssh" 32 | $ scp ~/.ssh/id_rsa.pub git@localhost:~/.ssh/id_rsa.pub.back 33 | $ ssh git@localhost "cat ~/.ssh/id_rsa.pub.back >> ~/.ssh/authorized_keys" 34 | ``` 35 | 36 | ### 如果是重新创建新仓库,直接 clone 37 | 38 | ```shell 39 | $ git clone ssh://git@localhost/git/test.git 40 | ``` 41 | 42 | ### 如果要在原有仓库基础上转移到新的仓库 43 | 44 | 添加 remote 45 | 46 | ```shell 47 | $ git remote add ssh ssh://git@localhost/git/test.git 48 | ``` 49 | 50 | push 到新的仓库 51 | 52 | ```shell 53 | $ git push ssh master 54 | ``` 55 | -------------------------------------------------------------------------------- /git/git-stash.md: -------------------------------------------------------------------------------- 1 | # git stash 2 | 3 | - [6.3 Git 工具 - 储藏(Stashing)](https://git-scm.com/book/zh/v1/Git-%E5%B7%A5%E5%85%B7-%E5%82%A8%E8%97%8F%EF%BC%88Stashing%EF%BC%89) 4 | 5 | 经常有这样的事情发生,当你正在进行项目中某一部分的工作,里面的东西处于一个比较杂乱的状态,而你想转到其他分支上进行一些工作。问题是,你不想提交进行了一半的工作,否则以后你无法回到这个工作点。解决这个问题的办法就是 `git stash` 命令。 6 | 7 | ## 使用 8 | 9 | 存储所有修改 10 | 11 | ```sh 12 | git stash 13 | ``` 14 | 15 | 存储指定文件 16 | 17 | ```sh 18 | git stash -m "stash-message" -- filename1.txt filename2.txt… 19 | ``` 20 | 21 | 查看存储列表 22 | 23 | ```sh 24 | git stash list 25 | ``` 26 | 27 | 查看某个存储的具体修改 28 | 29 | ```sh 30 | git stash show 0 31 | ``` 32 | 33 | 取出存储 34 | 35 | ```sh 36 | git stash pop 37 | ``` 38 | -------------------------------------------------------------------------------- /git/merge.md: -------------------------------------------------------------------------------- 1 | # git merge 2 | 3 | * --no-ff:不使用fast-forward方式合并,保留分支的commit历史 4 | * --squash:使用squash方式合并,把多次分支commit历史压缩为一次 5 | 6 | ## Reference 7 | 8 | * 9 | -------------------------------------------------------------------------------- /git/patch.md: -------------------------------------------------------------------------------- 1 | # patch 2 | 3 | git 补丁 4 | 5 | ## 生成补丁 6 | 7 | ```bash 8 | git diff > example.patch 9 | ``` 10 | 11 | ## 打补丁 12 | 13 | 参数 14 | * -p NUM 忽略几层文件夹 15 | * -E 选项说明如果发现了空文件,那么就删除它 16 | * -R 取消打过的补丁 17 | 18 | 举例 19 | 20 | ```bash 21 | # 取消补丁 22 | patch -RE -p0 < example.patch 23 | ``` 24 | 25 | 26 | ```bash 27 | patch -d ./ < example.patch 28 | ``` 29 | 30 | 补丁失败的文件会以.rej结尾 31 | 32 | ## References 33 | 34 | * [补丁(patch)的制作与应用](http://linux-wiki.cn/wiki/zh-hans/%E8%A1%A5%E4%B8%81(patch)%E7%9A%84%E5%88%B6%E4%BD%9C%E4%B8%8E%E5%BA%94%E7%94%A8) 35 | -------------------------------------------------------------------------------- /git/questions.md: -------------------------------------------------------------------------------- 1 | # Questions 2 | 3 | ## git clone error: RPC failed; result=56, HTTP code = 200 4 | 5 | > * git config --global http.postBuffer 524288000(尽量大) 6 | > * 关闭代理 7 | 8 | ### Reference 9 | * https://confluence.atlassian.com/stashkb/git-clone-fails-error-rpc-failed-result-56-http-code-200-693897332.html 10 | -------------------------------------------------------------------------------- /git/readme.md: -------------------------------------------------------------------------------- 1 | # Git 2 | 3 | * [官方中文文档](https://git-scm.com/book/zh/v2) 4 | * [PDF 版](resource/progit-zh.936.pdf) 5 | * [gitflow](https://github.com/nvie/gitflow) 6 | 7 | ## 命令 8 | 9 | ### cherry-pick 10 | 11 | 合并指定 commit 12 | 13 | Example: 14 | 15 | ```sh 16 | git cherry-pick 17 | ``` 18 | 19 | ## 代理 20 | 21 | * [git 设置和取消代理](https://gist.github.com/laispace/666dd7b27e9116faece6) 22 | 23 | ```sh 24 | git config --global http.proxy http://127.0.0.1:1080 25 | git config --global https.proxy https://127.0.0.1:1080 26 | 27 | git config --global --unset http.proxy 28 | 29 | git config --global --unset https.proxy 30 | 31 | 32 | npm config delete proxy 33 | ``` 34 | -------------------------------------------------------------------------------- /git/rebase.md: -------------------------------------------------------------------------------- 1 | # rebase 2 | 3 | 变基. 4 | 5 | rebase 命令将提交到某一分支上的所有修改都移至另一分支上,变基使得提交历史更加整洁,提交历史是一条直线没有分叉。一般我们这样做的目的是为了确保在向远程分支推送时能保持提交历史的整洁 6 | 7 | ## Reference 8 | 9 | * [3.6 Git 分支 - 变基](https://git-scm.com/book/zh/v2/Git-%E5%88%86%E6%94%AF-%E5%8F%98%E5%9F%BA) 10 | * [3.6 Git Branching - Rebasing](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) 11 | * [Git Community Book 中文版](http://gitbook.liuhui998.com/4_2.html) 12 | -------------------------------------------------------------------------------- /git/resource/progit-zh.936.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greedbell/blog/20e19572eaece27174f718ef4bdf62b48050bd26/git/resource/progit-zh.936.pdf -------------------------------------------------------------------------------- /git/rollback.md: -------------------------------------------------------------------------------- 1 | # 代码回滚 2 | 3 | ## `git revert` 4 | 5 | 是生成一个新的提交来撤销某次提交,此次提交之前、之后的commit都会被保留 6 | 7 | * 添加新的提交记录,可以提交到远程仓库 8 | * `git revert ` 后的冲突通过 `git mergetool` 解决 9 | 10 | ## `git reset` 11 | 12 | 是回到某次提交,提交及之前的commit都会被保留,但是此次之后的修改都会被退回到暂存区 13 | 14 | * 用于查看历史记录,切换到历史记录后不能提交到远程仓库 15 | 16 | ### `git reset --hard` 17 | 18 | 撤销这次修改,之前本地的,没有提交的修改,都撤销 19 | 20 | 21 | ## Reference 22 | 23 | * 24 | -------------------------------------------------------------------------------- /git/tag.md: -------------------------------------------------------------------------------- 1 | # git tag 管理 2 | 3 | ## 创建新的 tag 4 | 5 | ```shell 6 | $ git tag -a 0.0.1 -m "new tag" 7 | ``` 8 | 9 | ## push 到远程服务器 10 | 11 | ```shell 12 | $ git push origin 0.0.1 13 | ``` 14 | 15 | ## 查看 tag 信息 16 | 17 | ```shell 18 | $ git show 0.0.1 19 | ``` 20 | 21 | ## 切换到指定 tag 22 | 23 | ```shell 24 | $ git checkout 0.0.1 25 | ``` 26 | -------------------------------------------------------------------------------- /git/update-gitignore.md: -------------------------------------------------------------------------------- 1 | # 更新 .gitignore 2 | 3 | ```shell 4 | git rm -r --cached . 5 | git add . --all 6 | git commit -m 'chore: update .gitignore' 7 | git push origin master 8 | ``` 9 | -------------------------------------------------------------------------------- /git/worktree.md: -------------------------------------------------------------------------------- 1 | # worktree 2 | 3 | https://einverne.github.io/post/2019/03/git-worktree.html 4 | -------------------------------------------------------------------------------- /go/README.md: -------------------------------------------------------------------------------- 1 | # Go 2 | 3 | * [官网](https://golang.org/) 4 | -------------------------------------------------------------------------------- /host-server/README.md: -------------------------------------------------------------------------------- 1 | # 云主机与云存储 2 | 3 | ## [又拍云](https://www.upyun.com/zh/index.html) 4 | 5 | 静态资源 6 | 7 | ## [Amazon EC2 – 虚拟服务器托管](http://aws.amazon.com/cn/ec2/) 8 | 9 | 服务 10 | 11 | ## [Amazon S3 - 云存储](http://aws.amazon.com/cn/s3/) 12 | 13 | 存储静态资源 14 | 15 | ## [Amazon RDS - 关系数据库](http://aws.amazon.com/cn/rds/) 16 | 17 | 18 | ## Other 19 | 20 | * 21 | -------------------------------------------------------------------------------- /host-server/bandwagonhost.md: -------------------------------------------------------------------------------- 1 | # 搬瓦工 2 | 3 | * [官网](https://bandwagonhost.com/) 4 | -------------------------------------------------------------------------------- /host-server/host-node.js.md: -------------------------------------------------------------------------------- 1 | # node.js 虚拟主机 2 | 3 | * 4 | * 5 | * 6 | * 7 | -------------------------------------------------------------------------------- /host-server/hosthatch.md: -------------------------------------------------------------------------------- 1 | # hosthatch 2 | 3 | 4 | 5 | 价格: $8 / quarter 6 | 7 | 测试: 8 | http://www.zrblog.net/14431.html 9 | -------------------------------------------------------------------------------- /host-server/hostus.md: -------------------------------------------------------------------------------- 1 | # hostus 2 | 3 | 4 | 5 | 购买地址: 6 | 7 | 香港,$2.95USD/MON 8 | -------------------------------------------------------------------------------- /ios/js-bridge.md: -------------------------------------------------------------------------------- 1 | # iOS JS Bridge 2 | 3 | ## javaScriptCore 4 | 5 | * JS 线程安全,所有 JS 任何同步执行。 6 | * 在哪个线程执行 JS,JS 执行的 Native 代码也在对应线程。 7 | 8 | ### Native > JS 9 | 10 | 注册 JS 方法 11 | 12 | ``` 13 | JSContext *context; 14 | [self.context evaluateScript:@"module.nativeToJS = () => {};"] 15 | ``` 16 | 17 | OC 调用 JS 注册的方法 18 | 19 | ``` 20 | JSContext *context; 21 | JSValue *module = context[@"module"]; 22 | [module invokeMethod:@"nativeToJS" withArguments:@[]]; 23 | ``` 24 | 25 | ### JS > Native 26 | 27 | #### JSExport 方式实现 28 | 29 | #### Block 方式实现 30 | 31 | 注册 Native 回调 32 | 33 | ``` 34 | JSContext *context; 35 | JSValue *module = [JSValue valueWithNewObjectInContext:self.context]; 36 | [module setValue:^(id message) {} forProperty:@"jsToNative"]; 37 | context[@"module"] = module; 38 | ``` 39 | 40 | JS 调用 Native 注册的方法 41 | 42 | ```JS 43 | module.jsToNative(); 44 | ``` 45 | -------------------------------------------------------------------------------- /ios/Cocoapods.md: -------------------------------------------------------------------------------- 1 | # Cocoapods 2 | 3 | * [官网](https://cocoapods.org/) 4 | * [podspec文档](https://guides.cocoapods.org/syntax/podspec.html) 5 | * [podfile文档](https://guides.cocoapods.org/syntax/podfile.html) 6 | 7 | ## 安装 8 | 9 | ```sh 10 | gem install cocoapods 11 | ``` 12 | 13 | ## Podfile 14 | 15 | * `use_frameworks!` 使用 frameworks,而不使用静态库 16 | * `inhibit_all_warnings!` 继承所有警告,Xcode 中显示 cocoapods 工程的警告 17 | 18 | ## lib 19 | 20 | 开发 pod 库 21 | 22 | ### 用Cocoapods的模板 23 | 24 | ``` 25 | $ pod lib create GreedAppleWallet 26 | ``` 27 | 28 | ### 用自定义的模板 29 | 30 | ``` 31 | $ pod lib create GreedAppleWallet --template-url=https://github.com/GreedBell/pod-template 32 | ``` 33 | 34 | ### lint 35 | 36 | ``` 37 | pod lib lint GreedAppleWallet.podspec 38 | ``` 39 | 40 | ## trunk 41 | 42 | 发布 pod 库 43 | -------------------------------------------------------------------------------- /ios/Other.md: -------------------------------------------------------------------------------- 1 | # Other 2 | 3 | ## `block _property` 4 | 5 | 直接用私有变量有个需要特别注意的地方,在 block 里直接写 `_property` 相当于 `self->_property`,虽然没写 self,但是暗含了对 self 的retain,容易造成循环引用。要记得用 weakSelf/strongSelf 大法。 6 | -------------------------------------------------------------------------------- /ios/README.md: -------------------------------------------------------------------------------- 1 | # iOS 2 | 3 | * [iOS Universal Links(通用链接)](https://yohunl.com/ios-universal-links-tong-yong-lian-jie/) 4 | * [app thinning](https://help.apple.com/xcode/mac/current/#/devbbdc5ce4f) 5 | 6 | Use asset catalogs so that the App Store can select images, GPU resources, and other data appropriate for each device variant. 7 | -------------------------------------------------------------------------------- /ios/action-extension.md: -------------------------------------------------------------------------------- 1 | # Action Extension 2 | 3 | 扩展 UIActivityViewController 第二排操作,只会弹出窗口,不能跳转到 Containing App 4 | 5 | ## 创建 6 | 7 | ### 有界面 8 | 9 | ### 无界面 10 | 11 | 无界面的 Action Extension 取不到 UIResponder,所以无法打开 Host App 12 | 13 | ## Info.plist 14 | 15 | * `CFBundleDisplayName`: 显示名称 16 | 17 | ## 设置图标 18 | 19 | Xcode > Target > action > Build Settings > `Asset Catalog App Icon Set Name`: 设置为 `AppIcon` 20 | 21 | ## References 22 | 23 | * [Understand Action Extensions](https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/Action.html) 24 | * [Sharing and Actions](https://developer.apple.com/design/human-interface-guidelines/ios/extensions/sharing-and-actions/) 25 | * [【iOS扩展开发攻略】Action Extension](https://www.jianshu.com/p/37f23426bb04) 26 | * [iOS Action Extension开发教程,实现跨APP的数据共享](https://www.jianshu.com/p/7f8472a97aa6) 27 | -------------------------------------------------------------------------------- /ios/app-store-review.md: -------------------------------------------------------------------------------- 1 | # App 内 AppStore 评分 2 | 3 | * [Requesting App Store Reviews](https://developer.apple.com/documentation/storekit/skstorereviewcontroller/requesting_app_store_reviews?language=objc) 4 | -------------------------------------------------------------------------------- /ios/apple-login.md: -------------------------------------------------------------------------------- 1 | # 苹果登录 2 | 3 | ## References 4 | 5 | * [Sign in with Apple](https://developer.apple.com/documentation/sign_in_with_apple) 6 | * [苹果登录集成 Sign in with Apple](https://www.jianshu.com/p/15cf5c39e9d4) 7 | * [iOS 13 苹果账号登陆与后台验证相关](https://juejin.im/post/6844903914051993607) 8 | -------------------------------------------------------------------------------- /ios/apple-pay.md: -------------------------------------------------------------------------------- 1 | # Apple Pay 2 | 3 | * [Apple Pay](https://developer.apple.com/apple-pay/) 4 | * [Apple Pay 入门](https://developer.apple.com/apple-pay/get-started/cn/) 5 | 6 | > 直接与[银联](https://open.unionpay.com/ajweb/product/detail?id=80)对接就可以了,使用银联的SDK,具体怎么用银联文档里有 7 | 8 | ## 使用 9 | 10 | ### `Apple Developer` 开启`Apple Pay`权限,并添加`Merchant ID` 11 | 12 | ### `Merchant ID`添加证书 13 | 14 | > 下载 ` Apple Intermediate Certificates > Worldwide Developer Relations - G2 Certificate` 15 | 16 | ### `Xcode`中开启`Apple Pay`权限 17 | 18 | ## 相关资料 19 | 20 | * 21 | * 22 | * 23 | * 24 | -------------------------------------------------------------------------------- /ios/ci.md: -------------------------------------------------------------------------------- 1 | # CI服务器与自动化部署 2 | 3 | 目前,业界比较流行的,支持iOS构建的CI服务器有Travis CI和Jenkins 4 | 5 | ## Travis CI 6 | 7 | 只支持gitHub 8 | 9 | ## Jenkins 10 | 11 | ### 安装 12 | 13 | ```shell 14 | brew install jenkins 15 | ``` 16 | 17 | ###启动 18 | 19 | ```shell 20 | jenkins 21 | ``` 22 | 23 | 默认为8080端口,自定义端口: 24 | 25 | ```shell 26 | defaults write /Library/Preferences/org.jenkins-ci httpPort 7072 27 | ``` 28 | 29 | ### 打开 30 | 31 | 32 | 33 | ### 使用 34 | -------------------------------------------------------------------------------- /ios/cupertino.md: -------------------------------------------------------------------------------- 1 | # ~~Cupertino~~ 2 | 3 | 已经不再维护。用 fastlane 取代 4 | 5 | * [GitHub](https://github.com/nomad/cupertino) 6 | 7 | Nomad CLI 工具之一,Cupertino 为你提供了命令行接口来管理苹果 Provisioning Portal 上的设备及 profile。举例来说,只要键入 ios devices:list 就可以看到你帐号里的当前设备列表。可以用来自动化许多过程。 8 | -------------------------------------------------------------------------------- /ios/document-provider-extension.md: -------------------------------------------------------------------------------- 1 | # Document Provider 2 | 3 | **Attention** iOS 11 弃用,改用 File Provider 4 | 5 | ## 介绍 6 | 7 | Document Provider Extension 是 iOS 8 出的功能,允许 app 和其它 app 进行文件传送、接收交互。 8 | 9 | 为了实现应用间共享数据,iOS 使用了两种单独的扩展。 10 | 11 | * Document Picker:当另一个app启动iCloud file picker时呈现出的view controller。 12 | 13 | * File Provider: 一个由NSFileCoordinator协调在host app与extension apps之间移动数据的非UI组件。NSFileCoordinator,正如其名,协调读取文件。它也允许多线程操作,例如host app及containing app,可以同时获取文件而不用彼此叨扰。 14 | 15 | ## References 16 | 17 | * [Document Provider Extension](https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/FileProvider.html) 官方文档 18 | * [Document Provider Extensions](https://www.jianshu.com/p/3e3674630190) 19 | * [App Extension编程指南(iOS8/OS X v10.10):扩展类型--Document Provider](http://www.cocoachina.com/ios/20141007/9835.html) 20 | * [App Extension Programming Guide ](https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/index.html) App 扩展编程指南 21 | -------------------------------------------------------------------------------- /ios/download-background.md: -------------------------------------------------------------------------------- 1 | # 后台下载 2 | 3 | ## References 4 | 5 | * [iOS使用NSURLSession进行下载(包括后台下载,断点下载)](https://www.jianshu.com/p/1211cf99dfc3) 6 | -------------------------------------------------------------------------------- /ios/editing-menu.md: -------------------------------------------------------------------------------- 1 | # 自定义显示选中文字的编辑菜单项 2 | 3 | UIMenuController 4 | 5 | ## References 6 | 7 | * [在UIWebView中自定义显示选中文字的编辑菜单项](http://blog.csdn.net/FuDesign2008/article/details/37927997) 8 | -------------------------------------------------------------------------------- /ios/framework-design.md: -------------------------------------------------------------------------------- 1 | # iOS框架设计 2 | 3 | 因为各个模块都是分不同组开发,最后用pod整合。 4 | 模块间的跳转都是由一个路由控制 5 | 对复杂的table使用工厂 6 | 脚本啥也挺多的,自动化打包啥 7 | 8 | 把跳转逻辑写在每个模块的总代理,注册在客户端的壳中,由路由进行派发,客户端其实就是壳,然后由pod组成 9 | 10 | 头文件什么的都可以不暴露在vc 11 | 12 | 普遍使用MVVM 13 | -------------------------------------------------------------------------------- /ios/gcd.md: -------------------------------------------------------------------------------- 1 | # GCD 2 | 3 | ## dispatch_suspend/dispatch_resume 4 | 5 | 在GCD中dispatch_suspend和dispatch_resume提供了“挂起、恢复”队列的功能,简单来说,就是可以暂停、恢复队列上的任务。但是这里的“挂起”,并不能保证可以立即停止队列上正在运行的block,未执行的block会被“挂起”。 6 | -------------------------------------------------------------------------------- /ios/gesture-recognizer.md: -------------------------------------------------------------------------------- 1 | # iOS 手势 2 | 3 | * UITapGestureRecognizer 轻拍手势 4 | * UISwipeGestureRecognizer 轻扫手势 5 | * UILongPressGestureRecognizer 长按手势 6 | * UIPanGestureRecognizer 平移手势 7 | * UIPinchGestureRecognizer 捏合(缩放)手势 8 | * UIRotationGestureRecognizer 旋转手势 9 | * UIScreenEdgePanGestureRecognizer 屏幕边缘平移 10 | -------------------------------------------------------------------------------- /ios/handoff.md: -------------------------------------------------------------------------------- 1 | # Handoff 2 | 3 | ## Mac 浏览器打开手机 App 上的 URL 4 | 5 | 创建一个 NSUserActivity,activityType 设为自己 App 的 Bundle ID,webpageURL 设为需要 mac 浏览器打开的 URL。mac 上如果没有对应 Bundle ID 的 App,则使用默认浏览器打开 6 | 7 | eg: 8 | 9 | ```objc 10 | NSUserActivity* myActivity = [[NSUserActivity alloc] 11 | initWithActivityType: @"com.company.myapp"]; 12 | 13 | myActivity.webpageURL = [NSURL URLWithString:@"http://www.google.co.uk"]; 14 | ``` 15 | 16 | ## References 17 | 18 | * [Handoff Programming Guide](https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html) 19 | * [How does one do a Native App to Web Browser Handoff?](https://stackoverflow.com/a/26260016/6283925) 20 | * [react-native-handoff](https://github.com/IzaakSultan/react-native-handoff) 21 | * [使用“连续互通”连接 Mac、iPhone、iPad、iPod touch 和 Apple Watch](https://support.apple.com/zh-cn/HT204681) 22 | -------------------------------------------------------------------------------- /ios/iPad分屏.md: -------------------------------------------------------------------------------- 1 | # iPAd 分屏 2 | 3 | ## 如果支持分屏 4 | 5 | 1. `Target > General > Devices > iPad` 6 | 2. 不勾选 `Require full screen` 7 | 8 | ## 如何监听屏幕变化 9 | 10 | ```objc 11 | - (void)viewDidLayoutSubviews 12 | { 13 | [super viewDidLayoutSubviews]; 14 | CGFloat newViewWidth = self.view.frame.size.width; 15 | if (newViewWidth != _oldViewWidth) { 16 | self.oldViewWidth = newViewWidth; 17 | [self viewWidthUpdatedFromDidLayoutSubviews]; 18 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 19 | [self viewWidthUpdated]; 20 | }); 21 | } 22 | } 23 | ``` 24 | 25 | ## 注意 26 | 27 | UIWindow 需要用`keyWindow` 28 | -------------------------------------------------------------------------------- /ios/iap.md: -------------------------------------------------------------------------------- 1 | # App 内购(in app purchase) 2 | 3 | ## 凭证 4 | 5 | * [verifyReceipt](https://developer.apple.com/documentation/appstorereceipts/verifyreceipt) 6 | 7 | ## App 内购服务通知 8 | 9 | * [自动续订服务端通知](http://chrisyu.cn/20200602/ios-iap/) 10 | * [App Store Server Notifications](https://developer.apple.com/documentation/appstoreservernotifications) 11 | * [App Store Server Notifications - notification_type](https://developer.apple.com/documentation/appstoreservernotifications/notification_type) 12 | * [App Store Server Notifications - responsebody](https://developer.apple.com/documentation/appstorereceipts/responsebody) 13 | 14 | ## References 15 | 16 | * [iOS内购(IAP)自动续订订阅类型总结](https://cloud.tencent.com/developer/article/1445964) 17 | -------------------------------------------------------------------------------- /ios/ios-13.md: -------------------------------------------------------------------------------- 1 | # iOS13 2 | 3 | ## Navigation 4 | 5 | ### UINavigationBarAppearance 6 | 7 | ### UIBarButtonItemAppearance 8 | -------------------------------------------------------------------------------- /ios/ios-run-on-mac.md: -------------------------------------------------------------------------------- 1 | # iOS App 运行在 Mac 上 2 | 3 | ## 运行在 Mac 上的方案 4 | 5 | iOS App 运行在 Mac 上有两种方案 6 | 7 | 1. `Mac Catalyst` App 可以运行在任何 `macOS Big Sur` 以上的版本 8 | 2. 普通 iOS App 可以运行在 `Apple silicon` 架构的 macOS 上 9 | 10 | ### Mac Catalyst 11 | 12 | 需要开启 Mac 兼容 13 | 14 | ### Apple silicon 15 | 16 | 不用做任何适配 17 | 18 | ## 如何运行在 Mac 上 19 | 20 | - TestFlight 支持 `Apple silicon` 架构的 Mac 21 | - Mac 上双击 AdHoc 包 可以直接安装 22 | 23 | ### Xcode 直接在 Mac 上运行 App 24 | 25 | #### Mac Catalyst 26 | 27 | - 在 添加 Device ID 28 | - 在 添加对应的 `macOS App Development` 描述文件 29 | - 运行的时候选择 Mac 真机 30 | 31 | ## Other 32 | 33 | 判断当前是否运行在 Mac 上 34 | 35 | ``` 36 | [NSProcessInfo processInfo].macCatalystApp || [NSProcessInfo processInfo].isiOSAppOnMac 37 | ``` 38 | 39 | ## References 40 | 41 | - [Running Your iOS Apps on macOS](https://developer.apple.com/documentation/apple-silicon/running-your-ios-apps-on-macos) 42 | - [Distributing Your App to Registered Devices](https://developer.apple.com/documentation/xcode/distributing_your_app_to_registered_devices?language=objc) 43 | -------------------------------------------------------------------------------- /ios/key-command.md: -------------------------------------------------------------------------------- 1 | # UIKeyCommand 2 | 3 | `UIResponder.keyCommands` 可以实现长按 cmd 键弹出快捷键提示 4 | 5 | ## References 6 | 7 | * [UIKeyCommand](https://developer.apple.com/documentation/uikit/uikeycommand) 8 | * [UIKeyCommand - NSHipster 中文版](http://nshipster.cn/uikeycommand/) 9 | -------------------------------------------------------------------------------- /ios/keyboard.md: -------------------------------------------------------------------------------- 1 | # iOS键盘 2 | 3 | ## Reference 4 | 5 | * 6 | * 7 | -------------------------------------------------------------------------------- /ios/layout.md: -------------------------------------------------------------------------------- 1 | # 布局方式 2 | 3 | ## AutoLayout 4 | 5 | 自动布局 6 | 7 | ## Size Classes 8 | 9 | 各个端取不同的值 10 | 11 | ## Vary for Trait 12 | 13 | 特征变量(Trait Variations) 14 | 15 | 在 Xcode8 中删除了 `size class` 选项,取而代之的是 `Use Trait Variations` 16 | 17 | 完成不同平台不同布局的使用方法: 18 | 19 | 选中某个组件 > View as: ****,选择布局需要特殊处理的平台,譬如 iPad > Vary for Trait > 勾上 Width 和 Height > 修改布局 > Done Varying。 20 | -------------------------------------------------------------------------------- /ios/mac-catalyst.md: -------------------------------------------------------------------------------- 1 | # 支持 Mac Catalyst 2 | 3 | iPad 应用移植到 macOS 4 | 5 | ## New Build System 6 | 7 | 工程切换到新的编译系统,否则会报错: 8 | 9 | ``` 10 | Building for Mac Catalyst is not supported by the legacy build system. 11 | ``` 12 | 13 | Xcode > File > Workspace Settings > Build System: New Build System 14 | 15 | ## Bundle ID 16 | 17 | 需要给 macOS 包设置 Bundle ID。 18 | 19 | https://developer.apple.com > 找到对应 iOS 的 Bundle ID > Mac Catalyst > Edit 20 | 21 | ## XCFrameworks 22 | 23 | XCFramework 使将多个平台(包括 iOS 设备,iOS 模拟器和 Mac Catalyst)的二进制框架或库捆绑到一个可分发的 .xcframework 捆绑包中,.framework 和 .a 不支持 Mac Catalyst 24 | 25 | ## Cocoapods 26 | 27 | 升级到 1.9 以上,支持打包成 XCFrameworks 28 | 29 | 30 | 31 | ## References 32 | 33 | - [Mac Catalyst 初步体验+排坑](https://zhuanlan.zhihu.com/p/88189492) 34 | -------------------------------------------------------------------------------- /ios/masonry.md: -------------------------------------------------------------------------------- 1 | # Masonry权值 2 | 3 | 4 | 5 | 最大值 1000 6 | Masonry默认 UILayoutPriorityDefaultHigh = 750 7 | 8 | 9 | ```objc 10 | // 调整label随内容变化的权重 11 | [label setContentCompressionResistancePriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal]; 12 | ``` -------------------------------------------------------------------------------- /ios/multi-window.md: -------------------------------------------------------------------------------- 1 | # iPad 支持多窗口 2 | 3 | * [iPad 上的多窗口 ](https://xiaozhuanlan.com/topic/0342159876) 4 | * [Supporting Multiple Windows on iPad](https://developer.apple.com/documentation/uikit/app_and_environment/scenes/supporting_multiple_windows_on_ipad) 5 | -------------------------------------------------------------------------------- /ios/new-build-system.md: -------------------------------------------------------------------------------- 1 | # New Build System 2 | 3 | ## Building for iOS Simulator, but the linked and embedded framework 'IdcardQuality.framework' 4 | 5 | 参考 6 | 7 | * 8 | * [为什么在 Xcode 12.3 及之后版本中使用 iOS 模拟器构建项目会失败?](https://docs.agora.io/cn/All/faq/ios_simulator_problem) 9 | 10 | 方法一: 11 | 12 | 在 Build Settings - Excluded Source File Names - Debug 添加 Any iOS Simulator: IdcardQuality.framework 13 | 14 | 引用的位置最好用TARGET_OS_SIMULATOR判断一下 15 | 16 | 方法二: 17 | 18 | 在 Xcode 中,进入 TARGETS > Project Name > Build Settings > Build Options 菜单,将 Validate Workspace 设置为 Yes。 19 | -------------------------------------------------------------------------------- /ios/parse-crash-log.md: -------------------------------------------------------------------------------- 1 | # 崩溃日志解析 2 | 3 | ## 崩溃日志查看 4 | 5 | ### Xcode 6 | 7 | 1. 手机连上 Mac 电脑 8 | 2. Xcode > Window > Devices and Simulators > Devices > 选择对应手机 > 找到对应崩溃日志 > 下载下来 9 | 3. 在打包的电脑(确保符号文件未删除)上用 Xcode 打开崩溃日志,就可以解析崩溃日志 10 | 11 | ### symbolicatecrash 12 | 13 | ### atos 14 | 15 | ## UUID 16 | 17 | ### dSYM 18 | 19 | ```bash 20 | #获取.dsym文件的UUID,值可能包含armv7/arm64两组 21 | $ dwarfdump --uuid XX.app.dSYM 22 | #获取.app文件的UUID,值可能包含armv7/arm64两组 23 | $ dwarfdump --uuid XX.app/XX 24 | ``` 25 | 26 | ### crash 文件 27 | 28 | ```bash 29 | $ grep “appName armv” *crash 30 | # 或者 31 | $ grep --after-context=2 “Binary Images:” *crash 32 | ``` 33 | -------------------------------------------------------------------------------- /ios/presentation-controller.md: -------------------------------------------------------------------------------- 1 | # UIPresentationController 2 | 3 | 4 | ## References 5 | 6 | * [iOS自定义转场动画/UIPresentationController](https://www.jianshu.com/p/a7335474651c) 7 | -------------------------------------------------------------------------------- /ios/pull-to-refresh.md: -------------------------------------------------------------------------------- 1 | # 下拉刷新 2 | 3 | ## UIRefreshControl 4 | 5 | 支持 iOS6 及以上,功能简单 6 | -------------------------------------------------------------------------------- /ios/scanner.md: -------------------------------------------------------------------------------- 1 | # 扫码 2 | 3 | iOS上实现扫码的方法有`ZBar`,`ZXing`,`AVFoundation` 4 | 5 | ## AVFoundation 6 | 7 | cocoa自带库,无论在扫描灵敏度和性能上来说都是最优的,前提是iOS7之后才能用 8 | 9 | ## Reference 10 | 11 | * 12 | * 13 | -------------------------------------------------------------------------------- /ios/selector.md: -------------------------------------------------------------------------------- 1 | # Selector 2 | 3 | ## `performSelector may cause a leak because its selector is unknown` 4 | 5 | * 6 | * 7 | -------------------------------------------------------------------------------- /ios/sharine-extension.md: -------------------------------------------------------------------------------- 1 | # Sharing Extension 2 | 3 | 扩展 UIActivityViewController 第一排操作 4 | 5 | Storage Provider: app 直接可以使用这些扩展检索和存储文件而不再需要创建不必要的拷贝。 6 | 7 | ## 拷贝到 App 8 | 9 | ## References 10 | 11 | * [Sharing and Actions](https://developer.apple.com/design/human-interface-guidelines/ios/extensions/sharing-and-actions/) 12 | * [Understand Share Extensions](https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/Share.html) 13 | * [【iOS扩展开发攻略】Share Extension](https://www.jianshu.com/p/863ce6729455) 14 | -------------------------------------------------------------------------------- /ios/smooth-view.md: -------------------------------------------------------------------------------- 1 | # 让界面更流畅 2 | 3 | ## 不透明 4 | 5 | 不透明可以减少颜色合成计算 6 | 7 | ## 离屏渲染 8 | 9 | 离屏渲染合成计算是非常昂贵的 10 | 11 | GPU屏幕渲染有以下两种方式: 12 | 13 | * On-Screen Rendering 14 | 意为当前屏幕渲染,指的是GPU的渲染操作是在当前用于显示的屏幕缓冲区中进行。 15 | 16 | * Off-Screen Rendering 17 | 意为离屏渲染,指的是GPU在当前屏幕缓冲区以外新开辟一个缓冲区进行渲染操作。 18 | 19 | ## References 20 | 21 | * [Getting Pixels onto the Screen](https://www.objc.io/issues/3-views/moving-pixels-onto-the-screen/#the-hardware-players) 22 | * [绘制像素到屏幕上](https://objccn.io/issue-3-1/) `Getting Pixels onto the Screen` 翻译 23 | * [iOS 保持界面流畅的技巧](http://blog.ibireme.com/2015/11/12/smooth_user_interfaces_for_ios/) 24 | * [AsyncDisplayKit](https://github.com/facebook/AsyncDisplayKit) 25 | * [YYKit](https://github.com/ibireme/YYKit) 26 | -------------------------------------------------------------------------------- /ios/speech-recognizer.md: -------------------------------------------------------------------------------- 1 | # 语音识别 2 | 3 | 4 | ## References 5 | 6 | * [官方文档](https://developer.apple.com/documentation/speech) 7 | * [官方例子](https://developer.apple.com/library/archive/samplecode/SpeakToMe/Introduction/Intro.html) 8 | * [使用iOS语言识别以及语言合成遇到的坑](https://www.jianshu.com/p/d2fc9bda3bcb) 9 | * [iOS语音识别和语音合成](https://www.jianshu.com/p/5cbe466b128a) 10 | * [iOS siri语音听写和语音合成OC版](https://www.jianshu.com/p/75f739b29fec) 11 | -------------------------------------------------------------------------------- /ios/split-view-controller.md: -------------------------------------------------------------------------------- 1 | # UISplitViewController 2 | 3 | In iOS 8 and later, you can use the UISplitViewController class on all iOS devices; in previous versions of iOS, the class is available only on iPad. 4 | 5 | > iOS 8 及新系统上可以在所有 iOS 设备上使用 ,之前版本只能在 iPad 上用 6 | -------------------------------------------------------------------------------- /ios/submit-app.md: -------------------------------------------------------------------------------- 1 | # 提交 App 2 | 3 | 参考 [How to upload IPA now that Application Loader is no longer included in Xcode 11](https://stackoverflow.com/questions/57976017/how-to-upload-ipa-now-that-application-loader-is-no-longer-included-in-xcode-11) Xcode11 之后 Application Loader 已经弃用,可以使用 `xcrun altool`, [Transporter](https://apps.apple.com/cn/app/transporter/id1450874784?mt=12) 或者 `fastlane pilot` 4 | 5 | ## xcrun altool 6 | 7 | [appstoreconnect](https://appstoreconnect.apple.com/access/users) > 用户和访问 > 秘钥 > 生成秘钥:得到 `apiKey` 和 `apiIssuer` > 下载密钥到 `~/.private_keys/` 目录下 8 | 9 | ```sh 10 | mkdir ~/.private_keys 11 | cp ~/Downloads/AuthKey_GZD44LSXPN.p8 ~/.private_keys/ 12 | ``` 13 | 14 | 上传 TestFlight 包 15 | 16 | ```sh 17 | xcrun altool --upload-app --type ios --file $APPFILE --apiKey $KEY --apiIssuer $ISSUER 18 | ``` 19 | -------------------------------------------------------------------------------- /ios/swift.md: -------------------------------------------------------------------------------- 1 | # swift 2 | 3 | * [Github Organization](https://github.com/apple) 4 | * [swift 文档](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/index.html) 5 | -------------------------------------------------------------------------------- /ios/universal-links.md: -------------------------------------------------------------------------------- 1 | # Universal Links 2 | 3 | ## 禁用 Universal Links 4 | 5 | 参考 6 | ``` 7 | //就是这么的简单粗暴 8 | - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler { 9 | //返回+2的枚举值 10 | decisionHandler(WKNavigationActionPolicyAllow + 2); 11 | } 12 | ``` 13 | 14 | ## References 15 | 16 | * [Support Universal Links](https://developer.apple.com/library/content/documentation/General/Conceptual/AppSearch/UniversalLinks.html) 17 | * [Universal Link 前端部署采坑记](http://awhisper.github.io/2017/09/02/universallink/) 18 | -------------------------------------------------------------------------------- /ios/websocket.md: -------------------------------------------------------------------------------- 1 | # iOS WebSocket 2 | 3 | ## 第三方库 4 | 5 | * [SocketRocket](https://github.com/facebook/SocketRocket) FaceBook 出品,RN 在用,已很久没有修改 6 | * [Starscream 7 | ](https://github.com/daltoniam/Starscream) swift 版 WebSocket 8 | * [SwiftWebSocket 9 | ](https://github.com/tidwall/SwiftWebSocket) swift 版 WebSocket 10 | -------------------------------------------------------------------------------- /ios/wkwebview-intercept.md: -------------------------------------------------------------------------------- 1 | # WKWebView 请求拦截 2 | 3 | WKWebView 在独立于 app 进程之外的进程中执行网络请求,请求数据不经过主进程,因此,在 WKWebView 上直接使用 NSURLProtocol 无法拦截请求。 4 | 5 | ## WKURLSchemeHandler 6 | 7 | 正常情况下,无法拦截标准 scheme,只能拦截自定义 scheme。添加如下代码才支持 8 | 9 | ```objc 10 | @interface WKWebView (SHMSchemeHandler) 11 | 12 | @end 13 | 14 | @implementation WKWebView (SHMSchemeHandler) 15 | 16 | // 强制返回 NO,所有 scheme 都可以用 [WKWebViewConfiguration setURLSchemeHandler:forURLScheme:] 自定义处理 17 | + (BOOL)handlesURLScheme:(NSString *)urlScheme { 18 | return NO; 19 | } 20 | 21 | @end 22 | ``` 23 | 24 | ## References 25 | 26 | - [WKWebView 请求拦截探索与实践](https://segmentfault.com/a/1190000039111381) 27 | - [WKWebView 完美网络请求拦截](https://juejin.cn/post/6844904154629046280) 28 | -------------------------------------------------------------------------------- /ios/xcode-select.md: -------------------------------------------------------------------------------- 1 | # xcode-select 2 | 3 | ## 查看当前 Xcode 路径 4 | 5 | ```sh 6 | xcode-select -p 7 | ``` 8 | 9 | ## 切换 10 | 11 | ```sh 12 | sudo xcode-select -s /Applications/Xcode-8.2.1.app/Contents/Developer/ 13 | ``` 14 | -------------------------------------------------------------------------------- /ios/xcrun.md: -------------------------------------------------------------------------------- 1 | # xcrun 2 | 3 | ## 列出所有模拟器 4 | 5 | ``` 6 | $ xcrun simctl list 7 | ``` 8 | 9 | ## 删除模拟器 10 | 11 | 删除指定 id 的模拟器 12 | 13 | ``` 14 | $ xcrun simctl delete 15 | ``` 16 | 17 | 删除所有失效模拟器 18 | 19 | ``` 20 | $ xcrun simctl delete unavailable 21 | ``` 22 | -------------------------------------------------------------------------------- /java/assert-exception.md: -------------------------------------------------------------------------------- 1 | # 断言与异常 2 | 3 | * 断言是用来检查非法情况而不是错误情况的,用来帮开发者快速定位问题的位置。 4 | * 异常处理用于对程序发生异常情况的处理,增强程序的健壮性和容错性。 5 | 6 | ## assert 7 | 8 | ### assert 特性 9 | 10 | * assert默认是不启用的 11 | * assert抛出的异常AssertionError是继承自Error的 12 | 13 | ### 使用 assert 的三种情况 14 | 15 | * 在私有方法中放置assert作为输入参数的校验 16 | * 流程控制中不可能达到的区域 17 | * 建立程序探针 18 | 19 | ## References 20 | 21 | * [断言(Assert)与异常(Exception)](https://blog.csdn.net/zhaofuxiang/article/details/53379394) 22 | -------------------------------------------------------------------------------- /java/chaining-optionals.md: -------------------------------------------------------------------------------- 1 | # Chaining Optionals 2 | -------------------------------------------------------------------------------- /java/coroutine.md: -------------------------------------------------------------------------------- 1 | # Java 协程(coroutine) 2 | 3 | Java 编写程序都运行在在 Java 虚拟机(JVM)中,在 JVM 的内部,程序的多任务是通过线程来实现的。 4 | 多线程: java web 5 | 6 | * [kilim](https://github.com/kilim/kilim) 很久没维护 7 | * [Quasar](https://github.com/puniverse/quasar) 8 | * [vert.x](https://github.com/eclipse-vertx/vert.x/) 9 | 10 | ## 说明 11 | 12 | * 单线程控制权交替 13 | * 协程的好处是减少上下文的切换,用户态线程 14 | 15 | 你敢开1w个协程跑,你开1w个线程试试,光上下文切换就是一比不小的开销 16 | 他底层一般还是多线程之类在调度 17 | 18 | IO密集型应用: 多进程->多线程->事件驱动->协程 19 | CPU密集型应用:多进程-->多线程 20 | 21 | ## 使用 22 | 23 | * Java and Kotlin 使用 [Quasar](https://github.com/puniverse/quasar) 实现协程 24 | * Kotlin 协程 25 | * Java 的 Future 26 | 27 | ### 注意 28 | 29 | 协程需要 NIO,不能用 BIO,否则会阻塞线程 30 | 31 | ## 阻塞 32 | 33 | * I\O: 网络请求等待,读写文件 34 | * CPU: 计算 35 | 36 | ## 异步工具库 37 | 38 | * Netty: 是异步网络通信库 39 | * AsynchronousFileChannel: 异步文件 I/O 40 | * Vert.x3: 封装了Netty4,封装了AsynchronousFileChannel,而且Vert.x官方也出了一个相对应的封装了Quasar的库vertx-sync 41 | 42 | ## References 43 | 44 | * [漫画:什么是协程?](https://www.itcodemonkey.com/article/4620.html) 45 | * [次时代Java编程(一) Java里的协程](https://segmentfault.com/a/1190000005342905) 46 | -------------------------------------------------------------------------------- /java/find-bugs.md: -------------------------------------------------------------------------------- 1 | # FindBugs 2 | 3 | FindBugs 对 java 进行质量检查。 4 | 5 | ```text 6 | Since FindBugs is unmaintained and does not support bytecode compiled for Java 9 and above, the FindBugs plugin has been deprecated and is scheduled to be removed in Gradle 6.0. Please consider using the SpotBugs plugin instead. 7 | ``` 8 | 9 | ```text 10 | FindBugs 将不支持 java 9,Gradle 6.0 中将不支持,建议使用 SpotBugs 11 | ``` 12 | 13 | ## References 14 | 15 | * [The FindBugs Plugin](https://docs.gradle.org/current/userguide/findbugs_plugin.html) 16 | * [FindBugsExtension](https://docs.gradle.org/current/dsl/org.gradle.api.plugins.quality.FindBugsExtension.html) 17 | -------------------------------------------------------------------------------- /java/format.md: -------------------------------------------------------------------------------- 1 | # Format 2 | 3 | * java.text.Format 4 | 5 | 子类 6 | 7 | * DateFormat 日期 8 | * MessageFormat 消息 9 | * NumberFormat 数字 10 | 11 | 方法 12 | 13 | * format(Object obj, StringBuffer toAppendTo, FieldPosition pos) 14 | * formatToCharacterIterator(Object obj) 15 | * parseObject(String source, ParsePosition pos) 16 | 17 | ## FieldPosition 18 | 19 | ### NumberFormat 20 | 21 | `_FIELD` 常量 22 | 23 | * FRACTION_FIELD 分数域 24 | * INTEGER_FIELD 整数域 25 | 26 | `Format.Field` 常量 27 | 28 | * CURRENCY 货币 29 | * DECIMAL_SEPARATOR 小数点 30 | 31 | ## ParsePosition 32 | 33 | 解析过程中跟踪当前位置 34 | 35 | ## NumberFormat 36 | 37 | 数字格式化 38 | 39 | * getPercentInstance 百分比 40 | * getCurrencyInstance 货币 41 | 42 | ## DateFormat 43 | 44 | 日期时间格式化 45 | 46 | * getDateInstance 47 | * getTimeInstance 48 | * getDateTimeInstance 49 | -------------------------------------------------------------------------------- /java/high-precision-calculation.md: -------------------------------------------------------------------------------- 1 | # 高精度计算 2 | 3 | 涉及货币等对精度敏感的数据使用 4 | 5 | 用 `BigDecimal` 6 | -------------------------------------------------------------------------------- /java/java-servlet.md: -------------------------------------------------------------------------------- 1 | # Java Servlet 2 | 3 | * [Java Servlet完全教程](http://www.importnew.com/14621.html) 4 | * [Servlet 简介](http://www.runoob.com/servlet/servlet-intro.html) 5 | 6 | Servlet 单例多线程 7 | 8 | 9 | Servlet如何处理多个请求访问? 10 | Servlet容器默认是采用单实例多线程的方式处理多个请求的: 11 | 1.当web服务器启动的时候(或客户端发送请求到服务器时),Servlet就被加载并实例化(只存在一个Servlet实例); 12 | 2.容器初始化化Servlet主要就是读取配置文件(例如tomcat,可以通过servlet.xml的设置线程池中线程数目,初始化线程池通过web.xml,初始化每个参数值等等。 13 | 3.当请求到达时,Servlet容器通过调度线程(Dispatchaer Thread) 调度它管理下线程池中等待执行的线程(Worker Thread)给请求者; 14 | 4.线程执行Servlet的service方法; 15 | 5.请求结束,放回线程池,等待被调用; 16 | (注意:避免使用实例变量(成员变量),因为如果存在成员变量,可能发生多线程同时访问该资源时,都来操作它,照成数据的不一致,因此产生线程安全问题) 17 | 18 | ## References 19 | 20 | * [Java面试题:Servlet是线程安全的吗?](https://www.cnblogs.com/chanshuyi/p/5052426.html) 21 | -------------------------------------------------------------------------------- /java/junit.md: -------------------------------------------------------------------------------- 1 | # JUnit 2 | 3 | ## References 4 | 5 | * 6 | -------------------------------------------------------------------------------- /java/lombok.md: -------------------------------------------------------------------------------- 1 | # Lombok 2 | 3 | * [GitHub](https://github.com/rzwitserloot/lombok) 4 | * [官网](https://projectlombok.org/) 5 | 6 | ## 安装 7 | 8 | ### Gradle 9 | 10 | 参考 11 | 12 | ``` 13 | repositories { 14 | mavenCentral() 15 | } 16 | 17 | dependencies { 18 | compileOnly 'org.projectlombok:lombok:1.18.8' 19 | annotationProcessor 'org.projectlombok:lombok:1.18.8' 20 | } 21 | ``` 22 | 23 | ### IDEA 插件 24 | 25 | 参考 安装插件 26 | 27 | * Go to File > Settings > Plugins 28 | * Click on Browse repositories... 29 | * Search for Lombok Plugin 30 | * Click on Install plugin 31 | * Restart IntelliJ IDEA 32 | 33 | 参考 [Setting up Lombok with Eclipse and Intellij](https://www.baeldung.com/lombok-ide) 配置插件 34 | 35 | 需要 `Settings > Build > Compiler > Annotation Processors` 开启 `Annotation Processing` 36 | -------------------------------------------------------------------------------- /java/quasar.md: -------------------------------------------------------------------------------- 1 | # Quasar 2 | 3 | * [Github](https://github.com/puniverse/quasar) 4 | 5 | 在调度方面,Quasar中默认使用了JDK7以上才有的ForkJoinPool,它的优势就在于空闲的线程会去从其他线程任务队列尾部”偷取”任务来自己处理,因此也叫work-stealing功能。这个功能可以大大的利用CPU资源,不让线程白白空闲着。 6 | -------------------------------------------------------------------------------- /java/queue.md: -------------------------------------------------------------------------------- 1 | # Queue 2 | 3 | 队列 4 | 5 | > Collection 6 | >> Set 7 | >> 8 | >> List 9 | >> 10 | >> `Queue`: 队列 11 | >>> `Deque`: 双端队列,在 Queue 接口的基础上增加了一些针对双端添加和删除元素的方法。 12 | >>> 13 | >>> `AbstractQueue`: 非阻塞队列 14 | >>>> `PriorityQueue`: 类实质上维护了一个有序列表。加入到 Queue 中的元素根据它们的天然排序(通过其 java.util.Comparable 实现)或者根据传递给构造函数的 java.util.Comparator 实现来定位。 15 | >>>> 16 | >>>> `ConcurrentLinkedQueue`: 是基于链接节点的、线程安全的队列。并发访问不需要同步。 17 | >>> 18 | >>> `BlockingQueue`: 阻塞队列 19 | >>>> 20 | >>>> `ArrayBlockingQueue` :一个由数组支持的有界队列。 21 | >>>> 22 | >>>> `LinkedBlockingQueue` :一个由链接节点支持的可选有界队列。 23 | >>>> 24 | >>>> `PriorityBlockingQueue` :一个由优先级堆支持的无界优先级队列。 25 | >>>> 26 | >>>> `DelayQueue` :一个由优先级堆支持的、基于时间的调度队列。 27 | >>>> 28 | >>>> `SynchronousQueue` :一个利用 BlockingQueue 接口的简单聚集(rendezvous)机制。 29 | 30 | 31 | ## References 32 | 33 | * [java队列——queue详细分析](https://www.cnblogs.com/lemon-flm/p/7877898.html) 34 | * [Java集合(七) Queue详解](https://juejin.im/post/5a3763ed51882506a463b740) 35 | -------------------------------------------------------------------------------- /java/reflection.md: -------------------------------------------------------------------------------- 1 | # 反射 2 | 3 | Java反射机制可以让我们在编译期(Compile Time)之外的运行期(Runtime)获得任何一个类的字节码。包括接口、变量、方法等信息。还可以让我们在运行期实例化对象,通过调用get/set方法获取变量的值。 4 | 5 | 使用Java反射API的时候可以绕过Java默认的访问控制检查,比如可以直接获取到对象的私有域的值或是调用私有方法。只需要在获取到Constructor、Field和Method类的对象之后,调用setAccessible方法并设为true即可。有了这种机制,就可以很方便的在运行时刻获取到程序的内部状态。 6 | 7 | 代理模式:代理对象和被代理对象一般实现相同的接口,调用者与代理对象进行交互 8 | 动态代理:允许开发人员在运行时刻动态的创建出代理类及其对象。 9 | 10 | ## Questions 11 | 12 | `public final class` `getDeclaredFields()` 获取不到所有 field 13 | 14 | ## References 15 | 16 | * [Java 反射机制](http://wiki.jikexueyuan.com/project/java-reflection/) 17 | * 18 | -------------------------------------------------------------------------------- /java/run.md: -------------------------------------------------------------------------------- 1 | # 运行 2 | -------------------------------------------------------------------------------- /java/visual-vm.md: -------------------------------------------------------------------------------- 1 | # VisualVM 2 | 3 | ## 线程状态 4 | 5 | * NEW: 新建 6 | * RUNNABLE: 可运行 7 | * BLOCKED: 阻塞: synchronized 或者 Object.wait() 8 | * WAITING: 无限期等待: Object.wait(),Thread.join(),LockSupport.park() 9 | * TIMED_WAITING: 限期等待 10 | * TERMINATED: 结束 11 | 12 | ## VisualVM 状态 13 | 14 | * 运行: RUNNABLE 15 | * 休眠: TIMED_WAITING (sleeping) 16 | * 等待: WAITING (on object monitor): 状态是在等待一段时间 或者 唤醒动作的发生,进入“等待”状态是主动的 17 | * 驻留: WAITING (parking)、TIMED_WAITING (parking): 18 | * 监视: BLOCKED (on object monitor): 19 | -------------------------------------------------------------------------------- /javascript/ES6.md: -------------------------------------------------------------------------------- 1 | # ES6 2 | 3 | es2015 = es6 + es7的一部分 + jsx 4 | 5 | ## 严格模式 6 | 7 | 尾递归优化只在严格模式下生效 8 | 9 | 类和模块的内部,默认就是严格模式,所以不需要使用use strict指定运行模式。只要你的代码写在类或模块之中,就只有严格模式可用。 10 | 11 | 考虑到未来所有的代码,其实都是运行在模块之中,所以ES6实际上把整个语言升级到了严格模式。 12 | 13 | 14 | 15 | ## 相关资料 16 | 17 | * [ECMAScript 6 教程](http://es6.ruanyifeng.com/) 18 | * [babel es6 文档](http://babeljs.io/docs/learn-es2015/) 19 | * [各平台对ES6的支持情况](http://kangax.github.io/compat-table/es6/) 20 | * [Nodejs下的ES6兼容性与性能分析](http://my.oschina.net/zhangstephen/blog/541276) 21 | * [三点操作符是如何改变Javascript的](https://github.com/rowone/blog/issues/1) 22 | -------------------------------------------------------------------------------- /javascript/dots.md: -------------------------------------------------------------------------------- 1 | # 点点滴滴 2 | 3 | ## 1 4 | 5 | ```js 6 | '' + a 7 | ``` 8 | 9 | 把 a 强转成字符串,防止直接用强转函数 undefined 报错。 10 | 11 | * undefined > 'undefined' 12 | * null > 'null' 13 | -------------------------------------------------------------------------------- /javascript/high-precision-calculation.md: -------------------------------------------------------------------------------- 1 | # 高精度计算 2 | 3 | 涉及货币等对精度敏感的数据使用 4 | 5 | * [javascript 浮点数精确计算](http://www.jenkihuang.com/2015/07/javascript-float-point.html) 6 | * [Java和Js的高精度计算 ](http://blog.csdn.net/zhutulang/article/details/6844834) 7 | * [ js高精度浮点数运算 ](https://my.oschina.net/lonelydawn/blog/804463) 8 | 9 | ## 第三方库 10 | 11 | 1. [numbers.js](https://github.com/numbers/numbers.js) 12 | 2. [Numeric Javascript](https://github.com/sloisel/numeric/blob/master/src/numeric.js) 13 | 3. [accounting.js](https://github.com/openexchangerates/accounting.js) 14 | 15 | ## numbers.js 16 | 17 | * `Basic calculations` 基本计算 18 | * `complex` 复数 19 | * `Calculus` 微积分 20 | * `Matrix Operations` 矩阵运算 21 | * `Prime Numbers` 质数 22 | * `Statistics` 统计 23 | * `dsp` 信号处理 24 | * `radom` 随机数 25 | * `generate` 26 | 27 | ### 基本计算 28 | 29 | * `numbers.basic.product(arr)` 乘积 30 | * `numbers.basic.sum(arr)` 和 31 | -------------------------------------------------------------------------------- /javascript/jsdoc.md: -------------------------------------------------------------------------------- 1 | # jsdoc 2 | 3 | * [GitHub](https://github.com/jsdoc3/jsdoc) 4 | * [usejsdoc](http://usejsdoc.org/) 5 | -------------------------------------------------------------------------------- /javascript/typescript.md: -------------------------------------------------------------------------------- 1 | # TypeScript 2 | 3 | * [官网](https://www.typescriptlang.org) 4 | * [官方文档](https://www.typescriptlang.org/docs/home.html) 5 | * [中文文档](https://www.tslang.cn/docs/home.html) 6 | 7 | ## 后缀 8 | 9 | * .ts是最常用的 10 | * .tsx是用在react的jsx语法里的 11 | * .d.ts是为了定义(define)类型使用的。 12 | -------------------------------------------------------------------------------- /javascript/web-kernel.md: -------------------------------------------------------------------------------- 1 | # Web 内核 2 | 3 | * [MDN JS 引擎比较](https://developer.mozilla.org/zh-CN/docs/Mozilla/Projects/SpiderMonkey/Comparision_of_JS_engines) 4 | * [wiki](https://en.wikipedia.org/wiki/JavaScript_engine) 5 | * [v8](http://v8project.blogspot.hk/) 6 | * [apple javascriptcore](https://developer.apple.com/reference/javascriptcore) 7 | * [javascriptcore](http://trac.webkit.org/wiki/JavaScriptCore) 8 | * [主流浏览器内核介绍(前端开发值得了解的浏览器内核历史)](http://web.jobbole.com/84826/) 9 | 10 | 浏览器内核又可以分成两部分:渲染引擎(layout engineer 或者 Rendering Engine)和 JS 引擎。 11 | 12 | * 渲染引擎 负责取得网页的内容(HTML、XML、图像等等)、整理讯息(例如加入 CSS 等),以及计算网页的显示方式,然后会输出至显示器或打印机。 13 | * JS 引擎则是解析 Javascript 语言,执行 javascript 语言来实现网页的动态效果。 14 | 15 | ## 内核 16 | 17 | * Gecko(firefox) 18 | * Trident(IE) 19 | * WebKit (Safari chrome 等): 由渲染引擎 WebCore 和 JS 解释引擎 JSCore 组成 20 | * Presto(前opera) 21 | 22 | ## 渲染引擎 23 | 24 | * WebCore 25 | * Blink (chrome): WebKit 的分支 26 | 27 | ## Javascript 引擎 28 | 29 | * KJS 30 | * JSCore 31 | * V8 32 | -------------------------------------------------------------------------------- /kotlin/README.md: -------------------------------------------------------------------------------- 1 | # kotlin 2 | 3 | * [官网](https://kotlinlang.org/) 4 | * [Kotlin 语言中文站](https://www.kotlincn.net/) 5 | * [Kotlin 语言中文站教程](https://www.kotlincn.net/docs/reference/) 6 | * [Kotlin 官方维护的 awesome](KotlinBy/awesome-kotlin) 7 | 8 | ## 语法 9 | 10 | ### const VS val 11 | 12 | ### public VS open 13 | 14 | ## Lint 15 | 16 | * [ktlint](https://github.com/shyiko/ktlint) 17 | 18 | ## kotlin native 19 | 20 | ### iOS 21 | 22 | 参考 [Creating an iOS framework with Kotlin](https://viteinfinite.com/2018/02/creating-an-ios-framework-with-kotlin/) 23 | kotlin 生成 `Example.framework` `Example.framework.dSYM` 文件 24 | Xcode 工程配置: 25 | 26 | * `Example.framework` `Example.framework.dSYM` 拖到工程 27 | * Framework Search Path 添加 `Example.framework` 所在路径 28 | * Build Phases > + > New Copy Files Phase > + > 选择 `Example.framework` `Example.framework.dSYM` 29 | 30 | 这样 framework 报错的时候会有可读的错误日志。 31 | 32 | * [xcode-kotlin](https://github.com/touchlab/xcode-kotlin) Xcode 支持调试 kotlin 的插件 33 | * [DroidconKotlin](https://github.com/touchlab/DroidconKotlin/) Xcode 支持调试 kotlin 的例子 34 | -------------------------------------------------------------------------------- /mac/Other.md: -------------------------------------------------------------------------------- 1 | # Other 2 | 3 | ## 在mac中修改主机名 4 | 5 | ```shell 6 | sudo scutil --set HostName servername.example.com 7 | ``` 8 | 9 | ## BasicIPv6ValidationError 10 | 11 | $ networksetup -setv6off Ethernet 12 | 13 | ## 更新 Numbers 等系统自带但收费的App 14 | 15 | 如果换了 Apple ID ,从 App Store 的更新界面更新需要之前的 Apple ID 。解决方法: 16 | 17 | > 从 App Store 的已购项目中更新 18 | 19 | ## 更新系统时提示 未能验证 20 | 21 | * [mac更新sierra public beta6失败提示“未能验证”解决办法](http://blog.sina.com.cn/s/blog_a7a3f3920102wxln.html) 22 | 23 | ```sh 24 | sudo rm -rf /Library/Updates/​031-89979/ 25 | ``` 26 | 27 | 28 | ```sh 29 | softwareupdate -l​ 30 | ``` 31 | 32 | 进入mac app store点击系统更新​按钮 33 | 34 | ## Finder 显示隐藏文件 35 | 36 | ```SH 37 | defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder 38 | ``` 39 | -------------------------------------------------------------------------------- /mac/apache.md: -------------------------------------------------------------------------------- 1 | # apache 2 | 3 | ## 启动Apache 4 | 5 | sudo apachectl start 6 | -------------------------------------------------------------------------------- /mac/auto-launch.md: -------------------------------------------------------------------------------- 1 | # 开机自启动 2 | 3 | ## loginwindow 4 | 5 | 该方法最多只能设置一个执行脚本,且已经不被Apple推荐 6 | 7 | 添加自启动项 8 | 9 | ```sh 10 | sudo defaults write com.apple.loginwindow LoginHook /path/to/script.sh 11 | ``` 12 | 13 | 查看自启动项 14 | 15 | ```sh 16 | sudo defaults read com.apple.loginwindow LoginHook 17 | ``` 18 | 19 | 删除自启动项 20 | 21 | ```sh 22 | sudo defaults delete com.apple.loginwindow LoginHook 23 | ``` 24 | 25 | 添加退出时自动运行脚本 26 | 27 | ```sh 28 | sudo defaults write com.apple.loginwindow LogoutHook /path/to/script.sh 29 | ``` 30 | 31 | ## brew services 32 | 33 | ## launchctl 34 | 35 | ## 用户自启动 36 | 37 | 1. 自己新建个shell文件,编写shell脚本; 38 | 2. 点击shell文件,右键,点击“显示简介”,选择终端;注意:如果“推荐的应用程序”里没有终端,可以选择“所有应用程序”; 39 | 3. 打开“系统偏好设置”,点击“用户与群组”,然后切换到“登录项”tab,添加刚才创建的shell文件; 40 | 41 | ## References 42 | 43 | * [为Mac添加开机启动脚本](http://liuley.cn/%E6%8A%80%E6%9C%AF/2016/03/25/autorun-shellscript-when-start-mac.html) 44 | * [mac开机启动自动运行shell脚本](https://blog.csdn.net/enjoyinwind/article/details/86470674) 45 | -------------------------------------------------------------------------------- /mac/brew.md: -------------------------------------------------------------------------------- 1 | # Brew 2 | 3 | * [Homebrew/brew](https://github.com/Homebrew/brew) Mac 安装命令行工具 4 | * [homebrew-cask](https://github.com/caskroom/homebrew-cask) Mac 安装图形界面工具 5 | 6 | ## tap 7 | 8 | brew 扩展相关 9 | 10 | 列出所有扩展 11 | 12 | ```sh 13 | brew tap 14 | ``` 15 | 16 | 安装 cask 扩展 17 | 18 | ```sh 19 | brew tap caskroom/cask 20 | ``` 21 | 22 | ## 缓存 23 | 24 | ```sh 25 | ~/Library/Caches/Homebrew/Cask/ 26 | ``` 27 | -------------------------------------------------------------------------------- /mac/command.md: -------------------------------------------------------------------------------- 1 | # 命令 2 | 3 | ## 查看硬盘使用情况 4 | 5 | ```shell 6 | $ df -H 7 | ``` 8 | -------------------------------------------------------------------------------- /mac/mac-clean.md: -------------------------------------------------------------------------------- 1 | # Mac 删除临时文件 2 | 3 | ## 清除缓存文件 4 | 5 | ```shell 6 | cd ~/Library/Caches/ 7 | du -hs * | sort -h 8 | rm -rf ~/Library/Caches/* 9 | ``` 10 | 11 | ## References 12 | 13 | * [Mac OS X删除临时文件释放空间](https://blog.csdn.net/x_focus/article/details/50042385) 14 | -------------------------------------------------------------------------------- /mac/macos-big-sur.md: -------------------------------------------------------------------------------- 1 | # macOS Big Sur 2 | 3 | ## 软件已被系统安全策略阻止 4 | 5 | macOS Big Sur 运行vpn连接软件easyconnect无法正常连接 6 | 7 | 解决方法: 8 | 9 | 参考 在恢复模式下,终端输入:csrutil disable,就可以在安全与隐私看到那个允许的提示了。 10 | -------------------------------------------------------------------------------- /mac/macports.md: -------------------------------------------------------------------------------- 1 | # macports 2 | 3 | * [官网](https://www.macports.org/) 4 | 5 | ## 安装 6 | 7 | ```sh 8 | brew cask install macports 9 | ``` 10 | 11 | ## 使用 12 | 13 | 搜索 14 | 15 | ```sh 16 | port search php71-curl 17 | ``` 18 | 19 | 安装 20 | 21 | ```sh 22 | sudo port install php71-curl 23 | ``` 24 | -------------------------------------------------------------------------------- /mac/shortcut.md: -------------------------------------------------------------------------------- 1 | # 快捷键 2 | 3 | ## 弹出emoji表情 4 | 5 | control + command + space 6 | -------------------------------------------------------------------------------- /mac/spotlight.md: -------------------------------------------------------------------------------- 1 | # Spotlight 2 | 3 | ```sh 4 | sudo touch /.metadata-never-index 5 | ``` 6 | 7 | 重启 8 | 9 | ```sh 10 | sudo rm /.Spotlight-V100/VolumeConfiguration.plist 11 | sudo rm /.metadata-never-index 12 | ``` 13 | 14 | ## References 15 | 16 | * 17 | -------------------------------------------------------------------------------- /nodejs/Q-A.md: -------------------------------------------------------------------------------- 1 | # Q&A 2 | 3 | ## TypeError: Cannot convert object to primitive value 4 | 5 | 当 object 不是字符串时 6 | ```js 7 | console.log("string" + object); 8 | ``` 9 | 10 | 改成 11 | 12 | ```js 13 | console.log(object); 14 | ``` 15 | 16 | ## 文件路径 17 | 18 | * [浅析 NodeJs 的几种文件路径](https://github.com/imsobear/blog/issues/48) 19 | 20 | 只有在 `require()` 时才使用相对路径(./, ../) 的写法,其他地方一律使用绝对路径,如下: 21 | 22 | ```js 23 | // 当前目录下 24 | path.dirname(__filename) + '/test.js'; 25 | // 相邻目录下 26 | path.resolve(__dirname, '../lib/common.js'); 27 | ``` 28 | 29 | ## Not compatible with your operating system or architecture: fsevents 30 | 31 | Since `fsevents` is an API in OS X allows applications to register for notifications of changes to a given directory tree. Running: 32 | 33 | `npm install --no-optional` 34 | 35 | * 36 | -------------------------------------------------------------------------------- /nodejs/artTemplate.md: -------------------------------------------------------------------------------- 1 | # artTemplate 2 | 3 | js 模板引擎 4 | 5 | * [Github](https://github.com/aui/artTemplate) 6 | -------------------------------------------------------------------------------- /nodejs/bluebird.md: -------------------------------------------------------------------------------- 1 | # bluebird 2 | 3 | 如果第三方的那些函数库是符合错误优化的规则的话,可以直接用 `bluebird` 批量转换 4 | 5 | * [GitHub](https://github.com/petkaantonov/bluebird) 6 | * [官网](bluebirdjs.com) 7 | 8 | ## 注意 9 | 10 | > As a notable exception in fs, fs.existsAsync doesn't work as expected, because Node's fs.exists doesn't call back with error as first argument. More at #418. One possible workaround is using fs.statAsync. 11 | 12 | 翻译 13 | 14 | > 必须回调函数第一个参数是 error 15 | 16 | * 17 | -------------------------------------------------------------------------------- /nodejs/crush.md: -------------------------------------------------------------------------------- 1 | # NodeJS服务崩溃的解决办法 2 | 3 | ## 使用uncaughtException 4 | 5 | ```js 6 | process.on('uncaughtException', function (err) { 7 | //打印出错误 8 | console.log(err); 9 | //打印出错误的调用栈方便调试 10 | console.log(err.stack); 11 | }); 12 | ``` 13 | 14 | ## 使用 try/catch 15 | 16 | ```js 17 | var http = require('http'); 18 | 19 | http.createServer(function(req, res) { 20 | try { 21 | handler(req, res); 22 | } catch(e) { 23 | console.log(' 24 | ', e, ' 25 | ', e.stack); 26 | try { 27 | res.end(e.stack); 28 | } catch(e) { } 29 | } 30 | }).listen(8080, '127.0.0.1'); 31 | 32 | console.log('Server running at http://127.0.0.1:8080/'); 33 | 34 | var handler = function (req, res) { 35 | //Error Popuped 36 | var name = req.params.name; 37 | 38 | res.writeHead(200, {'Content-Type': 'text/plain'}); 39 | res.end('Hello ' + name); 40 | }; 41 | ``` 42 | 43 | 这种方案的好处是,可以将错误和调用栈直接输出到当前发生的网页上。 44 | 45 | ## 守护NodeJS进程和记录错误日志 46 | 47 | ## 使用shell启动脚本守护node 48 | 49 | ## reference 50 | 51 | 52 | -------------------------------------------------------------------------------- /nodejs/es6-support.md: -------------------------------------------------------------------------------- 1 | # Node 支持 ES6 2 | 3 | ## esm 4 | 5 | Install esm in your project 6 | 7 | ``` 8 | npm install --save esm 9 | ``` 10 | 11 | Update your Node Start Script to use esm 12 | 13 | ``` 14 | node -r esm app.js 15 | ``` 16 | -------------------------------------------------------------------------------- /nodejs/jest.md: -------------------------------------------------------------------------------- 1 | # Jest 2 | 3 | * [GitHub](https://github.com/facebook/jest) 4 | 5 | ## Install 6 | 7 | ```shell 8 | $ npm i -D jest @types/jest 9 | ``` 10 | -------------------------------------------------------------------------------- /nodejs/log4js.md: -------------------------------------------------------------------------------- 1 | # Nodejs日志管理log4js 2 | 3 | 4 | 5 | ## 安装 6 | 7 | ```shell 8 | $ npm install log4js 9 | ``` 10 | 11 | ## Reference 12 | 13 | * 14 | -------------------------------------------------------------------------------- /nodejs/mocha.md: -------------------------------------------------------------------------------- 1 | # mocha.js 2 | 3 | node.js 测试框架 4 | 5 | * [官网](http://mochajs.org) 6 | * [GitHub](https://github.com/mochajs/mocha) 7 | * [GitHub wiki](https://github.com/mochajs/mocha/wiki) 8 | * [测试框架 Mocha 实例教程](http://www.ruanyifeng.com/blog/2015/12/a-mocha-tutorial-of-examples.html) 9 | 10 | ## 安装 11 | 12 | ``` 13 | $ npm install --global mocha 14 | ``` 15 | 16 | ## 使用 17 | 18 | 测试脚本命名 19 | 20 | * `.test.js` 测试 21 | * `.spec.js` 规格 22 | 23 | 默认入口 24 | 25 | * `test/*.test.js` 26 | 27 | 参数 28 | 29 | * `--recursive` 测试 `test` 目录下面所有的测试用例(不管在哪一层).默认只测试 `test` 目录下的测试用例 30 | * `--reporter, -R` 默认是`spec`格式 ,[其它格式](http://mochajs.org/#reporters) 31 | -------------------------------------------------------------------------------- /nodejs/mongoose.md: -------------------------------------------------------------------------------- 1 | # Mongoose 2 | 3 | node.js mongodb 库 4 | 5 | ## Built-in Promises 6 | 7 | * 8 | * 9 | 10 | mongoose 默认返回的是 [mpromise](https://github.com/aheckmann/mpromise), mongoose推荐使用原生的 `global.Promise` 或者第三方的promise,例如: `require('bluebird')` 11 | 12 | ## 自定义 `_id` 13 | 14 | ``` 15 | var Post = new mongoose.Schema({ 16 | _id: Number, 17 | title: String, 18 | content: String, 19 | tags: [ String ] 20 | }); 21 | ``` 22 | 23 | OR 24 | 25 | ``` 26 | var Post = new mongoose.Schema({ 27 | title: String, 28 | content: String, 29 | tags: [ String ] 30 | }, { _id: false }); 31 | ``` 32 | 33 | ## array to json 34 | 35 | > lean() 36 | 37 | ``` 38 | Collection.find().lean(); 39 | ``` 40 | -------------------------------------------------------------------------------- /nodejs/nodemon.md: -------------------------------------------------------------------------------- 1 | # nodemon 2 | 3 | node.js 任务管理,开发环境用。 4 | 5 | * [官网](http://nodemon.io/) 6 | * [GitHub](https://github.com/remy/nodemon/) 7 | 8 | ## 安装 9 | 10 | ```shell 11 | $ npm install -g nodemon 12 | ``` 13 | 14 | ## 使用 15 | 16 | [gulp-nodemon](https://github.com/JacksonGariety/gulp-nodemon) gulp 中使用 nodemon 17 | -------------------------------------------------------------------------------- /nodejs/npm5.md: -------------------------------------------------------------------------------- 1 | # npm5 2 | 3 | 添加了 `package-lock.json` 来锁定版本, 4 | 5 | ## 注意事项 6 | 7 | * `npm i` 只会安装 `package-lock.json` 中对应版本的包,如果要升级包需要使用 `npm update` 或者 `npm i @` 8 | 9 | * `npm i` 会从 node_modules 取对应的源地址保存到 `package-lock.json`,所以如果是多人协作,必须要统一使用同样的源,否则不同的人 `npm i` 之后都会修改 `package-lock.json` 10 | 11 | ## Questions 12 | 13 | 1. npm WARN invalid config loglevel="notice" 14 | 15 | 参考 16 | 17 | ```sh 18 | npm config set loglevel warn 19 | ``` 20 | -------------------------------------------------------------------------------- /nodejs/nvm.md: -------------------------------------------------------------------------------- 1 | # nvm 2 | 3 | node 版本管理 4 | 5 | * [GitHub](https://github.com/creationix/nvm) 6 | 7 | ## 安装 nvm 8 | 9 | ```shell 10 | curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash 11 | source ~/.bashrc 12 | ``` 13 | 14 | ## 更新 nvm 15 | 16 | ```shell 17 | ( 18 | cd "$NVM_DIR" 19 | git fetch origin 20 | git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin` 21 | ) && . "$NVM_DIR/nvm.sh" 22 | ``` 23 | 24 | ## 安装 node 25 | 26 | ``` 27 | nvm install --lts node 28 | ``` 29 | 30 | ## 临时切换 node 31 | 32 | ``` 33 | nvm use node 34 | ``` 35 | 36 | ## 永久切换 node 37 | 38 | ``` 39 | nvm alias default node 40 | ``` 41 | -------------------------------------------------------------------------------- /nodejs/optimize-nginx.md: -------------------------------------------------------------------------------- 1 | # 使用 nginx 优化 node.js 2 | 3 | * [使用nginx反向代理处理静态页面](http://ourjs.com/detail/nodejs-on-nginx-%E4%BD%BF%E7%94%A8nginx%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86%E5%A4%84%E7%90%86%E9%9D%99%E6%80%81%E9%A1%B5%E9%9D%A2) 4 | 5 | 尽管Node.JS的性能不错,但处理静态事务确实不是他的专长,如:gzip编码,静态文件,HTTP缓存,SSL处理,负载平衡和反向代理及多站点代理等,都可以通过nginx来完成,从而减小node.js的负载,并通过nginx强大的缓存来节省您网站的流量从而提高网站的加载速度。 6 | -------------------------------------------------------------------------------- /nodejs/passport.md: -------------------------------------------------------------------------------- 1 | # passport.js 2 | 3 | node.js 账户认证 4 | 5 | ## Reference 6 | 7 | * [GitHub](https://github.com/jaredhanson/passport) 8 | * [Documentation](http://passportjs.org/docs) 9 | * [passport.js学习笔记](http://idlelife.org/archives/808) 10 | -------------------------------------------------------------------------------- /nodejs/private-npm.md: -------------------------------------------------------------------------------- 1 | # 私有 npm 2 | 3 | * [GitHub](https://github.com/cnpm/cnpmjs.org) 4 | * [cnpm 官网](https://cnpmjs.org/) 5 | 6 | ## 安装 7 | -------------------------------------------------------------------------------- /nodejs/spawn-exec.md: -------------------------------------------------------------------------------- 1 | # child_process 模块中 spawn 和 exec 的区别 2 | 3 | child_process.spaen会返回一个带有stdout和stderr流的对象。你可以通过stdout流来读取子进程返回给Node.js的数据。stdout拥有’data’,’end’以及一般流所具有的事件。当你想要子进程返回大量数据给Node时,比如说图像处理,读取二进制数据等等,你最好使用spawn方法。 4 | 5 | child_process.spawn方法在子进程开始执行时,它就开始从一个流总将数据从子进程返回给Node。 6 | 7 | ## options 8 | 9 | `options.stdio` 用于定义主线程与子线程之间怎么交互 10 | 11 | ## Reference 12 | 13 | * [官方文档](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_child_process) 14 | * [说说Node.js child_process模块中的spawn和exec方法 ](http://www.html-js.com/article/A-day-to-learn-to-talk-about-JavaScript-spawn-and-exec-Nodejs-in-the-childprocess-module?utm_source=tuicool&utm_medium=referral) 15 | -------------------------------------------------------------------------------- /nodejs/why-nodejs.md: -------------------------------------------------------------------------------- 1 | # 为什么选 node.js 2 | 3 | * [Node.js适用于哪些场景](https://github.com/simongong/js-stackoverflow-highest-votes/blob/master/questions1-10/when-to-use-nodejs.md) 4 | 5 | ## 优点 6 | 7 | 不再使用多进程、线程来处理多个web请求,而是使用多事件、队列来处理。这样就不存在资源瓶颈问题。 8 | 9 | ## 缺点 10 | 11 | 对计算密集型请求处理能力较弱.如图形处理、音频处理、编码、物理仿真、加密。 使用 [Web Workers](http://www.w3school.com.cn/html5/html_5_webworkers.asp) 模式来解决,开启一个子进程来处理计算密集型任务。 12 | -------------------------------------------------------------------------------- /objective-c/README.md: -------------------------------------------------------------------------------- 1 | # Objective C 2 | 3 | * [代码格式化](clang-format.md) 4 | * [代码统计](oclc.md) 5 | 6 | ## .(点)与->(箭头)用法区别 7 | 8 | .(点语法)是访问类的属性,本质是调用set、get方法。 9 | 10 | [targetString](./macro.md) 11 | 12 | ## 浮点型取整 13 | 14 | * ceil 向上取整 15 | * floor 向下取整 16 | * round 四舍五入 17 | * (int)强转 截尾取整 18 | * trunc 截尾取整 19 | 20 | 21 | ## JSON to Objective-C model 22 | 23 | * [nidyx](https://github.com/cknadler/nidyx) 24 | * [json-to-objective-c](https://github.com/raweng/json-to-objective-c) 25 | -------------------------------------------------------------------------------- /objective-c/arc.md: -------------------------------------------------------------------------------- 1 | # ARC 2 | 3 | * [黑幕背后的Autorelease](http://blog.sunnyxx.com/2014/10/15/behind-autorelease/) 4 | -------------------------------------------------------------------------------- /objective-c/cloc.md: -------------------------------------------------------------------------------- 1 | # CLOC 2 | 3 | 代码统计工具 4 | 5 | 6 | 7 | ## 安装 8 | 9 | ``` 10 | $ brew install cloc 11 | ``` 12 | 13 | ## 使用 14 | 15 | ``` 16 | $ cloc ./ --exclude-dir=Pods 17 | ``` 18 | -------------------------------------------------------------------------------- /objective-c/high-precision-calculation.md: -------------------------------------------------------------------------------- 1 | # 高精度计算 2 | 3 | 涉及货币等对精度敏感的数据使用 4 | 5 | 用 `NSDecimalNumber` 6 | -------------------------------------------------------------------------------- /objective-c/macro.md: -------------------------------------------------------------------------------- 1 | # 宏 2 | 3 | ## `#pragma`与`_Pragma` 4 | 5 | `#pragma`与`_Pragma`效果一样,但是在宏定义时,`#`会被忽略.eg: 6 | 7 | ```c 8 | #define MACRO(x) #x 9 | MACRO(example) //结果是example 10 | ``` 11 | 12 | 所以在宏里面只能用`_Pragma` 13 | 14 | ### 用法 15 | 16 | ```c 17 | _Pragma(“OPT_LEVEL 2”) 18 | ``` 19 | 20 | 等价于 21 | 22 | ```c 23 | #pragma OPT_LEVEL 2 24 | ``` 25 | -------------------------------------------------------------------------------- /objective-c/runtime.md: -------------------------------------------------------------------------------- 1 | # runtime 2 | 3 | ## Method 4 | 5 | ### class_copyMethodList 6 | 7 | 拷贝类的所有方法 8 | 9 | * 不会取父类的方法 10 | 11 | ### method_getTypeEncoding 12 | 13 | 获取方法的返回值和参数类型 14 | 15 | * [Type Encodings](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html) 16 | 17 | ### NSMethodSignature 18 | 19 | ``` 20 | SEL selector = method_getName(method); 21 | NSMethodSignature *signature = [class instanceMethodSignatureForSelector:selector]; 22 | 23 | NSUInteger numberOfArguments = [signature numberOfArguments]; 24 | 25 | for (int i=0 ; i", 17 | "license": "MIT", 18 | "bugs": { 19 | "url": "https://github.com/greedbell/blog/issues" 20 | }, 21 | "homepage": "https://github.com/greedbell/blog#readme", 22 | "dependencies": { 23 | "gitbook-plugin-adsense": "^1.0.3", 24 | "gitbook-plugin-anchors": "^0.7.1", 25 | "gitbook-plugin-duoshuo": "^1.6.3", 26 | "gitbook-plugin-fontsettings": "^2.0.0", 27 | "gitbook-plugin-github": "^2.0.0", 28 | "gitbook-plugin-highlight": "^2.0.2", 29 | "gitbook-plugin-search-pro": "^1.1.0", 30 | "gitbook-plugin-sharing": "^1.0.2" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /php/Atom4PHP.md: -------------------------------------------------------------------------------- 1 | # Atom 开发 PHP 2 | 3 | Atom写PHP,云端调试。 4 | 5 | ## 安装插件 6 | 7 | ``` 8 | apm install \ language-php \ php-debug \ php-introspector \ php-twig \ aligner-php \ autocomplete-php \ php-getters-setters \ php-cs-fixer \ php-class-tree 9 | 10 | apm install php-debug php-introspector 11 | ``` 12 | 13 | ### autocomplete-plus 14 | 15 | * autocomplete-plus ,当输入的时候,提供可能的候选项。 16 | 17 | ## 相关资料 18 | 19 | * 20 | * 21 | * 22 | -------------------------------------------------------------------------------- /php/async.md: -------------------------------------------------------------------------------- 1 | # 异步 2 | 3 | * [PHP实现异步调用方法研究](http://www.laruence.com/2008/04/14/318.html) 4 | * [使用fscok实现异步调用PHP](http://www.laruence.com/2008/04/16/98.html) 5 | * [关于PHP的异步调用](http://www.cnblogs.com/fuyunbiyi/archive/2013/03/27/2985089.html) 6 | * [PHP非阻塞模式](http://www.4wei.cn/archives/1002336) 7 | -------------------------------------------------------------------------------- /php/docker-php.md: -------------------------------------------------------------------------------- 1 | # docker php 2 | 3 | * [docker-php](https://hub.docker.com/_/php/) 4 | * [docker-php-github](https://github.com/docker-library/php) 5 | * [docker-php-doc](https://github.com/docker-library/docs/tree/master/php) 6 | -------------------------------------------------------------------------------- /php/framework-for-restfull.md: -------------------------------------------------------------------------------- 1 | # 适合写 Restfull API 的框架 2 | 3 | 我是来说反例的,但凡用以下风格实现controller的,实现RESTFul都很不方便 4 | 5 | ``` 6 | class Controller { 7 | public function actionFoo() {} 8 | public function actionBar() {} 9 | } 10 | ``` 11 | 12 | 因为RESTFul是对HTTP动作(GET/POST/PUT/DELETE/...)敏感的,用这种风格的Controller的框架来实现就不可避免的会出现以下这种代码 13 | 14 | ``` 15 | class Controller { 16 | public function actionFoo() { 17 | if (is_get) { 18 | /* 一坨代码 */ 19 | } else if (is_post) { 20 | /* 一坨代码 */ 21 | } else if (is_put) { 22 | /* 一坨代码 */ 23 | } else if (is_delete) { 24 | /* 一坨代码 */ 25 | } 26 | } 27 | } 28 | ``` 29 | 30 | 最终在 [Slim](https://github.com/slimphp/Slim) 和 [Silex](https://github.com/silexphp/Silex) 选择了 Slim 31 | 32 | ## Reference 33 | 34 | * [php实现restful api有什么框架使用方便?](https://segmentfault.com/q/1010000000500665) 35 | * [Top 12 Best PHP RESTful Micro Frameworks (Pro/Con)](http://www.gajotres.net/best-available-php-restful-micro-frameworks/) 36 | -------------------------------------------------------------------------------- /php/high-precision-calculation.md: -------------------------------------------------------------------------------- 1 | # 高精度计算 2 | 3 | 涉及货币等对精度敏感的数据使用 4 | 5 | 用 `BCMath` 6 | 7 | * [BCMath 任意精度数学](http://php.net/manual/zh/book.bc.php) 8 | -------------------------------------------------------------------------------- /php/mail.md: -------------------------------------------------------------------------------- 1 | # PHP 使用 Mail 2 | 3 | ## 使用 sendmail 4 | 5 | Linux 下 可以使用 sendmail 工具发邮件 6 | 7 | ### 配置 sendmail 8 | 9 | `php.ini` 配置 `sendmail-path` 为 sendmail 路径 10 | 11 | 参考 12 | 13 | ### 发送邮件 14 | 15 | 使用 [Mail 函数](http://php.net/manual/zh/function.mail.php) 发送邮件 16 | 17 | ## 使用 PHPMailer 18 | 19 | * [PHPMailer/PHPMailer](https://github.com/PHPMailer/PHPMailer) 20 | -------------------------------------------------------------------------------- /php/pecl.md: -------------------------------------------------------------------------------- 1 | # pecl 2 | 3 | ## mac 安装 pecl 4 | 5 | * [Install PEAR and PECL on Mac OS X](https://jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/) 6 | -------------------------------------------------------------------------------- /php/phinx.md: -------------------------------------------------------------------------------- 1 | # phinx 2 | 3 | 数据迁移填充工具 4 | 5 | * [GitHub](https://github.com/robmorgan/phinx) 6 | * [官网](https://phinx.org/) 7 | * [官方文档](http://docs.phinx.org/en/latest/) 8 | 9 | ## Column Types 10 | 11 | [Valid Column Types](http://docs.phinx.org/en/latest/migrations.html#valid-column-types) 12 | 13 | * biginteger 14 | * binary 15 | * boolean 16 | * date 日期 17 | * datetime 日期时间 18 | * decimal 19 | * float 20 | * integer 默认 int(11) 21 | * string 22 | * text 23 | * time 时间 24 | * timestamp 时间戳 25 | * uuid 26 | 27 | MySQL 还支持 enum, set, blob, json (json MySQL 5.7 及以上支持) 28 | 29 | ## questions 30 | 31 | ### 清除 `phinx status` 记录 32 | 33 | 参考 34 | 35 | * check your database for a table called phinxlog. 36 | * remove the ** MISSING ** columns. 37 | -------------------------------------------------------------------------------- /php/phpdoc.md: -------------------------------------------------------------------------------- 1 | # phpdoc 2 | 3 | * [官网](https://phpdoc.org) 4 | * [文档](https://phpdoc.org/docs/latest/index.html) 5 | 6 | ## 安装 7 | 8 | * [Installing](https://phpdoc.org/docs/latest/getting-started/installing.html) 9 | 10 | 安装的依赖 11 | 12 | * >= PHP 5.3.3 13 | * PHP intl 扩展 14 | * graphviz 15 | * 有些模板需要 PHP xsl 扩展 16 | 17 | ```sh 18 | pear channel-discover pear.phpdoc.org 19 | pear install phpdoc/phpDocumentor 20 | ``` 21 | 22 | ## 生成文档 23 | 24 | ```sh 25 | $ phpdoc run -d [directory to parse] -t [output directory] 26 | $ phpdoc -d ./src -t ./docs/api 27 | ``` 28 | -------------------------------------------------------------------------------- /php/resources/laravel-auth-analyze-login.dot: -------------------------------------------------------------------------------- 1 | digraph { 2 | label="laravel 登录流程"; 3 | begin[label="开始"]; 4 | validateLogin[label="验证请求数据格式\n"]; 5 | attemptLogin[label="验证用户名密码是否正确"]; 6 | success[label="登录成功"]; 7 | fail[label="登录失败"]; 8 | begin->validateLogin; 9 | validateLogin->attemptLogin[label="请求数据格式正确"] 10 | validateLogin->fail[label="请求数据格式错误",style=dashed] 11 | attemptLogin->success[label="用户名密码正确"] 12 | attemptLogin->fail[label="用户名或密码错误",style=dashed] 13 | } 14 | -------------------------------------------------------------------------------- /php/resources/laravel-auth-analyze-logout.dot: -------------------------------------------------------------------------------- 1 | digraph { 2 | label="laravel 注销流程"; 3 | begin[label="开始"]; 4 | validator[label="验证请求数据格式"]; 5 | login[label="登录"]; 6 | registered[label="是否已经注册过"]; 7 | success[label="注册成功"]; 8 | fail[label="注册失败"]; 9 | begin->validator; 10 | validator->login[label="请求数据格式正确"] 11 | validator->fail[label="请求数据格式错误",style=dashed] 12 | login->registered 13 | registered->success[label="未注册"] 14 | registered->fail[label="已注册",style=dashed] 15 | } 16 | -------------------------------------------------------------------------------- /php/resources/laravel-auth-analyze-register.dot: -------------------------------------------------------------------------------- 1 | digraph { 2 | label="laravel 注册流程"; 3 | begin[label="开始"]; 4 | validator[label="验证请求数据格式"]; 5 | login[label="登录"]; 6 | registered[label="是否已经注册过"]; 7 | success[label="注册成功"]; 8 | fail[label="注册失败"]; 9 | begin->validator; 10 | validator->login[label="请求数据格式正确"] 11 | validator->fail[label="请求数据格式错误",style=dashed] 12 | login->registered 13 | registered->success[label="未注册"] 14 | registered->fail[label="已注册",style=dashed] 15 | } 16 | -------------------------------------------------------------------------------- /php/tool.md: -------------------------------------------------------------------------------- 1 | # 工具 2 | 3 | ## Composer 4 | 5 | 是 PHP 用来管理依赖(dependency)关系的工具。你可以在自己的项目中声明所依赖的外部工具库(libraries),Composer 会帮你安装这些依赖的库文件。 6 | 7 | ## PECL(PHP 扩展模块) 8 | 9 | PECL 的全称是 The PHP Extension Community Library ,是一个开放的并通过 PEAR(PHP Extension and Application Repository,PHP 扩展和应用仓库)打包格式来打包安装的 PHP扩展库仓库。通过 PEAR 的 Package Manager 的安装管理方式,可以对 PECL 模块进行下载和安装。 10 | -------------------------------------------------------------------------------- /php/yii.md: -------------------------------------------------------------------------------- 1 | # Yii 2 | 3 | * [官网](http://www.yiiframework.com/) 4 | * [官方文档](http://www.yiiframework.com/doc/) 5 | * [1.1官方中文手册](http://www.yiiframework.com/doc/guide/1.1/zh_cn/index) 6 | * [GitHub](https://github.com/yiisoft) 7 | * [中文社区](http://www.yiichina.com) 8 | * [Yii 2.0 权威指南](http://www.yiichina.com/doc/guide/2.0) 9 | 10 | ## 查看yii版本 11 | -------------------------------------------------------------------------------- /python/README.md: -------------------------------------------------------------------------------- 1 | # Python 2 | 3 | * [官网](Installation) 4 | 5 | Mac 自带 6 | 7 | ``` 8 | brew install python3 9 | ``` 10 | -------------------------------------------------------------------------------- /python/pip.md: -------------------------------------------------------------------------------- 1 | # pip 2 | 3 | python 依赖工具 4 | 5 | * [文档](https://pip.pypa.io/en/stable/) 6 | 7 | ## 安装 8 | 9 | 参考 [Installation](https://pip.pypa.io/en/stable/installing/) 10 | 11 | ```sh 12 | wget https://bootstrap.pypa.io/get-pip.py 13 | python get-pip.py 14 | ``` 15 | 16 | ### Questions 17 | 18 | #### Q1 19 | 20 | ``` 21 | InvalidSchema: Missing dependencies for SOCKS support. 22 | ``` 23 | 24 | A1: 25 | 26 | 不能用 SOCKS 代理 ,关掉代理 27 | 28 | #### Q2 29 | 30 | ``` 31 | OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip' 32 | ``` 33 | 34 | A2: 35 | 36 | 无权限创建 `无权限创建` 文件夹,运行 `sudo chmod a+w /Library/Python/2.7/site-packages` 37 | -------------------------------------------------------------------------------- /react-native/build-from-source.md: -------------------------------------------------------------------------------- 1 | # 使用源码编译 2 | 3 | ## Android 4 | 5 | fort react-native,然后 checkout fork 后仓库的代码。运行如下的命令 6 | 7 | ```sh 8 | # 安装 npm 依赖 9 | npm i 10 | # 编译 11 | ./gradlew :ReactAndroid:build -x test -x lint 12 | # 生成 maven 包到 android 目录 13 | ./gradlew :ReactAndroid:installArchives -x test -x lint 14 | ``` 15 | 16 | 把 android 从 .gitignore 去掉,再 push 到仓库 17 | 18 | 参考 [shimo-react-native/react-native](https://github.com/shimo-react-native/react-native/tree/0.47-shimo) 19 | 20 | ## Questions 21 | 22 | ### react native 指向了 0.20.1 版 23 | 24 | 因为本地库 `$rootDir/../node_modules/react-native/android` 没有找到 `react-native` jar 包,所以使用了 [jCenter](http://jcenter.bintray.com/com/facebook/react/react-native/) 上的最新包,也就是 `0.20.1` 版。 25 | -------------------------------------------------------------------------------- /react-native/comment.md: -------------------------------------------------------------------------------- 1 | # 组件 2 | 3 | ## TextInput 4 | 5 | ```js 6 | // 当文本框内容变化时调用此回调函数。 7 | onChange function 8 | ``` 9 | 10 | ```js 11 | // 当文本框内容变化时调用此回调函数。改变后的文字内容会作为参数传递。 12 | onChangeText function 13 | ``` 14 | -------------------------------------------------------------------------------- /react-native/font.md: -------------------------------------------------------------------------------- 1 | # 字体 2 | 3 | 4 | ## References 5 | 6 | * [React Native Custom Fonts](https://medium.com/react-native-training/react-native-custom-fonts-ccc9aacf9e5e) 7 | * [iOS-动态下载所需的字体](https://www.jianshu.com/p/5a9f49e13ad5) 8 | * [动态下载苹果提供的多种中文字体](http://blog.devtang.com/2013/08/11/ios-asian-font-download-introduction/) 9 | * [Downloadable Fonts](https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts.html) 10 | * [Fonts in XML](https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml.html?hl=zh-cn) 11 | -------------------------------------------------------------------------------- /react-native/image.md: -------------------------------------------------------------------------------- 1 | # Image 分析 2 | 3 | ## Android 4 | 5 | `ReactImageView` 6 | -------------------------------------------------------------------------------- /react-native/inderview.md: -------------------------------------------------------------------------------- 1 | # 面试 2 | 3 | `fresco` 配置 4 | 5 | 原生与 RN 间如何通信。 6 | 7 | ## References 8 | 9 | * [React 常用面试题目与分析](https://zhuanlan.zhihu.com/p/24856035) 10 | -------------------------------------------------------------------------------- /react-native/key-command.md: -------------------------------------------------------------------------------- 1 | # key command 2 | 3 | RCTKeyCommand 4 | -------------------------------------------------------------------------------- /react-native/layout.md: -------------------------------------------------------------------------------- 1 | # 界面布局 2 | 3 | ## iOS 4 | 5 | ### RCTShadowView 6 | 7 | 和 yogaNode 建议映射 8 | 9 | ### RCTUImanager 10 | 11 | 把 yoga 计算的布局结果同步到原生界面 12 | 13 | RCTUImanager: setNeedsLayout > _layoutAndMount > `[self addUIBlock:[self uiBlockWithLayoutUpdateForRootView:rootView]]` > flushUIBlocksWithCompletion 14 | 15 | ### RCTUIManagerObserver 16 | 17 | 渲染生命周期监听 18 | 19 | ## Android 20 | -------------------------------------------------------------------------------- /react-native/native-modules-analyze.md: -------------------------------------------------------------------------------- 1 | # 原生模块分析 2 | 3 | ## iOS 如何实现 4 | 5 | `RCTBridgeModule.h` 中定义了 6 | 7 | ``` 8 | #define RCT_EXPORT_MODULE(js_name) \ 9 | RCT_EXTERN void RCTRegisterModule(Class); \ 10 | + (NSString *)moduleName { return @#js_name; } \ 11 | + (void)load { RCTRegisterModule(self); } 12 | ``` 13 | 14 | 模块 load 时调用 `RCTRegisterModule(self)` 注册模块 15 | -------------------------------------------------------------------------------- /react-native/native-to-js.md: -------------------------------------------------------------------------------- 1 | # 原生与 JS 交互 2 | 3 | ## 事件 4 | 5 | NativeEventEmitter 6 | -------------------------------------------------------------------------------- /react-native/network.md: -------------------------------------------------------------------------------- 1 | # React Native Network 实现过程 2 | 3 | ## Network 4 | 5 | ### XMLHttpRequest 6 | 7 | [RCTNetworking.mm](https://github.com/facebook/react-native/blob/master/Libraries/Network/RCTNetworking.mm) 实现原生的网络请求 8 | 9 | [RCTNetworking.ios.js](https://github.com/facebook/react-native/blob/master/Libraries/Network/RCTNetworking.ios.js) 实现 JS 调用的 RCTNetworking 10 | 11 | [XMLHttpRequest.js](https://github.com/facebook/react-native/blob/master/Libraries/Network/XMLHttpRequest.js) 实现 JS 调用的 XMLHttpRequest 12 | 13 | ### fetch 14 | 15 | [whatwg-fetch.js](https://github.com/facebook/react-native/blob/master/Libraries/vendor/core/whatwg-fetch.js#L484) 使用 XMLHttpRequest 实现 fetch 16 | 17 | [fetch.js](https://github.com/facebook/react-native/blob/master/Libraries/Network/fetch.js) 申明 fetch 模块 18 | ```JS 19 | module.exports = {fetch, Headers, Request, Response}; 20 | ``` 21 | 22 | [setUpXHR.js](https://github.com/facebook/react-native/blob/master/Libraries/Core/setUpXHR.js) 把 fetch 注册到 JS 全局环境 23 | ```JS 24 | polyfillGlobal('fetch', () => require('fetch').fetch); 25 | ``` 26 | -------------------------------------------------------------------------------- /react-native/pasteboard.md: -------------------------------------------------------------------------------- 1 | ## Android 2 | 3 | ```java 4 | ClipboardManager clipboard = getClipboardService(); 5 | // 不管粘贴板内容有没有变,内存地址都变化 6 | ClipData clipData = clipboard.getPrimaryClip(); 7 | 8 | // 粘贴板内容复制时间,每次复制都不一样,可以当唯一 ID 9 | // API 26 支持 10 | long timestamp = clipData.getDescription().getTimestamp(); 11 | 12 | ClipData.Item firstItem = clipboard.getPrimaryClip().getItemAt(0); 13 | 14 | // 粘贴板字符串 15 | firstItem.getText() 16 | ``` 17 | 18 | ### References 19 | 20 | * [Copy and Paste](https://developer.android.com/guide/topics/text/copy-paste.html) 21 | * [Android 剪贴板详解](https://github.com/MyLifeMyTravel/AndroidDemo/tree/master/clipboard) 22 | 23 | ## iOS 24 | 25 | 26 | ```objc 27 | // 不管粘贴板内容有没有变,内存地址都不变 28 | UIPasteboard *clipboard = [UIPasteboard generalPasteboard]; 29 | 30 | // 粘贴板字符串 31 | NSString string = clipboard.string; 32 | 33 | // 粘贴板计算,每复制一次次数加1,可以当唯一 ID 34 | NSInteger changeCount = clipboard.changeCount; 35 | ``` 36 | -------------------------------------------------------------------------------- /react-native/pull-to-refresh.md: -------------------------------------------------------------------------------- 1 | # 下拉刷新 2 | 3 | * [React Native 之封装Android 的ViewGroup](http://www.jianshu.com/p/8b8ebfaca343) 4 | -------------------------------------------------------------------------------- /react-native/questions.md: -------------------------------------------------------------------------------- 1 | # 问题 2 | 3 | ## `cannot be cast to com.facebook.react.uimanager.ViewGroupmanager` 4 | 5 | A: 6 | 7 | ViewManager 换成 ViewGroupManager 8 | 9 | ## 调试模式下 `setTimeout` 不会执行 10 | 11 | A:RN Bug 12 | 13 | ## `com.squareup.SocketRocket.NetworkThread (9): EXC_BAD_ACCESS (code=EXC_I386_GPFLT)` 14 | 15 | 参考 16 | 17 | URL 后面加上 `&dev=false` 或者合 18 | -------------------------------------------------------------------------------- /react-native/status-bar.md: -------------------------------------------------------------------------------- 1 | # 修改状态栏 2 | 3 | ## StatusBar 4 | 5 | react native 自带的 StatusBar 设置侵透模式只支持 21 以下 6 | 深色模式只支持 23 以上,而且在 小米上无效 7 | -------------------------------------------------------------------------------- /react-native/upgrade-47.md: -------------------------------------------------------------------------------- 1 | # 升级 react native 到 0.47 遇到的问题 2 | 3 | ```sh 4 | react-native upgrade 5 | ``` 6 | 7 | ## `Command /bin/sh failed with exit code 1` 8 | 9 | 退出重新打开 Xcode 10 | 11 | ## `'boost/iterator/iterator_adaptor.hpp' file not found` 12 | 13 | 参考 14 | 15 | 1. 16 | 17 | 从 下载 `boost_1_63_0.tar.gz` 到 `~/.rncache/boost_1_63_0.tar.gz`,如果存在就替换它 18 | 19 | 2. 20 | 21 | ``` 22 | rm -rf node_modules 23 | ``` 24 | 25 | 3. 26 | 27 | `command + shift + K` 28 | 29 | 4. 30 | 31 | `command + B` 32 | -------------------------------------------------------------------------------- /react-native/usage.md: -------------------------------------------------------------------------------- 1 | # 使用 2 | 3 | ## props 和 state 4 | 5 | props是在父组件中指定,而且一经指定,在被指定的组件的生命周期中则不再改变。 对于需要改变的数据,我们需要使用state。 6 | 7 | ## Modal 8 | 9 | react native 自带的 Modal iOS present 原理:取 Modal 父组件所属的 ViewController present ModalViewController。 10 | -------------------------------------------------------------------------------- /react-native/yoga.md: -------------------------------------------------------------------------------- 1 | # Yoga 布局 2 | 3 | react native 使用 Yoga 实现跨平台布局,Yoga 基于 C,采用了 实现了Flexbox规范 4 | 5 | * [GitHub](https://github.com/facebook/yoga) 6 | -------------------------------------------------------------------------------- /react/antd.md: -------------------------------------------------------------------------------- 1 | # ant-design 2 | 3 | 一套企业级的 UI 设计语言和 React 实现 4 | 5 | * [GitHub](https://github.com/ant-design/ant-design) 6 | * [官方文档](https://ant.design/docs/react/introduce) 7 | * [中文 README](https://github.com/ant-design/ant-design/blob/master/README-zh_CN.md) 8 | * [awesome-ant-design](https://github.com/websemantics/awesome-ant-design) 9 | 10 | ## 安装 11 | 12 | ```sh 13 | npm install --save antd 14 | ``` 15 | -------------------------------------------------------------------------------- /react/create-react-app.md: -------------------------------------------------------------------------------- 1 | # create-react-app 2 | 3 | 创建 React 工程 4 | 5 | * [GitHub](https://github.com/facebookincubator/create-react-app) 6 | 7 | 安装 8 | 9 | ```sh 10 | npm install -g create-react-app 11 | ``` 12 | -------------------------------------------------------------------------------- /react/react-redux.md: -------------------------------------------------------------------------------- 1 | # react-redux 2 | 3 | redux 的 react 实现 4 | 5 | * [GitHub](https://github.com/reactjs/react-redux) 6 | 7 | ## 安装 8 | 9 | ```sh 10 | npm install --save react-redux 11 | ``` 12 | -------------------------------------------------------------------------------- /react/react-router-redux.md: -------------------------------------------------------------------------------- 1 | # react-router-redux 2 | 3 | 保持路由与应用状态(state)同步。 react-router 和 redux 两个库不能协同工作,需要 react-router-redux 协调这两个库 4 | 5 | * [GitHub](https://github.com/reactjs/react-router-redux) 6 | 7 | ## Install 8 | 9 | ```sh 10 | npm install --save react-router-redux 11 | ``` 12 | -------------------------------------------------------------------------------- /react/react-router.md: -------------------------------------------------------------------------------- 1 | # react router 2 | 3 | 管理 React 路由 4 | 5 | * [GitHub](https://github.com/ReactTraining/react-router) 6 | * [docs](https://github.com/ReactTraining/react-router/tree/master/docs) 7 | * [react-router-tutorial](https://github.com/reactjs/react-router-tutorial) 8 | 9 | ## Install 10 | 11 | ```sh 12 | $ npm install --save react-router 13 | ``` 14 | -------------------------------------------------------------------------------- /ruby/Gemfile.md: -------------------------------------------------------------------------------- 1 | # Gemfile 2 | 3 | Gem包依赖文件 4 | 5 | * [官方文档](http://bundler.io/v1.11/gemfile.html) 6 | 7 | ## bundle init 8 | 9 | 生成 Gemfile 10 | 11 | ## bundle install 12 | 13 | 自动去Gemfile中的sources中去下载gem 14 | -------------------------------------------------------------------------------- /ruby/Other.md: -------------------------------------------------------------------------------- 1 | # Other 2 | 3 | ## 教程 4 | 5 | 6 | 7 | ## Gemfile 8 | 9 | `Gemfile`里定义了约束,使用`bundle install`安装 10 | 11 | ## IDE 12 | 13 | [RubyMine](https://www.jetbrains.com/ruby/download/) 14 | 15 | ## Ruby 风格指南 16 | 17 | * [ruby-style-guide](https://github.com/JuanitoFatas/ruby-style-guide/blob/master/README-zhCN.md) Ruby 风格指南 18 | 19 | ### rubocop 20 | 21 | * [rubocop](https://github.com/bbatsov/rubocop) 自动检查你的 Ruby 代码是否符合这份 Ruby 风格指南 22 | 23 | #### 使用 24 | -------------------------------------------------------------------------------- /ruby/bundler.md: -------------------------------------------------------------------------------- 1 | # bundle 管理 gem 包 2 | 3 | 管理 gem 包依赖 4 | 5 | * [bundler官网](http://bundler.io/) 6 | * [官方文档](http://ruby-doc.org/docs/ruby-doc-bundle/) 7 | 8 | ## 安装 bundler 9 | 10 | ```shell 11 | $ gem install bundler 12 | ``` 13 | 14 | ## 初始化`Gemfile` 15 | 16 | ```ruby 17 | $ bundle init 18 | ``` 19 | 20 | 利用 `.gemspec`生成`Gemfile` 21 | 22 | ## 安装依赖包 23 | 24 | ```ruby 25 | $ bundle install 26 | ``` 27 | 28 | 根据`Gemfile`安装依赖包 29 | 30 | ## 创建 rubygem 31 | 32 | ```ruby 33 | $ bundle gem my_gem 34 | ``` 35 | 36 | 查看帮助: 37 | 38 | ```ruby 39 | $ bundle help gem 40 | ``` 41 | 42 | ## 编译 gem 43 | 44 | ```ruby 45 | $ gem build my_gem.gemspec 46 | ``` 47 | 48 | ## 发布到 rubygems 49 | 50 | 51 | 52 | ```ruby 53 | $ gem push my_gem-0.1.0.gem 54 | ``` 55 | 56 | * [详细使用](http://bundler.io/rubygems.html) 57 | 58 | ### Reference 59 | 60 | * 61 | -------------------------------------------------------------------------------- /ruby/gem.md: -------------------------------------------------------------------------------- 1 | # gem 2 | 3 | ## 安装 4 | 5 | 6 | 7 | ## 源 8 | 9 | * 官方 10 | * 淘宝 11 | * Ruby China 12 | 13 | 最近淘宝源一直没更新。。。建议切换到`Ruby China` 14 | 15 | ```shell 16 | $ gem sources -a https://gems.ruby-china.org/ -r https://ruby.taobao.org/ 17 | $ gem sources -u 18 | ``` 19 | 20 | 换回官方源 21 | 22 | ```shell 23 | $ gem sources -a https://rubygems.org/ -r https://ruby.taobao.org/ 24 | $ gem sources -u 25 | ``` 26 | 27 | 28 | ## gem install 29 | 30 | 安装指定版本 31 | 32 | ``` 33 | gem install -v 34 | ``` 35 | -------------------------------------------------------------------------------- /ruby/gets.md: -------------------------------------------------------------------------------- 1 | # gets 获取输入 2 | 3 | ## Ruby中gets和gets.chomp() 4 | 5 | gets和gets.chomp()都表示读入用户的输入并用于输出,但两者还是有所不同,其中gets是得到的内容后,在输出时后面接着换行;而gets.chmop()得到的内容输出时后面不带空格和换行。 6 | 7 | 例如: 8 | 9 | ```ruby 10 | print "How old are you? " # input 29yrs 11 | age = gets.chomp() 12 | print "How tall are you? " # input 168cm 13 | height = gets.chomp() 14 | print "How much do you weigh? " # input 62kg 15 | weight = gets 16 | puts "So, you're #{age} old, #{height} tall and #{weight} heavy." 17 | ``` 18 | 19 | 运行结果: 20 | 21 | ```ruby 22 | So, you're 29yrs old, 168cm tall and 62kg 23 | heavy. 24 | ``` 25 | 26 | ## GetoptLong 27 | -------------------------------------------------------------------------------- /rust/README.md: -------------------------------------------------------------------------------- 1 | # Rust 2 | 3 | ## rustup 4 | 5 | 安装 rustup 6 | 7 | ```shell 8 | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh 9 | ``` 10 | 11 | 卸载 rustup 12 | 13 | ```shell 14 | rustup self uninstall 15 | ``` 16 | 17 | ## cargo 18 | 19 | cargo 配置 20 | 21 | ```shell 22 | vim ~/.cargo/config 23 | ``` 24 | 25 | ```text 26 | [source.crates-io] 27 | registry = "https://github.com/rust-lang/crates.io-index" 28 | replace-with = 'tuna' 29 | 30 | [source.tuna] 31 | registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git" 32 | 33 | [source.ustc] 34 | registry = "https://mirrors.ustc.edu.cn/crates.io-index" 35 | 36 | [source.rsproxy] 37 | registry = "https://rsproxy.cn/crates.io-index" 38 | 39 | [net] 40 | git-fetch-with-cli = true 41 | 42 | [env] 43 | RUST_MIN_STACK="8388608" 44 | ``` 45 | -------------------------------------------------------------------------------- /rust/rust-cli.md: -------------------------------------------------------------------------------- 1 | # Rust 命令行工具 2 | 3 | 使用 clap 工具读取输入参数 4 | 5 | ## References 6 | 7 | - [Command Line Applications in Rust](https://rust-cli.github.io/book/index.html) 8 | - [Crate clap](https://docs.rs/clap/latest/clap/) 9 | -------------------------------------------------------------------------------- /scripts/README.md: -------------------------------------------------------------------------------- 1 | # 自动发布脚本 2 | 3 | ## push.sh 4 | 5 | 生成 gitbook 目录 SUMMARY.md 和 GitHub 首页 README.md,再把所有修改提交到 GitHub 6 | 7 | ## dependences.sh 8 | 9 | 安装发布需要的依赖 10 | 11 | ## build.sh 12 | 13 | markdown 文件编译成 html 文件,并存储到 `_book` 目录 14 | 15 | ## deploy.sh 16 | 17 | 把编译好的 html 文件,上传到 gh-pages 分支 18 | 19 | ## publish.sh 20 | 21 | 执行 `build.sh` 和 `deploy.sh` 并删除临时文件。 22 | 23 | ## push-docs.sh 24 | 25 | 编译生成静态资源、上传静态资源到 docs 目录 26 | -------------------------------------------------------------------------------- /scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #Auth: bell@greedlab.com 3 | # 4 | # 编译 markdown 文件,生成 _book 5 | # 6 | 7 | # 当前目录 8 | CURRENT_DIR=${PWD} 9 | 10 | # 脚本所在目录 11 | SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd) 12 | 13 | ## blog 目录 14 | BLOG_DIRECTORY=${SCRIPT_DIR}/.. 15 | 16 | cp ${BLOG_DIRECTORY}/README.md ${BLOG_DIRECTORY}/README-BACK.md 17 | cp ${BLOG_DIRECTORY}/SUMMARY.md ${BLOG_DIRECTORY}/README.md 18 | 19 | rm -rf ${BLOG_DIRECTORY}/_book 20 | 21 | cd ${BLOG_DIRECTORY} 22 | echo "building..." 23 | gitbook build 24 | 25 | mv ${BLOG_DIRECTORY}/README-BACK.md ${BLOG_DIRECTORY}/README.md 26 | 27 | cd ${CURRENT_DIR} 28 | -------------------------------------------------------------------------------- /scripts/dependences.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #Auth: bell@greedlab.com 3 | # 4 | # Installing Dependencies 5 | # 6 | 7 | # 当前目录 8 | CURRENT_DIR=${PWD} 9 | 10 | # 脚本所在目录 11 | SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd) 12 | 13 | # 进入工程根目录 14 | cd ${SCRIPT_DIR}/.. 15 | 16 | hash gitbook || ( npm install -g gitbook-cli ) 17 | hash greed-summary || ( gem install greed-summary ) 18 | 19 | # npm install 20 | gitbook install 21 | 22 | cd ${CURRENT_DIR} 23 | -------------------------------------------------------------------------------- /scripts/publish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #Auth: bell@greedlab.com 3 | # 4 | # build.sh and deploy.sh 5 | # 6 | 7 | # 当前目录 8 | CURRENT_DIR=${PWD} 9 | 10 | # 脚本所在目录 11 | SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd) 12 | 13 | ## blog 目录 14 | BLOG_DIRECTORY=${SCRIPT_DIR}/.. 15 | 16 | cd ${BLOG_DIRECTORY} 17 | 18 | # 更新 19 | git add . --all 20 | git reset --hard 21 | git pull --rebase 22 | 23 | bash ${SCRIPT_DIR}/build.sh 24 | bash ${SCRIPT_DIR}/deploy.sh 25 | 26 | cd ${CURRENT_DIR} 27 | -------------------------------------------------------------------------------- /scripts/push.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #Auth: bell@greedlab.com 3 | # 4 | # push to github 5 | # 6 | 7 | # 当前目录 8 | CURRENT_DIR=${PWD} 9 | 10 | # 脚本所在目录 11 | SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd) 12 | 13 | ## blog 目录 14 | BLOG_DIRECTORY=${SCRIPT_DIR}/.. 15 | 16 | cd ${BLOG_DIRECTORY} 17 | 18 | greed-summary -t "Bell's Blog" -i '[scripts,resource,Resource,Publish,_book,docs,node_modules,assets]' -d ${BLOG_DIRECTORY}/ -o ${BLOG_DIRECTORY}/README.md -S github -a 19 | greed-summary -t "Bell's Blog" -i '[scripts,resource,Resource,Publish,_book,docs,node_modules,assets]' -d ${BLOG_DIRECTORY}/ -o ${BLOG_DIRECTORY}/SUMMARY.md -S gitbook -a 20 | 21 | # git push 22 | git fetch origin master 23 | git merge origin/master 24 | git add . --all 25 | git commit -a -m "update" 26 | git push origin master 27 | 28 | cd ${CURRENT_DIR} 29 | -------------------------------------------------------------------------------- /shell/README.md: -------------------------------------------------------------------------------- 1 | # Shell 2 | 3 | * [Shell 教程](http://www.runoob.com/linux/linux-shell.html) 4 | * [Bash Reference Manual](http://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html) 5 | 6 | ## bc 7 | 8 | 命令行计算器 9 | -------------------------------------------------------------------------------- /shell/exit.md: -------------------------------------------------------------------------------- 1 | # exit 2 | 3 | * 0表示成功(Zero - Success) 4 | * 非0表示失败(Non-Zero - Failure) 5 | * 2表示用法不当(Incorrect Usage) 6 | * 127表示命令没有找到(Command Not Found) 7 | * 126表示不是可执行的(Not an executable) 8 | * >=128 信号产生 9 | 10 | ## 相关资料 11 | 12 | * 13 | -------------------------------------------------------------------------------- /shell/mail.md: -------------------------------------------------------------------------------- 1 | # mail命令使用 2 | 3 | 可以发送或查看邮件 4 | 5 | ## 发送邮件 6 | 7 | ### 发送给系统用户 8 | 9 | ```shell 10 | $ echo "content" | mail -s "subject" user 11 | ``` 12 | 13 | 或 14 | 15 | ```shell 16 | $ mail -s "subject" user < content.file 17 | ``` 18 | 19 | ### 发送给指定`email` 20 | 21 | > NON 22 | 23 | ## 查看收件箱 24 | 25 | > 运行`mail`进入`mail`命令行 26 | 27 | ### help 28 | 29 | > 查看`mail`命令行下的帮助 30 | 31 | ### h 32 | 33 | > 列出未读邮件列表 34 | 35 | `>` 表示当前所在的邮件。`U`表示未读 36 | 37 | ### t 38 | 39 | > 查看当前邮件 40 | 41 | ### n 42 | 43 | > 查看下一封邮件 44 | 45 | ### d 46 | 47 | > `d`删除当前邮件 48 | > `d2`删除第二封邮件 49 | > `d 1-100` 删除第1到100封邮件 50 | 51 | ### q 52 | 53 | > 保存操作并退出 54 | 55 | ### x 56 | 57 | > 不保存操作并退出 58 | -------------------------------------------------------------------------------- /shell/operator.md: -------------------------------------------------------------------------------- 1 | # 运算符的使用方法 2 | 3 | ## &&运算符 4 | 5 | ``` 6 | command1 && command2 7 | ``` 8 | 9 | command1执行成功后执行command2 10 | 11 | ## ||运算符 12 | 13 | ``` 14 | command1 || command2 15 | ``` 16 | 17 | command1执行失败后执行command2 18 | 19 | ## 相关资料 20 | 21 | * 22 | -------------------------------------------------------------------------------- /shell/other.md: -------------------------------------------------------------------------------- 1 | # 杂七杂八 2 | 3 | ## 脚本当前目录 4 | 5 | ```shell 6 | $(cd "$(dirname "$0")"; pwd) 7 | ``` 8 | 9 | ## find 10 | 11 | ### 查看当前目录下除了Pods和Example的所有.h .m文件 12 | 13 | ``` 14 | $ find . -name *.[h,m] ! -path "./Pods/*" ! -path "./Example/*" 15 | ``` 16 | 17 | ### 配合egrep 18 | 19 | ``` 20 | KEYWORDS="TODO|FIXME|\?\?\?:|\!\!\!:" 21 | find . -name *.[h,m] ! -path "./Pods/*" ! -path "./Example/*" | xargs egrep --with-filename --line-number --only-matching ${KEYWORDS} 22 | ``` 23 | 24 | ## 判断是不是整数 25 | 26 | 27 | 28 | ## sed 29 | 30 | * [sed 简明教程](https://coolshell.cn/articles/9104.html) 31 | 32 | ## awk 33 | -------------------------------------------------------------------------------- /shell/parameters.md: -------------------------------------------------------------------------------- 1 | # shell命令行传入参数处理 2 | 3 | ## getopt 4 | 5 | * 独立的可执行文件 6 | * 功能复杂 7 | 8 | ## getopts 9 | 10 | * getopts是由bash内置的 11 | * 功能简单 12 | 13 | ## 相关资料 14 | 15 | * 16 | -------------------------------------------------------------------------------- /shell/stat.md: -------------------------------------------------------------------------------- 1 | # stat 查看文件信息 2 | 3 | ## 查看信息 4 | 5 | ## 查看简单信息 6 | 7 | ```shell 8 | $ stat 9 | ``` 10 | 11 | ## 查看详细信息 12 | 13 | ```shell 14 | $ stat -x 15 | ``` 16 | 17 | ## 查看最后修改(Modify)时间 18 | 19 | ```shell 20 | $ stat -t %D-%T |awk '{print $10}' 21 | ``` 22 | -------------------------------------------------------------------------------- /shell/vi.md: -------------------------------------------------------------------------------- 1 | # vi 2 | 3 | ## 字符串替换 4 | 5 | ### 替换第一个 6 | 7 | :%s#origin#new# 8 | 9 | ### 替换全局 10 | 11 | :%s#origin#new#g 12 | 13 | :%s#WFT-social#WFT-pay#g 14 | 15 | 16 | :%s#http://de.isrv.us/deyi_ios#http://wftgit.greedlab.com:10080/wft-ios#g 17 | -------------------------------------------------------------------------------- /technology/Ajax.md: -------------------------------------------------------------------------------- 1 | # Ajax 2 | 3 | ## 缺点 4 | 5 | 移动端下的白屏 6 | 7 | ## SEO 8 | 9 | * 蜘蛛只能抓取a标签中的href 10 | * 蜘蛛不会执行JavaScript 11 | * 蜘蛛只能抓到get请求的页面 不会抓到post请求的页面 12 | 13 | SEO 现在解决方案已经很多了,所以基本不是什么问题,基本上就是检测如果当爬虫来的时候url会被改变,然后nginx给转到另外一个静态生成的页面那里去。所以不会太大问题吧 14 | 15 | ## 跨域 16 | 17 | JSONP 或者 CORS 实现, 18 | 19 | ## 带Cookie的跨域Ajax请求 20 | 21 | ### 客户端 22 | 23 | ``` 24 | $.ajax({ 25 | url : 'http://remote.domain.com/corsrequest', 26 | data : data, 27 | dataType: 'json', 28 | type : 'POST', 29 | xhrFields: { 30 | withCredentials: true 31 | }, 32 | crossDomain: true, 33 | contentType: "application/json", 34 | ... 35 | ``` 36 | 37 | 通过设置 withCredentials: true ,发送Ajax时,Request header中便会带上 Cookie 信息。 38 | 39 | ### 服务端 40 | 41 | ``` 42 | app.use(cors({credentials: true})); 43 | ``` 44 | 45 | Access-Control-Allow-Credentials 设为 true 46 | 47 | ### Reference 48 | 49 | * [鱼和熊掌兼得--既实现AJAX又实现SEO](http://blog.csdn.net/popping_dancer/article/details/8551707) 50 | -------------------------------------------------------------------------------- /technology/README.md: -------------------------------------------------------------------------------- 1 | # 技术 2 | 3 | 4 | ## node 5 | 6 | 7 | 8 | ## reference 9 | 10 | * [淘宝UED-midway](http://ued.taobao.org/blog/category/bowen/frontend/) 11 | * 12 | * [RESTful API 设计指南](http://www.ruanyifeng.com/blog/2014/05/restful_api.html) 13 | -------------------------------------------------------------------------------- /technology/algorithm.md: -------------------------------------------------------------------------------- 1 | # 算法 2 | 3 | ## 书籍 4 | 5 | * 《算法》 6 | * 《算法导论》 7 | -------------------------------------------------------------------------------- /technology/api-doc.md: -------------------------------------------------------------------------------- 1 | # API 文档 2 | 3 | * [RAP](https://github.com/thx/RAP) 文档只有请求参数和返回数据 4 | * [Mock](https://github.com/nuysoft/Mock) 5 | * [api-blueprint](https://github.com/apiaryio/api-blueprint) 6 | -------------------------------------------------------------------------------- /technology/auto-generate-summary.md: -------------------------------------------------------------------------------- 1 | # 自动生成 SUMMARY.md 2 | 3 | 4 | ## greed-summary 5 | 6 | * 7 | 8 | ### 安装 9 | 10 | ```shell 11 | $ gem install greed-summary 12 | ``` 13 | 14 | ### 使用 15 | 16 | ```shell 17 | $ greed-summary 18 | ``` 19 | 20 | ## gitbook-summary 21 | 22 | * 23 | 24 | ### 安装 25 | 26 | ```shell 27 | npm install -g gitbook-summary 28 | ``` 29 | 30 | ### 使用 31 | 32 | ```shell 33 | $ book sm g 34 | ``` 35 | -------------------------------------------------------------------------------- /technology/compile.md: -------------------------------------------------------------------------------- 1 | # C 编译器的工作过程 2 | 3 | * [编译器的工作过程](http://www.ruanyifeng.com/blog/2014/11/compiler.html) 4 | 5 | ``` 6 | 配置(configure)> 编译(Compilation) > 连接(Linking) 7 | ``` 8 | 9 | ## 编译 10 | 11 | 源码转成二进制的机器码,生成后缀名为.lib和.a的文件 12 | 13 | ## 连接 14 | 15 | 把外部函数的代码(通常是后缀名为.lib和.a的文件),添加到可执行文件中 16 | 17 | ### 静态连接(static linking) 18 | 19 | 把外部函数库,拷贝到可执行文件中 20 | 21 | ### 动态连接(dynamic linking) 22 | 23 | 外部函数库不进入安装包 24 | 25 | * Linux平台是后缀名为.so的文件 26 | * Windows平台是.dll文件 27 | * Mac平台是.dylib文件 28 | -------------------------------------------------------------------------------- /technology/cookie.md: -------------------------------------------------------------------------------- 1 | # cookie 2 | 3 | * [HTTP cookies](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Cookies) 4 | * [Document.cookie](https://developer.mozilla.org/zh-CN/docs/Web/API/Document/cookie) 5 | 6 | ## Questions 7 | 8 | Q1:本地前端调试远程接口,跨域无法读 cookie 9 | 10 | > `/etc/hosts` 添加与接口地址顶级域名相同的二级域名对应 `127.0.0.1`,接口 `cookie` `domain` 设为 `.<顶级域名>` 11 | -------------------------------------------------------------------------------- /technology/cors.md: -------------------------------------------------------------------------------- 1 | # CORS 2 | 3 | * [跨域资源共享 CORS 详解](http://www.ruanyifeng.com/blog/2016/04/cors.html) 4 | 5 | ## 问题 6 | 7 | Q1: 如何实现多域名跨域 8 | 9 | * `Access-Control-Allow-Origin` 只能有一个值,`*` 或者无通配符域名 10 | * `Access-Control-Allow-Origin` 为 `*` 时 `Access-Control-Allow-Credentials` 只能为 `false` 不能带 cookie 11 | 12 | > 如果请求的 `origin` 允许访问,把 `Access-Control-Allow-Origin` 设为该 `origin` 13 | -------------------------------------------------------------------------------- /technology/cross-origin.md: -------------------------------------------------------------------------------- 1 | # 跨域 2 | 3 | 同源策略, 即JavaScript或Cookie只能访问同域下的内容 4 | 5 | ## 解决跨域方法 6 | 7 | ### JSONP 8 | 9 | Jsonp(JSON with Padding) 是 json 的一种"使用模式",可以让网页从别的域名(网站)那获取资料,即跨域读取数据。 10 | 11 | #### 缺点 12 | 13 | 只能是get形式,承载的信息量有限 14 | 15 | ### CORS 16 | 17 | 跨域资源共享,Cross-Origin Resource Sharing 18 | 19 | * [HTTP访问控制(CORS)](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Access_control_CORS) 20 | 21 | #### 缺点 22 | 23 | 老版本浏览器不支持 24 | 25 | #### node.js 实现 26 | 27 | * [cors](https://github.com/expressjs/cors) 28 | * [koa-cors](https://github.com/evert0n/koa-cors) 29 | -------------------------------------------------------------------------------- /technology/design-patterns.md: -------------------------------------------------------------------------------- 1 | # 设计模式 2 | 3 | * [设计模式:可复用面向对象软件的基础](https://zh.wikipedia.org/wiki/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F%EF%BC%9A%E5%8F%AF%E5%A4%8D%E7%94%A8%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E8%BD%AF%E4%BB%B6%E7%9A%84%E5%9F%BA%E7%A1%80) 4 | -------------------------------------------------------------------------------- /technology/float.md: -------------------------------------------------------------------------------- 1 | # 符点精度问题 2 | 3 | * [IEEE 754](https://zh.wikipedia.org/wiki/IEEE_754) 4 | * [浮点数的二进制表示](http://www.ruanyifeng.com/blog/2010/06/ieee_floating-point_representation.html) 5 | 6 | 负数: 补码 = 反码 + 1 7 | 8 | 小数十进制转二进制: 乘二取整 9 | -------------------------------------------------------------------------------- /technology/incremental-update.md: -------------------------------------------------------------------------------- 1 | # 增量更新方案 2 | 3 | 通过最后修改时间dateline来判断是否已更新。如果有更新就重新获取 4 | 5 | ## 服务端如何获取dateline 6 | 7 | 所有表添加最后修改时间字段dateline,每次修改或添加项的时候都要对dateline写入最后修改时间。如果有关联表,获取id的dateline的时候取表及需要的关联表dateline的最大值。 8 | 9 | ## 获取列表 10 | 11 | ### 列表里的数据不可删除且不可修改 12 | 13 | 每项加个dateline,客户端请求的时候带上最新的dateline,服务端返回dateline之后新增加的项 14 | 15 | ### 列表里的数据可变 16 | 17 | 客户端需要两张表,一张只有id和dateline的列表表(listTable),当然也可以包含title等简单字段在未加载详情时展示用。另一张包含所有数据的详情表(listDetailTable)。先从服务器获取列表里所有项的id和dateline并存储在listTable,这里不做增量。然后对listTable每一项和listDetailTable对比,如果listDetailTable中没有listTable中id对应的项或者dateline不一致就获取对应id的详情并存储到listDetailTable,否则不做任何处理。这样做有个明显的缺点,就是请求次数过多。可以修改下获取数据详情的接口,客户端带上多个id,服务端返回多个id的详情。 18 | 19 | ## 获取详情 20 | 21 | 客户端有张详情表(detailTable),包含id和dateline在内的所有数据。获取id对应详情的时候,客户端先通过id和dateline向服务器请求数据,服务端对比dateline,如果不一致就返回所有数据,否则则返回一个标致位表示没有更新。 22 | 23 | 24 | ## 相关资料 25 | 26 | * 27 | 28 | ## GreedLab原创 29 | -------------------------------------------------------------------------------- /technology/json.md: -------------------------------------------------------------------------------- 1 | # JSON 2 | 3 | * [Introducing JSON](http://json.org/) 4 | -------------------------------------------------------------------------------- /technology/programming-ideas.md: -------------------------------------------------------------------------------- 1 | # 编程思想 2 | 3 | ## 编程思想 4 | 5 | ### 面向过程 6 | ### 面向对象 7 | ### 链式编程思想 8 | ### 响应式编程思想 9 | ### 函数式编程思想 10 | 11 | ## Redux 12 | 13 | ### Actions 14 | 15 | 操作 16 | 17 | ### Reducers 18 | 19 | 处理 20 | 21 | ### store 22 | 23 | 存储 24 | 25 | ## References 26 | 27 | * [最快让你上手ReactiveCocoa之基础篇](https://www.jianshu.com/p/87ef6720a096) 28 | -------------------------------------------------------------------------------- /technology/resource/人月神话.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greedbell/blog/20e19572eaece27174f718ef4bdf62b48050bd26/technology/resource/人月神话.pdf -------------------------------------------------------------------------------- /technology/upload-file.md: -------------------------------------------------------------------------------- 1 | # 上传文件 2 | 3 | Multipart/form-data POST文件上传 4 | 5 | * [rfc2388](https://tools.ietf.org/html/rfc2388) 6 | 7 | ## curl 上传文件 8 | 9 | * 参考 10 | * 参考 `$ man curl` 11 | 12 | 如果使用了-F参数,curl就会以 multipart/form-data 的方式发送POST请求。 13 | 14 | -F key=@file 上传文件。key=value 上传字符串 15 | 16 | ``` 17 | curl -F 'file=@"localfile";filename="nameinpost"' url.com 18 | ``` 19 | 20 | ## node.js 上传文件服务 21 | 22 | * [multer 23 | ](https://github.com/expressjs/multer) 24 | * [koa-multer](https://github.com/koa-modules/multer) 25 | 26 | ## ajax 上传文件 27 | 28 | * 参考 29 | * [使用FormData对象](https://developer.mozilla.org/zh-CN/docs/Web/Guide/Using_FormData_Objects) 30 | -------------------------------------------------------------------------------- /technology/web_proxy.md: -------------------------------------------------------------------------------- 1 | # web proxy 2 | 3 | ## Glype 4 | 5 | ### 下载地址 6 | 7 | 8 | 9 | ## php-proxy-app 10 | 11 | 12 | 13 | ### 安装 14 | 15 | #### 安装`composer` 16 | 17 | 18 | 19 | ``` 20 | curl -sS https://getcomposer.org/installer | php 21 | ``` 22 | 23 | #### 安装`php-proxy-app` 24 | 25 | ``` 26 | composer create-project athlon1600/php-proxy-app:dev-master www/php-proxy-app 27 | ``` 28 | -------------------------------------------------------------------------------- /ue/Axure.md: -------------------------------------------------------------------------------- 1 | # Axure 2 | 3 | * [官网](https://www.axure.com/) 4 | * [官方下载](https://www.axure.com/download) 5 | 6 | ## 安装 7 | 8 | ### 注册证书 9 | 10 | Help > Manage Licenese > license key: 11 | 12 | * License: `axureuser` 13 | * Key: `8wFfIX7a8hHq6yAy6T8zCz5R0NBKeVxo9IKu+kgKh79FL6IyPD6lK7G6+tqEV4LG` 14 | 15 | ## 学习 16 | 17 | * [原版](http://www.axure.com/support) 18 | * [中文翻译版](http://www.webppd.com/thread-9347-1-1.html) 19 | 20 | ### Hot Spot 21 | 22 | 热区,可以在任何区域加链接。 23 | 24 | ### Dynamic Panel 25 | 26 | 动态面板 27 | 28 | ### Team 29 | 30 | 1. svn co 31 | 2. Team > Create Team *** > 输入 > create 32 | -------------------------------------------------------------------------------- /ue/adobe-bridge.md: -------------------------------------------------------------------------------- 1 | # Adobe bridge 2 | 3 | * [Help](https://helpx.adobe.com/cn/bridge/using/adobe-bridge.html) 4 | -------------------------------------------------------------------------------- /ue/axure-libraries.md: -------------------------------------------------------------------------------- 1 | # Axure 库 2 | 3 | * [官方库](http://www.axure.com/support/download-widget-libraries) 4 | 5 | ## 免费 6 | 7 | * 8 | * [最新iOS8Axure部件库下载含iPhone6/iPhone6 Plus/iPad等机身部件库](http://www.axure.com.cn/2217/) 9 | -------------------------------------------------------------------------------- /ue/axure-team-svn.md: -------------------------------------------------------------------------------- 1 | # Axure SVN 协作 2 | 3 | * 参考 [CREATING AND USING TEAM PROJECTS](https://www.axure.com/support/reference/team-projects) 4 | 5 | 假使 SVN 地址为 svn://server/prd . 工程名为 name 6 | 7 | ## 创建 SVN 工程 8 | 9 | Team > Create Team Project from Current File... > SVN > Team Directory:svn://server/prd,Team Project Name: name > Create 10 | 11 | 之后就可以与 SVN 同步。 12 | 13 | ## 从 SVN 获取工程 14 | 15 | 创建 SVN 工程后,其它成员,需要从对应的 SVN 地址获取工程 16 | 17 | Team > Get and Open Team Project... > SVN > Team Directory:svn://server/prd/name > Get 18 | 19 | **注意** Team Directory = svn 地址 + 工程名 20 | 21 | 之后就可以与 SVN 同步。 22 | -------------------------------------------------------------------------------- /ue/icon-resource.md: -------------------------------------------------------------------------------- 1 | # 图标资源 2 | 3 | ## [iconfont](http://www.iconfont.cn/) 4 | 5 | ### 优点 6 | 7 | 免费,可下载 源文件 8 | 9 | ### 缺点 10 | 11 | 资源少 12 | 13 | ## [icons8](https://icons8.com/) 14 | 15 | ### 优点 16 | 17 | 资源丰富 18 | 19 | ### 缺点 20 | 21 | 源文件收费,免费 22 | 23 | ## [freebiesbug](http://freebiesbug.com/) 24 | -------------------------------------------------------------------------------- /ue/photoshop-variable.md: -------------------------------------------------------------------------------- 1 | # Photoshop 加变量 2 | 3 | * [Prisma](http://www.codeadventure.com/) 4 | * [Ditto](https://casualnotebook.com/ditto) 5 | -------------------------------------------------------------------------------- /ue/photoshop.md: -------------------------------------------------------------------------------- 1 | # photoshop 2 | 3 | ## 安装 4 | 5 | 下载 Creative Cloud 安装 photoshop 6 | * [Mac/Win版:Adobe CC 2017 软件下载(中文/英文版)补丁破解 Adobe Creative Cloud 2017](http://www.lookae.com/cc2017/) 下载破解补丁 7 | 8 | ## 切图 9 | 10 | * [从图层生成图像资源](https://helpx.adobe.com/cn/photoshop/using/generate-assets-layers.html) 11 | * [当下最省心省力优雅大气的切图工具或插件是什么?](https://www.zhihu.com/question/24092846) 12 | -------------------------------------------------------------------------------- /ue/sketch.md: -------------------------------------------------------------------------------- 1 | # Sketch 2 | 3 | * 下载地址: , 密码: ii3v 4 | * 打开密码 `www.ifunmac.com` 5 | -------------------------------------------------------------------------------- /ue/tools.md: -------------------------------------------------------------------------------- 1 | # 工具选择 2 | 3 | ## sketch 4 | 5 | 6 | 7 | 设计原型图,比ps简单易用 8 | 9 | ## Zeplin 10 | 11 | sketch插件,可以动态显示字号、颜色、尺寸、间距等参数 12 | 13 | ## Markman 14 | 15 | 尺寸标工具 16 | 17 | ## Axsure 18 | 19 | 原型设计 20 | 21 | ## Origami 22 | 23 | 交互设计工具 基于 `Quartz Composer` 24 | 25 | ## marvelapp 26 | 27 | 28 | ## 标你妹 29 | 30 | 31 | 32 | 根据PSD文件,自动标注 33 | 34 | ## PxCook 35 | 36 | 37 | 38 | ## 切图 39 | 40 | 41 | 42 | # End 43 | 44 | 产品策划(Axure) 和 UI设计(Sketch) 45 | 46 | Sketch 很好用啊,所以我的做法是 Sketch 画图,然后贴在 Axure 上 47 | -------------------------------------------------------------------------------- /ue/zeplin.md: -------------------------------------------------------------------------------- 1 | # zeplin 2 | 3 | ## 开启 React Native 插件 4 | 5 | ``` 6 | 选择一个 Project > DashBoard > 点击右上角的 Extensions > 勾上 React Native by Zeplin 7 | ``` 8 | 9 | 10 | 开启后,点击元素,可以在右下角看到 RN 格式的样式。 11 | 12 | ## 下载图标资源 13 |  14 | 打开一个页面 > 右侧菜单选择第三个 assets > 可以下载图标资源 15 | -------------------------------------------------------------------------------- /util/Gnuplot.md: -------------------------------------------------------------------------------- 1 | # Gnuplot 2 | 3 | 行的交互式绘图工具,画2维3维图 4 | 5 | * 官网 6 | * 文档 7 | 8 | ## 安装 9 | 10 | ```shell 11 | $ brew install gnuplot 12 | ``` 13 | 14 | ## Atom插件 15 | 16 | * `language-gnuplot-atom` 语法高亮 17 | * `Script` 执行脚本 18 | 19 | 文件后缀名用`.plt`,这样两个插件都支持 20 | 21 | ## 22 | -------------------------------------------------------------------------------- /util/Resource/gnuplot.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greedbell/blog/20e19572eaece27174f718ef4bdf62b48050bd26/util/Resource/gnuplot.pdf -------------------------------------------------------------------------------- /util/Resource/test.dot: -------------------------------------------------------------------------------- 1 | digraph structs { 2 | label="code struct"; 3 | rankdir=LR; 4 | subgraph cluster0 { 5 | node [style=filled,color=white]; 6 | style=filled; 7 | color=lightgrey; 8 | label = "商品"; 9 | } 10 | subgraph cluster1 { 11 | node [style=filled,color=white]; 12 | style=filled; 13 | color=lightgrey; 14 | label="活动"; 15 | play_a -> play_b; 16 | } 17 | 18 | main [label="主入口"]; 19 | main -> goods_a; 20 | main -> play_a; 21 | } 22 | -------------------------------------------------------------------------------- /util/Resource/test.mmd: -------------------------------------------------------------------------------- 1 | graph TD; 2 | A-->B; 3 | A-->C; 4 | B-->D; 5 | C-->D; 6 | -------------------------------------------------------------------------------- /util/Resource/test.plt: -------------------------------------------------------------------------------- 1 | set terminal png transparent nocrop enhanced size 450,320 font "arial,8" 2 | set output 'test.png' 3 | set key inside left top vertical Right noreverse enhanced autotitle box lt black linewidth 1.000 dashtype solid 4 | set samples 50, 50 5 | set title "Simple Plots" 6 | set title font ",20" norotate 7 | plot [-10:10] sin(x),atan(x),cos(atan(x)) 8 | -------------------------------------------------------------------------------- /util/Resource/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greedbell/blog/20e19572eaece27174f718ef4bdf62b48050bd26/util/Resource/test.png -------------------------------------------------------------------------------- /util/arcanist.md: -------------------------------------------------------------------------------- 1 | # arcanist 2 | 3 | * arc 全称是 arcanist,百度给出的中文翻译是:巧匠。 4 | * arc 是Facebook的Phabricator系统中用户端的命令行工具,配合pha提交变更评审的。 5 | 6 | ## 使用 7 | 8 | ```sh 9 | # 切换要开发的分支 10 | git checkout develop 11 | # 创建临时分支 12 | git checkout -b temp-branch 13 | # 修改代码 14 | git add . --all 15 | git commit -m "commit log" 16 | # 创建 revision,等待 review 17 | arc diff develop 18 | # 如果有问题重新修改再 commit, arc diff 19 | # acceped 之后上传代码 20 | arc land --onto develop 21 | 22 | # if 有冲突 23 | git checkout develop 24 | git pull origin develop 25 | git checkout dev-android 26 | git rebase develop 27 | git status 28 | # 如果有冲突,处理冲突 29 | git mergetool --tool=opendiff 30 | git rebase --continue 31 | # 提交代码,并删除临时分支 32 | arc land --onto develop 33 | ``` 34 | 35 | ## References 36 | 37 | * [git与phabricator](http://www.jianshu.com/p/e8d520f65916) 38 | * [Arcanist User Guide](https://secure.phabricator.com/book/phabricator/article/arcanist/) 39 | * [GitHub](https://github.com/phacility/arcanist) 40 | -------------------------------------------------------------------------------- /util/asciiflow.md: -------------------------------------------------------------------------------- 1 | # asciiflow 2 | 3 | 在线可视化纯文本流程图绘制,中文支持不友好 4 | 5 | ## References 6 | 7 | * [jprichardson/asciiflow](https://github.com/jprichardson/asciiflow) 8 | * [lewish/asciiflow2](https://github.com/lewish/asciiflow2) 9 | * [asciiflow.com](http://asciiflow.com/) 10 | * [asciiflow 中文支持](https://blog.csdn.net/LDS20090241162/article/details/78870217) 11 | -------------------------------------------------------------------------------- /util/crypto.md: -------------------------------------------------------------------------------- 1 | # 加密解密 2 | 3 | * [在线加解密工具](www.seacha.com/tools/) 4 | -------------------------------------------------------------------------------- /util/fabric.md: -------------------------------------------------------------------------------- 1 | # fabric 2 | 3 | 工具集 4 | 5 | * [官网](https://get.fabric.io) 6 | * [官方文档](https://docs.fabric.io/) 7 | 8 | ## digits 短信验证 9 | 10 | * [Digits](https://fabric.io/kits/ios/digits/summary) 11 | 12 | ## Crashlytics 崩溃统计 13 | 14 | * [文档](https://docs.fabric.io/apple/crashlytics/overview.html) 15 | 16 | ### 自定义日志 17 | 18 | 崩溃的时候可以看到自定义的日志 19 | 20 | #### iOS 21 | 22 | 参考 [Custom Logs](https://docs.fabric.io/apple/crashlytics/enhanced-reports.html?highlight=cls_log#custom-logs) 23 | 24 | * `Objective-C` 用 `CLS_LOG` 25 | * `Swift` 用 `CLSLogv` 26 | 27 | #### Android 28 | 29 | 参考 [Custom Logging](https://docs.fabric.io/android/crashlytics/enhanced-reports.html#custom-logging) 30 | 31 | * `Crashlytics.log(msg)` 32 | * `Crashlytics.log(int priority, String tag, String msg);` 33 | 34 | ## retention 留存率 35 | 36 | * DAU (Daily Active Users) 日活用户 37 | * WAU (Week Active Users) 周活用户 38 | * MAU (Month Active Users) 月活用户 39 | -------------------------------------------------------------------------------- /util/free-ssl.md: -------------------------------------------------------------------------------- 1 | # 免费 ssl 2 | 3 | ## Let's Encrypt 4 | 5 | * [官网](https://letsencrypt.org/) 6 | * [GitHub](https://github.com/certbot/certbot) 7 | * [文档](https://certbot.eff.org/docs/using.html) 8 | 9 | ## startssl 10 | 11 | 12 | 13 | Class 1 Domain Validation SSL Certificate 14 | 15 | 5 domains 1 year, unlimited 16 | 17 | 免费一年 18 | 19 | ## sslforfree 20 | 21 | 22 | 23 | ## CloudFlare 24 | 25 | 26 | 27 | ## 沃通 28 | 29 | 30 | -------------------------------------------------------------------------------- /util/lottie.md: -------------------------------------------------------------------------------- 1 | # Lottie 2 | 3 | 设计师会用 Adobe 旗下的 After Effects (简称 AE)来做个动画出来,之后 AE 上有一款插件叫做 [Bodymovin](https://github.com/bodymovin/bodymovin),这个插件也比较屌,可以直接根据 AE 上的动画文件导出 json 文件,之后我们在项目中引用 Lottie 开源库,在布局文件中简单的加上这么一句就完美的实现了。 4 | 5 | ## References 6 | 7 | * [这个项目碉堡了](http://stormzhang.com/2017/02/03/airbnb-lottie-android/) 8 | * Android: https://github.com/airbnb/lottie-android 9 | * iOS: https://github.com/airbnb/lottie-ios 10 | * ReactNative: https://github.com/airbnb/lottie-react-native 11 | -------------------------------------------------------------------------------- /util/markdown.md: -------------------------------------------------------------------------------- 1 | # markdown 2 | 3 | * [支持 Markdown 的网页 slides 工具总结](http://www.linuxidc.com/Linux/2014-11/109828.htm) 4 | 5 | ## markdown转网页 6 | 7 | Landslide : 8 | 9 | ## TOC 10 | 11 | Table of Content 12 | 13 | * [doctoc](https://github.com/thlorenz/doctoc) 14 | * [markdown-toc](https://github.com/jonschlinkert/markdown-toc) 15 | * [github-markdown-toc](https://github.com/ekalinin/github-markdown-toc) 16 | -------------------------------------------------------------------------------- /util/mermaid.md: -------------------------------------------------------------------------------- 1 | # mermaid 2 | 3 | * [Github](https://github.com/knsv/mermaid) 4 | * [文档](http://knsv.github.io/mermaid/) 5 | * [在线编辑器](http://knsv.github.io/mermaid/live_editor/) 6 | * [Atom安装mermaid插件](https://atom.io/packages/atom-mermaid) 7 | 8 | # 安装 9 | 10 | ```shell 11 | $ npm install mermaid -g 12 | ``` 13 | 14 | # 使用 15 | 16 | ## mermaid CLI 17 | 18 | 搜索`mermaid CLI` 19 | 20 | 先安装[phantomjs](https://github.com/ariya/phantomjs) 21 | 22 | ```shell 23 | $ npm install -g phantomjs@1.9 24 | ``` 25 | 26 | 生成图片 27 | 28 | ``` 29 | $ mermaid test.mmd 30 | ``` 31 | 32 | ## code 33 | 34 | 搜索`Flowcharts - Basic Syntax` 35 | 36 | * graph 流程图 37 | * [sequenceDiagram](http://knsv.github.io/mermaid/#sequence-diagrams) 时序图 38 | * [Gant diagrams](http://knsv.github.io/mermaid/) 甘特图 39 | 40 | ### Test 41 | 42 | ``` 43 | {% mermaid src="Resource/test.mmd" %} 44 | {% endmermaid %} 45 | ``` 46 | -------------------------------------------------------------------------------- /util/other.md: -------------------------------------------------------------------------------- 1 | # 其它工具 2 | 3 | ## JSON在线编辑器: 4 | 5 | * 6 | * 7 | 8 | ## 生成短链接 9 | 10 | * 11 | 12 | ## 二维码生成 13 | 14 | * 15 | 16 | ## Dash 17 | 18 | * 19 | 20 | 1. 安装包解压密码 `xclient.info` 21 | 2. 安装 Dash 22 | 3. 打开 Dash 23 | 4. `Dash > Preference > Purchase > ..... > 选择 license.dash-license` 24 | -------------------------------------------------------------------------------- /util/pay.md: -------------------------------------------------------------------------------- 1 | # 支付 2 | 3 | ## [银联支付](https://open.unionpay.com/ajweb/index) 4 | 5 | * [手机控件支付](https://open.unionpay.com/ajweb/product/detail?id=3) app 内集成 6 | * [网关支付](https://open.unionpay.com/ajweb/product/detail?id=1) 银联在线客户端支付 7 | * [手机网页支付](https://open.unionpay.com/ajweb/product/detail?id=66) 手机网页 8 | 9 | ## [微信支付](https://pay.weixin.qq.com/wiki/doc/api/index.html) 10 | 11 | * [公众号支付](https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_1) 微信内的 H5 12 | * [扫码支付](https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_1) 13 | 用户扫二维码支付 14 | * [APP支付](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=8_1) 15 | 16 | ## [支付宝支付](https://open.alipay.com/platform/home.htm) 17 | 18 | * [App支付](https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.6OYHAY&treeId=193&articleId=105051&docType=1) 19 | * [手机网站支付](https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.T7go5G&treeId=193&articleId=105288&docType=1) 20 | * [当面付](https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.yyQaey&treeId=193&articleId=105072&docType=1) 用户二维码支付 21 | -------------------------------------------------------------------------------- /util/plantuml.md: -------------------------------------------------------------------------------- 1 | # PlantUML 2 | 3 | 画时序图、类图、甘特图。。。工具 4 | 5 | * [官网](http://plantuml.com/) 6 | -------------------------------------------------------------------------------- /util/smarty.md: -------------------------------------------------------------------------------- 1 | # Smarty 2 | 3 | Smarty是一个PHP的模板引擎,提供让程序逻辑与页面显示(HTML/CSS)代码分离的功能。 也就是PHP代码是程序逻辑,与页面显示分开。 4 | 5 | * [官网](http://www.smarty.net/) 6 | * [官方文档](http://www.smarty.net/docs/zh_CN/) 7 | * [GitHub](https://github.com/smarty-php/smarty/) 8 | -------------------------------------------------------------------------------- /util/vs-code.md: -------------------------------------------------------------------------------- 1 | # Visual Studio Code 2 | 3 | * [官网](https://code.visualstudio.com/) 4 | 5 | ## 插件 6 | 7 | * Markdown All in One: Markdown 支持 TOC 8 | * Prettify JSON: JSON 格式化 9 | * AutoComplate shell: Shell 自动补全 10 | * shell-format: Shell 格式化 11 | -------------------------------------------------------------------------------- /util/weixin-scheme.md: -------------------------------------------------------------------------------- 1 | # weixin scheme 2 | 3 | * `weixin://scanqrcode` 扫码 4 | -------------------------------------------------------------------------------- /vue/element-ui.md: -------------------------------------------------------------------------------- 1 | # element-ui 2 | 3 | * [GitHub](https://github.com/ElemeFE/element) 4 | * [官网](http://element.eleme.io/) 5 | 6 | ## 语法 7 | 8 | ### trigger 9 | 10 | 属性用于设置何时触发 11 | 12 | * hover 鼠标放在上面的时候 13 | * click 点击的时候 14 | * focus 选中的时候 15 | * manual 手动 16 | * blur 在 Input 失去焦点时 17 | -------------------------------------------------------------------------------- /vue/vue-devtools.md: -------------------------------------------------------------------------------- 1 | # vue-devtools 2 | 3 | chrome 插件,利于调试 4 | 5 | * [GitHub](https://github.com/vuejs/vue-devtools) 6 | * [chrome 插件](https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd) 7 | -------------------------------------------------------------------------------- /vue/vue-env.md: -------------------------------------------------------------------------------- 1 | # vue 环境搭建 2 | 3 | 安装 [vue-cli](https://github.com/vuejs/vue-cli) 4 | 5 | ```sh 6 | npm install -g vue-cli 7 | ``` 8 | 9 | 创建工程 10 | 11 | ```sh 12 | vue init webpack wft-material-front 13 | ``` 14 | 15 | 工程文档: 16 | 17 | 运行工程 18 | 19 | ```sh 20 | cd wft-material-front 21 | npm install 22 | npm run dev 23 | ``` 24 | 25 | 添加 [vue-router](https://github.com/vuejs/vue-router) 26 | 27 | ```sh 28 | npm install --save vue-router 29 | ``` 30 | -------------------------------------------------------------------------------- /vue/vue-loader.md: -------------------------------------------------------------------------------- 1 | # vue-loader 2 | 3 | webpack 构建 vue 插件。 4 | 5 | 文档说明了 .vue 文件该怎么写,以及 webpack 该怎么配置 6 | 7 | * [GitHub](https://github.com/vuejs/vue-loader/) 8 | * [文档](https://vue-loader.vuejs.org/en/) 9 | -------------------------------------------------------------------------------- /vue/vue-router.md: -------------------------------------------------------------------------------- 1 | # vue-router 2 | 3 | Vue 路由 4 | 5 | * [GitHub](https://github.com/vuejs/vue-router) 6 | * [文档](http://router.vuejs.org/zh-cn/) 7 | 8 | ## 安装 9 | 10 | ```sh 11 | npm install --save vue-router 12 | ``` 13 | -------------------------------------------------------------------------------- /vue/vuex.md: -------------------------------------------------------------------------------- 1 | # vuex 2 | 3 | Vue 状态管理. 4 | 5 | 如果您不打算开发大型单页应用,使用 Vuex 可能是繁琐冗余的。确实是如此——如果您的应用够简单,您最好不要使用 Vuex。一个简单的 [global event bus](https://cn.vuejs.org/v2/guide/components.html#非父子组件通信) 就足够您所需了。但是,如果您需要构建是一个中大型单页应用,您很可能会考虑如何更好地在组件外部管理状态,Vuex 将会成为自然而然的选择。 6 | 7 | * [GitHub](https://github.com/vuejs/vuex) 8 | * [官方文档](http://vuex.vuejs.org/zh-cn/) 9 | 10 | ## 安装 11 | 12 | ```sh 13 | npm install --save vuex 14 | ``` 15 | -------------------------------------------------------------------------------- /wex5/ui2.md: -------------------------------------------------------------------------------- 1 | # UI2 2 | 3 | ## components 4 | 5 | system/components目录里包含了UI2自带的所有组件,有bootstrap组件、justep组件和标准html标签。fragment组件称为组合组件,就是对前面这些组件的常用组合形成再形成一个组件,方便使用。 6 | 7 | ### bootstrap 8 | 9 | ### justep 10 | 11 | ### 标准html标签 12 | 13 | ### fragment 14 | -------------------------------------------------------------------------------- /xcode/Other.md: -------------------------------------------------------------------------------- 1 | # Other 2 | 3 | ## Edit all in Scope 4 | 5 | 选定一个想要修改的字符串,然后选择 Edit-Edit all in Scope,然后在你输入的时候,所有该字符出现的地方都进行同步更改 6 | 7 | ## cocoapods 8 | 9 | 开发库添加文件,pod update之后才能用 10 | 11 | > 添加软链接到 `/Pods/Headers/Public` 12 | 13 | ## 修改XCode编译时使用的线程数 14 | 15 | ```shell 16 | $ defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks `sysctl -n hw.ncpu` 17 | ``` 18 | -------------------------------------------------------------------------------- /xcode/Resource/@keypath.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | @keypath 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | @keypath(<#parameters#>) 13 | IDECodeSnippetIdentifier 14 | 81D51CD3-5AF2-45D9-BE4B-19B7882549B1 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | @keypath 19 | IDECodeSnippetTitle 20 | @keypath 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 0 25 | 26 | 27 | -------------------------------------------------------------------------------- /xcode/Resource/@strongify.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | @strongify 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | @strongify(<#self#>); 13 | IDECodeSnippetIdentifier 14 | 0DA1AFCE-1A39-495F-BCBB-DA73FD95C95D 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | @strongify 19 | IDECodeSnippetTitle 20 | @strongify 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 0 25 | 26 | 27 | -------------------------------------------------------------------------------- /xcode/Resource/@weakify.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | @weakify 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | @weakify(<#self#>); 13 | IDECodeSnippetIdentifier 14 | 1D365654-09BE-4DC5-B419-5FCDC1AE4D37 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | @weakify 19 | IDECodeSnippetTitle 20 | @weakify 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 0 25 | 26 | 27 | -------------------------------------------------------------------------------- /xcode/Resource/Instruments.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greedbell/blog/20e19572eaece27174f718ef4bdf62b48050bd26/xcode/Resource/Instruments.pdf -------------------------------------------------------------------------------- /xcode/asset-catalog.md: -------------------------------------------------------------------------------- 1 | # Asset Catalog 2 | 3 | asset catalog 4 | 5 | ## References 6 | 7 | * [iOS拾遗—— Assets Catalogs 与 I/O 优化](https://juejin.im/post/5cb74d786fb9a068773948fc) 8 | -------------------------------------------------------------------------------- /xcode/code-snippets-library.md: -------------------------------------------------------------------------------- 1 | # Code Snippets Library 2 | 3 | ## Reference 4 | 5 | * [Xcode开发技巧之Code Snippets Library](http://www.jianshu.com/p/223b56ecc004) 6 | * [Xcode Snippets](http://nshipster.cn/xcode-snippets/) 7 | -------------------------------------------------------------------------------- /xcode/debug.md: -------------------------------------------------------------------------------- 1 | # Debug 2 | 3 | Debug 界面各个图标的意思,参考 [Debugging with Xcode](https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/debugging_with_xcode/chapters/debugging_tools.html) 4 | 5 | ``` 6 | L = Local variable 7 | A = Argument 8 | S = Static variable 9 | V = global Variable 10 | R = register 11 | V = instance Variable 12 | E = Expression 13 | ``` 14 | -------------------------------------------------------------------------------- /xcode/groups-vs-folder-references.md: -------------------------------------------------------------------------------- 1 | # Groups VS Folder References 2 | 3 | ## Groups 4 | 5 | ``` 6 | [UIImage imageNamed:@"Images/Icons/GoPago"]; 7 | ``` 8 | 9 | 可以写成 10 | 11 | [UIImage imageNamed:@"GoPago"]; 12 | 13 | ### 优势 14 | 15 | 管理麻烦 16 | 17 | ### 劣势 18 | 19 | ## Folder References 20 | 21 | ### 优势 22 | 23 | ### 劣势 24 | 25 | 26 | * http://vocaro.com/trevor/blog/2012/10/21/xcode-groups-vs-folder-references/ 27 | -------------------------------------------------------------------------------- /xcode/import.md: -------------------------------------------------------------------------------- 1 | # import 2 | 3 | * `#include ` 用于 lib 或 framework 4 | * `#include "something"` 用于引入的代码 5 | 6 | ## Header Search Paths 7 | 8 | ## 添加 lib 或 framework 9 | 10 | 依赖的 Lib 和 Framework 需要添加到 11 | 12 | `Target > Build Phase > Link Binary With Libraries` = `Target > General > Linked Frameworks and Libraries` 13 | 14 | 自定义的 Framework 需要添加到 15 | 16 | `Target > Build Phase > Embed Framework` = `Target > General > Embedded Binaries` 17 | -------------------------------------------------------------------------------- /xcode/merge-pbxproj.md: -------------------------------------------------------------------------------- 1 | # 解决 pbxproj 合并冲突 2 | 3 | * [A Better Way to Automatically Merge Changes in Your XCode Project Files](https://articles.mattoakes.net/a-better-way-to-automatically-merge-changes-in-your-xcode-project-files-3d83b3583fe4#.usdtppver) 4 | 5 | ```sh 6 | brew install mergepbx 7 | git mergetool --tool=mergepbx PROJECT.pbxproj 8 | ``` 9 | -------------------------------------------------------------------------------- /xcode/plist-buddy.md: -------------------------------------------------------------------------------- 1 | # PlistBuddy 操作 Plist 文件 2 | 3 | ``` 4 | /usr/libexec/PlistBuddy 5 | ``` 6 | 7 | ## 使用 8 | 9 | ``` 10 | 1.添加 11 | 12 | /usr/libexec/PlistBuddy -c 'Add :Software:Gallery:Version string "1.0"' ~/Desktop/com.sample.plist 13 | 14 | 2.输出 15 | 16 | /usr/libexec/PlistBuddy -c "Print" ~/Desktop/com.sample.plist 17 | 18 | 3.修改 19 | 20 | /usr/libexec/PlistBuddy -c 'Set :Software:Gallery:Version "1.1"' ~/Desktop/com.sample.plist 21 | 22 | 4.删除 23 | 24 | /usr/libexec/PlistBuddy -c 'Delete :Software:Gallery:Version' ~/Desktop/com.sample.plist 25 | 26 | 5.合并 27 | 28 | /usr/libexec/PlistBuddy -c "Merge ~/Desktop/Global.plist :Software:Gallery" ~/Desktop/com.sample.plist 29 | ``` 30 | 31 | ### 打印Build号 32 | 33 | ``` 34 | /usr/libexec/PlistBuddy -c "Print CFBundleVersion" ./Info.plist 35 | ``` 36 | -------------------------------------------------------------------------------- /xcode/project-pbxproj.md: -------------------------------------------------------------------------------- 1 | # project.pbxproj 2 | 3 | * `/usr/libexec/PlistBuddy` 4 | * https://github.com/CocoaPods/Xcodeproj 5 | -------------------------------------------------------------------------------- /xcode/xcode-install.md: -------------------------------------------------------------------------------- 1 | # Xcode 安装 2 | 3 | ## AppStore 安装 4 | 5 | 缺点: 6 | 7 | - 下载经常失败,还不支持断点续传。 8 | - 下载后的安装包不好复用。 9 | 10 | ## 下载安装包安装 11 | 12 | - 打开 [developer.apple.com](https://developer.apple.com/download/all/) 13 | - 下载对应版本的 Xcode 14 | - 安装下载好的 Xcode 15 | - 下载对应版本的 iOS SDK 16 | - 参考 [Installing and managing Simulator runtimes](https://developer.apple.com/documentation/xcode/installing-additional-simulator-runtimes) 安装 iOS SDK 17 | 18 | ### 手动安装 iOS SDK 的方法 19 | 20 | ``` 21 | xcode-select -s /Applications/Xcode-beta.app 22 | xcodebuild -runFirstLaunch 23 | xcrun simctl runtime add "~/Downloads/watchOS 9 beta Simulator Runtime.dmg" 24 | ``` 25 | -------------------------------------------------------------------------------- /xcode/xcodeproj.md: -------------------------------------------------------------------------------- 1 | # xcodeproj 2 | 3 | ruby创建和修改Xcode工程文件 4 | 5 | 6 | -------------------------------------------------------------------------------- /xcode/xcversion.md: -------------------------------------------------------------------------------- 1 | # xcode-install 2 | 3 | > 安装不同版本Xcode 4 | 5 | [Github](https://github.com/neonichu/xcode-install) 6 | 7 | ## 安装 xcode-install 8 | 9 | ```shell 10 | $ gem install xcode-install 11 | ``` 12 | 13 | ## 查看可安装的Xcode版本 14 | 15 | ```shell 16 | $ xcversion list 17 | ``` 18 | 19 | ## 安装 Xcode 20 | 21 | ```shell 22 | $ xcversion install 7 23 | ``` 24 | 25 | ## 安装模拟器 26 | 27 | 查看已安装模拟器 28 | 29 | ```sh 30 | xcversion simulators 31 | ``` 32 | 33 | * [在Xcode8.0下、手动安装iOS 9.3 的模拟器](http://www.jianshu.com/p/918741604a73) 34 | --------------------------------------------------------------------------------