Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

进行同步 #1

Merged
merged 169 commits into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
c09b7d2
Fixed format issues
lsvih Dec 14, 2019
07f6958
Format integral file.
lsvih Dec 17, 2019
d437f63
Reformat integral file.
lsvih Dec 17, 2019
c2905dc
PHP 7.4 有什么新功能?你必须掌握的 10 大特性 (#6549)
evanzme Dec 18, 2019
53e3eca
Create understanding-recursion.md (#6553)
sunui Dec 18, 2019
aff8e1b
Create the-ripple-effect-expanding-our-icon-design-system.md (#6555)
sunui Dec 18, 2019
9b617ce
我个人的 Git 技巧备忘录 (#6548)
Dec 23, 2019
bb9265c
理解递归、尾调用优化和蹦床函数优化 (#6557)
eizyc Dec 23, 2019
a8c7fca
我们为何抛弃 Redux 拥抱 MobX (#6538)
lihaobhsfer Dec 23, 2019
46a2ef0
Translation/my personal git tricks cheatsheet.md (#6560)
Dec 23, 2019
f10909e
Syslog:系统管理员完整指南 (#6391)
githubmnume Dec 23, 2019
3c3f1c1
深入解析 Flutter Provider 包 (#6480)
EmilyQiRabbit Dec 23, 2019
2677720
Create json-parser-with-javascript.md (#6564)
sunui Dec 24, 2019
19a80cf
使用 Redux Offline 和 Apollo 进行离线 GraphQL 查询 (#6541)
v2-lab Dec 24, 2019
ebf3b1e
Create how-to-build-a-blog-with-nest-js-mongodb-and-vue-js.md (#6567)
sunui Dec 25, 2019
b3b281d
Create an-introduction-to-raspberry-pi-4-gpio-and-controlling-it-with…
sunui Dec 25, 2019
5f72e9c
Create why-svelte-wont-kill-react.md (#6570)
sunui Dec 25, 2019
447e6b9
完成 11 月 1 日前的积分统计
lsvih Dec 27, 2019
855475c
完成 2019 年 12 月 27 日前的全部文章积分统计
lsvih Dec 27, 2019
edd7bc5
补录积分
lsvih Dec 29, 2019
0688d3f
Create how_to_prep_your_github_for_job_seeking.md (#6583)
lsvih Dec 29, 2019
240adc8
Create how-to-write-video-chat-app-using-webrtc-and-nodejs.md (#6585)
lsvih Dec 29, 2019
f98782c
登记 2019 年优秀英文文章推荐奖励积分
lsvih Dec 29, 2019
9790d2b
使用 JavaScript 编写 JSON 解析器 (#6582)
Gavin-Gong Dec 30, 2019
a172bc9
数学编程  ——  一个为推进数据科学发展而培养的关键习惯 (#6389)
Weirdochr Dec 30, 2019
8540dc4
C++ 中清晰明了的状态机代码 (#6552)
zh1an Dec 30, 2019
7237f4b
登记#9582 积分
lsvih Dec 30, 2019
5f5e8b5
Create creating-website-sitemap.md (#6589)
sunui Dec 30, 2019
1b3fe5c
Create use-web-workers-for-your-event-listeners.md (#6591)
sunui Dec 30, 2019
0197116
图标万花筒 (#6561)
JaxNext Dec 31, 2019
d0f1b08
WebRTC 联手 Node.js:打造实时视频聊天应用 (#6587)
JaxNext Dec 31, 2019
8996863
Create top-7-modern-programming-language-to-learn-now.md (#6595)
sunui Jan 2, 2020
4cfc1a2
Create levels-of-seniority.md (#6600)
sunui Jan 3, 2020
5e88df0
Create history-of-javascript.md (#6602)
sunui Jan 3, 2020
5678c96
Create when-workers.md (#6608)
sunui Jan 6, 2020
1f0892e
Create i-dont-hate-arrow-functions.md (#6609)
sunui Jan 6, 2020
48848a1
为何 Svelte 杀不死 React (#6575)
JaxNext Jan 6, 2020
6ea5848
如何为求职准备你的 GitHub (#6604)
nettee Jan 6, 2020
dca8f71
论资历的级别 (#6613)
JaxNext Jan 8, 2020
55c9a86
JavaScript 简史 (#6606)
Jan 8, 2020
f2f49b0
JavaScript 简史 补充修改 (#6616)
Jan 9, 2020
5082951
如何用 Nest.js、MongoDB 和 Vue.js 搭建一个博客 (#6617)
eizyc Jan 10, 2020
c7b15c4
Create nestjs-basic-auth-and-sessions.md (#6625)
sunui Jan 14, 2020
811ccef
Create build-a-blog-using-nuxt-strapi-and-apollo.md (#6626)
sunui Jan 14, 2020
037d248
现在就该学习的 7 门现代编程语言 (#6618)
lihaobhsfer Jan 14, 2020
b5a6d1b
Create goodbye-clean-code.md (#6631)
sunui Jan 15, 2020
1895cb7
Create how-to-choose-the-right-database.md (#6637)
sunui Jan 16, 2020
5541c22
Create is-no-sql-killing-sql.md (#6638)
sunui Jan 16, 2020
c3df525
5 个简单步骤为您的网站创建 Sitemap (#6621)
eizyc Jan 18, 2020
01ad8c4
再见,整洁的代码 (#6641)
zh1an Jan 19, 2020
745022e
使用 Web Workers 优化事件监听器 (#6614)
v2-lab Jan 19, 2020
74dee44
在什么时候你需要使用 Web Workers? (#6643)
weibinzhu Jan 23, 2020
7aa08a2
Create edge-detection-in-python.md
lsvih Jan 23, 2020
4133a96
Update edge-detection-in-python.md
lsvih Jan 23, 2020
2c8fd2e
Create the-algorithm-is-not-the-product.md (#6648)
lsvih Jan 23, 2020
1e3c7a4
使用 Nuxt (Vue.js)、Strapi 和 Apollo 构建博客 (#6646)
v2-lab Jan 24, 2020
6711310
Create 8-ui-ux-design-trends-for-2020.md (#6656)
lsvih Feb 1, 2020
1448eea
Create webassembly-why-and-how-to-use-it.md (#6665)
lsvih Feb 4, 2020
c18a90f
Create understanding-service-workers-and-caching-strategies.md (#6667)
lsvih Feb 4, 2020
755eef0
Create how-to-write-beautiful-and-meaningful-readme-md-for-your-next-…
lsvih Feb 4, 2020
afba20c
算法不是产品 (#6652)
fireairforce Feb 4, 2020
0b37767
Create learn-to-cache-your-nodejs-application-with-redis-in-6-minutes…
lsvih Feb 5, 2020
2990deb
Create fast-pipelines-with-generators-in-typescript.md (#6674)
lsvih Feb 5, 2020
101e6a3
如何写出优雅且有意义的 README.md (#6671)
eizyc Feb 5, 2020
60004bf
Update the-algorithm-is-not-the-product.md
lsvih Feb 5, 2020
0463159
如何选择合适的数据库 (#6660)
eizyc Feb 6, 2020
edeae3e
使用 Python 进行边缘检测 (#6650)
lsvih Feb 7, 2020
effc273
Create image-inpainting-humans-vs-ai.md (#6681)
lsvih Feb 8, 2020
f265ada
Create making-svg-icon-component-in-vue.md (#6686)
lsvih Feb 9, 2020
aa26709
Create stop-using-everywhere.md (#6689)
lsvih Feb 9, 2020
7f25516
Create javascript-native-methods-you-may-not-know.md (#6690)
lsvih Feb 9, 2020
452eb23
图像修复:人类和 AI 的对决 (#6684)
Starry316 Feb 12, 2020
2bcb119
Create 7-principles-of-icon-design.md (#6699)
lsvih Feb 14, 2020
f2dc0eb
Create a-simple-guide-to-a-b-testing-for-data-science.md (#6705)
lsvih Feb 15, 2020
6897eb8
WebAssembly:带有代码示例的简单介绍 (#6680)
fireairforce Feb 16, 2020
77938c8
您可能不知道的原生 JavaScript 方法 (#6704)
eizyc Feb 18, 2020
0f0101b
笔误 (#6713)
hgfkeep Feb 19, 2020
8dbd684
Create password-hashing-pbkdf2-scrypt-bcrypt-and-argon2.md (#6714)
sunui Feb 19, 2020
105211a
Create rel-noopener.md (#6716)
sunui Feb 19, 2020
2c55e6a
Create btc-history-git.md (#6718)
sunui Feb 19, 2020
8c5f2e9
用 6 分钟学习如何用 Redis 缓存您的 NodeJS 应用! (#6677)
eizyc Feb 20, 2020
c6db1e1
移除 2019 年年度积分
lsvih Feb 21, 2020
69956ec
更新 1~2 月推荐文章积分
lsvih Feb 21, 2020
fc56287
在 Vue 中编写 SVG 图标组件 (#6703)
fireairforce Feb 21, 2020
21f57e3
Create a-beginners-guide-to-simulating-dynamical-systems-with-python.…
lsvih Feb 22, 2020
9303158
Create the-7-programming-languages-frameworks-to-learn-in-2020.md (#6…
lsvih Feb 23, 2020
bdabcb8
SQL 将死于 No-SQL 之手? (#6662)
JalanJiang Feb 25, 2020
1dbe8fd
Create fixing-memory-leaks-in-web-applications.md (#6735)
sunui Feb 26, 2020
5b70b6d
关于 icon 设计的 7 大准则 (#6739)
eizyc Mar 3, 2020
5b19544
Create a-new-go-api-for-protocol-buffers.md (#6752)
lsvih Mar 4, 2020
b3489f2
停止在任何地方使用 === (#6750)
zaviertang Mar 4, 2020
6f6620c
Create eye-tracking-and-the-best-ux-practices-in-the-mobile-world.md …
lsvih Mar 4, 2020
b1c265a
Create making-logs-colorful-in-nodejs.md (#6755)
lsvih Mar 4, 2020
88306da
理解 Service Worker 和缓存策略 (#6693)
lsvih Mar 5, 2020
7533ff4
Create whats-going-on-in-that-front-end-head.md (#6760)
lsvih Mar 5, 2020
2e2e43d
一份数据科学 A/B 测试的简单指南 (#6732)
Amberlin1970 Mar 6, 2020
dfe5c3d
登记 1 月翻译校对积分
lsvih Mar 6, 2020
c5ef3ee
登记 2 月翻译校对积分
lsvih Mar 6, 2020
f581cf2
Create separation-of-data-and-ui-in-your-web-app.md (#6764)
lsvih Mar 7, 2020
19f273f
Create 5-secret-features-of-json-stringify.md (#6766)
lsvih Mar 7, 2020
11b0439
Create javascript-top-level-await-in-a-nutshell.md (#6769)
lsvih Mar 8, 2020
c6540d9
Create create-a-line-chart-in-swiftui-using-paths.md (#6771)
lsvih Mar 8, 2020
9360515
Create decouple-your-code-with-dependency-injection.md (#6773)
lsvih Mar 8, 2020
52a938b
Create 5-ways-to-create-a-settings-icon.md (#6779)
lsvih Mar 9, 2020
f000616
2020 年要学习的 7 种编程语言和框架 (#6763)
Mar 9, 2020
8e19ed7
Git 的历史: 软件版本控制的统治之路 (#6768)
fireairforce Mar 12, 2020
9a6763f
更新 3 月 12 日前翻译校对及推荐奖励积分
lsvih Mar 12, 2020
31606a0
Create 11-chrome-apis-that-give-your-web-app-a-native-feel.md (#6784)
lsvih Mar 12, 2020
7bb011c
Create 8-useful-tree-data-structures-worth-knowing.md (#6786)
lsvih Mar 12, 2020
b4bbb17
Create a-realworld-comparison-of-front-end-frameworks-2020.md (#6796)
sunui Mar 15, 2020
66f606c
密码哈希的方法:PBKDF2,Scrypt,Bcrypt 和 ARGON2 (#6792)
Mar 16, 2020
f6e97b7
给 NodeJS 的 Logs 点颜色看看! (#6788)
eizyc Mar 16, 2020
1ca11c8
Create everything-you-need-to-know-about-javascript-symbols.md (#6800)
lsvih Mar 16, 2020
e65a228
Create how-to-write-a-front-end-developer-resume-that-will-land-you-a…
lsvih Mar 16, 2020
eb0c285
前端代码顶部的 Header 标签里都有些什么? (#6781)
eizyc Mar 17, 2020
2c45902
Create composing-software-the-book.md (#6807)
sunui Mar 19, 2020
a5e2a7f
Create the-dao-of-immutability.md (#6808)
sunui Mar 19, 2020
9fc3622
Create master-the-javascript-interview-what-is-a-pure-function.md (#6…
sunui Mar 19, 2020
6845f7b
Create master-the-javascript-interview-what-is-functional-programming…
sunui Mar 19, 2020
2fdfc3b
Create elements-of-javascript-style.md (#6811)
sunui Mar 19, 2020
1b7f28a
Fix invalid url. Resolved #6817
lsvih Mar 22, 2020
1ee089a
8 个值得了解的树形数据结构 (#6804)
Amberlin1970 Mar 27, 2020
2fc1f6f
眼动跟踪和移动世界的最佳用户体验实践 (#6806)
Charlo-O Mar 27, 2020
b1dc91b
我并不讨厌箭头函数(#6610) (#6659)
TiaossuP Mar 27, 2020
85b370b
掌握 JavaScript 面试:什么是纯函数? (#6828)
nia3y Mar 28, 2020
50fe5ba
fix:文章翻译问题 (#6833)
fireairforce Mar 28, 2020
03a5ad1
用依赖注入来解耦你的代码 (#6823)
JalanJiang Mar 29, 2020
ec81f83
Create generator-functions-in-javascript.md (#6841)
lsvih Mar 31, 2020
09bdfca
Create how-to-keep-your-dependencies-secure-and-up-to-date.md (#6843)
lsvih Mar 31, 2020
b31262e
Create deep-dive-into-react-fiber-internals.md (#6845)
lsvih Mar 31, 2020
e558412
Update deep-dive-into-react-fiber-internals.md
lsvih Mar 31, 2020
b092388
Create how-can-cloud-services-help-improve-your-businessess-efficienc…
lsvih Mar 31, 2020
1890989
Create should-you-learn-vim-as-a-developer-in-2020.md (#6849)
lsvih Mar 31, 2020
86c98a0
Go 发布新版 Protobuf API (#6827)
Mar 31, 2020
3a97b80
JSON.stringify() 的 5 个秘密特性 (#6793)
fireairforce Mar 31, 2020
7e5c087
Create high-speed-inserts-with-mysql.md (#6853)
lsvih Apr 1, 2020
1b8f128
组合软件:书 (#6832)
fireairforce Apr 2, 2020
e9ffc55
Create 6-best-javascript-frameworks-in-2020.md (#6861)
lsvih Apr 3, 2020
10ee3f1
2020 年用各大前端框架构建的 RealWorld 应用对比 (#6851)
jasperxihuan Apr 4, 2020
9e581b5
Create the-importance-of-why-docs.md (#6868)
lsvih Apr 6, 2020
8435cc5
不变性之道 (#6857)
nia3y Apr 6, 2020
078db71
Create polymorphic-react-components.md (#6870)
lsvih Apr 6, 2020
6617fdd
Create active-learning-in-machine-learning.md (#6872)
lsvih Apr 6, 2020
fee835c
Create kafka-vs-rabbitmq-why-use-kafka.md (#6874)
lsvih Apr 6, 2020
f871ee3
Create i-built-an-app-that-uses-all-7-new-features-in-javascript-es20…
lsvih Apr 6, 2020
15bd0f2
云服务如何帮助你提高业务效率? (#6859)
QinRoc Apr 7, 2020
b8212d7
NestJS 实现基本用户认证和会话 (#6731)
eizyc Apr 7, 2020
e174933
作为 2020 年的开发者,你应该学习 VIM 吗? (#6856)
chaingangway Apr 7, 2020
090cf24
MySQL 最佳实践—— 高效插入数据 (#6863)
Apr 8, 2020
fa1d408
Create combine-getting-started.md (#6883)
lsvih Apr 9, 2020
dc6bac3
Create how-to-be-a-good-remote-developer.md (#6885)
lsvih Apr 9, 2020
297f881
Create why-is-object-immutability-important.md (#6887)
lsvih Apr 9, 2020
cf32cda
Create what-on-earth-is-the-shadow-dom-and-why-it-matters.md
lsvih Apr 9, 2020
39e1036
2020 年排名前 6 位的 JavaScript 框架 (#6867)
QinRoc Apr 9, 2020
64e4165
JavaScript 风格元素 (#6878)
febrainqu Apr 9, 2020
61ec18b
怎样让依赖库保持安全和最新 (#6864)
chaingangway Apr 9, 2020
c7588af
Create 5-best-practices-to-prevent-git-leaks.md (#6894)
lsvih Apr 10, 2020
9698791
Create swiftui-3d-scroll-effect.md (#6896)
lsvih Apr 10, 2020
5ec9371
Web 应用程序中的数据和 UI 分离 (#6794)
fireairforce Apr 10, 2020
84f7988
fix:typo (#6903)
fireairforce Apr 12, 2020
e52a0c8
用 SwiftUI 的 Paths 创建折线图 (#6838)
chaingangway Apr 14, 2020
11e96e4
JavaScript 中的 Generator 函数 (#6893)
nia3y Apr 14, 2020
b356822
解决 web 应用程序中的内存泄漏问题 (#6831)
febrainqu Apr 14, 2020
3035d6e
为什么对象不变性很重要? (#6909)
IAMSHENSH Apr 15, 2020
7c0c519
Create performant-javascript-best-practices.md (#6911)
lsvih Apr 15, 2020
359a60e
Create more-reasons-why-developers-should-blog.md (#6913)
lsvih Apr 15, 2020
e7e821d
Create 5-optimization-tips-for-your-mobile-web-app-for-higher-user-re…
lsvih Apr 15, 2020
ed88eef
Create do-you-know-about-the-keyboard-tag-in-html.md (#6917)
lsvih Apr 15, 2020
7182297
您知道 HTML 的键盘标签吗? (#6922)
IAMSHENSH Apr 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TODO/the-hidden-treasures-of-object-composition.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
>
> “优先考虑对象组合而不是类继承。” ~ Gang of Four,[《设计模式:可复用面向对象软件的基础》](https://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612//ref=as_li_ss_tl?ie=UTF8&linkCode=ll1&tag=eejs-20&linkId=06ccc4a53e0a9e5ebd65ffeed9755744)

软件开发中最常见的错误之一就是对于类继承的过度使用。类继承是一个代码复用机制,实例对象和基类构成了 **是一个(is-a)**关系。如果你想要使用 is-a 关系来构建应用程序,你将陷入麻烦,因为在面向对象设计中,类继承是最紧的耦合形式,这种耦合会引起下面这些常见问题:
软件开发中最常见的错误之一就是对于类继承的过度使用。类继承是一个代码复用机制,实例对象和基类构成了 **is-a** 关系。如果你想要使用 is-a 关系来构建应用程序,你将陷入麻烦,因为在面向对象设计中,类继承是最紧的耦合形式,这种耦合会引起下面这些常见问题:

* 脆弱的基类问题
* 猩猩/香蕉问题
Expand Down
417 changes: 417 additions & 0 deletions TODO1/11-chrome-apis-that-give-your-web-app-a-native-feel.md

Large diffs are not rendered by default.

132 changes: 132 additions & 0 deletions TODO1/5-best-practices-to-prevent-git-leaks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
> * 原文地址:[5 Best Practices To Prevent Git Leaks](https://levelup.gitconnected.com/5-best-practices-to-prevent-git-leaks-4997b96c1cbe)
> * 原文作者:[Coder’s Cat](https://medium.com/@coderscat)
> * 译文出自:[掘金翻译计划](https://github.com/xitu/gold-miner)
> * 本文永久链接:[https://github.com/xitu/gold-miner/blob/master/TODO1/5-best-practices-to-prevent-git-leaks.md](https://github.com/xitu/gold-miner/blob/master/TODO1/5-best-practices-to-prevent-git-leaks.md)
> * 译者:
> * 校对者:

# 5 Best Practices To Prevent Git Leaks

![Photo by Clint Patterson on Unsplash](https://cdn-images-1.medium.com/max/4000/0*bskmb4Tr98q5if_y.jpg)

Countless developers are using Git for version control, but many don’t have enough knowledge about how Git works. Some people even use Git and Github as tools for backup files. This leads to information disclosure in Git repositories. [Thousands of new API or cryptographic keys leak via GitHub projects every day.](https://www.zdnet.com/article/over-100000-github-repos-have-leaked-api-or-cryptographic-keys/)

I have been working in the field of information security for three years. About two years ago, our company had a severe security issue triggered by the information leak in a Git repository.

An employee accidentally leaked an AWS key to Github. The attacker used this key to download more sensitive data from our servers. We put a lot of time into fixing this issue, we tried to find out how much data leaked, analyzed the affected systems and related users, and replaced all the leaked keys in systems.

It is a sad story that any company and developer would not want to experience.

I won’t write more details about it. Instead, I hope more people know how to avoid it. Here are my suggestions for you to keep safe from Git leaks.

## Build security awareness

Most junior developers don’t have enough security awareness. Some companies will train new employees, but some companies don’t have systematic training.

As a developer, we need to know which kind of data may introduce security issues. Remember these categories of data can not be checked into Git repository:

1. Any configuration data, including password, API keys, AWS keys, private keys, etc.
2. [Personally Identifiable Information](https://en.wikipedia.org/wiki/Personal_data) (PII). According to GDPR, if a company leaked the users’ PII, the company needs to notify users, relevant departments and there will be more legal troubles.

If you are working for a company, don’t share any source code or data related to the company without permission.

Attackers can easily find some code with a company copyright on GitHub, which was accidentally leaked to Github by employees.

My advice is, try to distinguish between company affairs and personal stuff strictly.

## Use Git ignore

When we create a new project with Git, we must set a **.gitignore** properly. **gitignore** is a Git configuration file that lists the files or directories that will not be checked into the Git repository.

This project’s [gitignore](https://github.com/github/gitignore) is a collection of useful .gitignore templates, with all kinds of programming language, framework, tool or environment.

We need to know the pattern matching rules of **gitignore** and add our own rules based on the templates.

![](https://cdn-images-1.medium.com/max/2000/0*VmEolB6qYNCYr9Wf.png)

## Check commits with Git hooks and CI

No tools could find out all the sensitive data from a Git repository, but a couple of tools and practices can help.

[git-secrets](https://github.com/awslabs/git-secrets) and [talisman](https://github.com/thoughtworks/talisman) are similar tools, they are meant to be installed in local repositories as [pre-commit hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks). Every change will be checked before committed, pre-commit hooks will reject the commit if they detect a prospective commit may contain sensitive information.

[gitleaks](https://github.com/zricethezav/gitleaks) provides another way to find unencrypted secrets and other unwanted data types in git repositories. We could integrate it into automation workflows such as CICD.

## Code review

Code review is a best practice for team working. All the teammates will learn from each other’s source code. Junior developer’s code should be reviewed by developers with more experience.

Most unintended changes can be found out during the code review stage.

[Enabling branch restrictions](https://help.github.com/en/github/administering-a-repository/enabling-branch-restrictions) can enforce branch restrictions so that only certain users can push to a protected branch in repositories. Gitlab has a similar option.

Setting master to a restricted branch helps us to enforce the code review workflow.

![](https://cdn-images-1.medium.com/max/2208/0*RUqDCQlDgym-Jo8x.png)

## Fix it quickly and correctly

With all the above tools and mechanisms, errors still could happen. If we fix it quickly and correctly, the leak may introduce no actual security issue.

If we find some sensitive data leaked in the Git repository, we can not just make another commit to clean up.

![This fix is self-deception](https://cdn-images-1.medium.com/max/2000/0*FsGBhHSlXdeSpTk4.png)

What we need to do is remove all the sensitive data from the entire Git history.

**Remember to backup before any cleanup, and then remove the backup clone after we confirmed everything is OK**.

Use the `--mirror` to clone a bare repository; this is a full copy of the Git database.

```bash
git clone --mirror git://example.com/need-clean-repo.git
```

We need **git filter-branch** to remove data from all branches and commit histories. Suppose we want to remove `./config/passwd` from Git:

```bash
$ git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch ./config/password' \
--prune-empty --tag-name-filter cat -- --all
```

Remember to add the sensitive file to .gitignore:

```bash
$ echo "./config/password" >> .gitignore
$ git add .gitignore
$ git commit -m "Add password to .gitignore"
```

Then we push all branches to remote:

```bash
$ git push --force --all
$ git push --force --tags
```

Tell our collaborators to rebase:

```bash
$ git rebase
```

[BFG](https://rtyley.github.io/bfg-repo-cleaner/) is a faster and simpler alternative to **git filter-branch** for removing sensitive data. It’s usually 10–720x faster than **git filter-branch**. Except for deleting files, BFG could also be used to replace secrets in files.

BFG will leave the latest commit untouched. It’s designed to protect us from making mistakes. We should explicitly delete the file, commit the deletion, then clean up the history to remove it.

If the leaked Git repository is forked by others, we need to follow the [DMCA Takedown Policy](https://help.github.com/en/github/site-policy/dmca-takedown-policy#c-what-if-i-inadvertently-missed-the-window-to-make-changes) to ask Github to remove the forked repositories.

The whole procedure requires some time to finish, but it’s the only way to remove all the copies.

## Conclusion

Don’t make the same mistake that countless people have made. Try to put some effort to avoid safety accidents.

Use these tools and strategies will help much in avoiding Git leaks.

> 如果发现译文存在错误或其他需要改进的地方,欢迎到 [掘金翻译计划](https://github.com/xitu/gold-miner) 对译文进行修改并 PR,也可获得相应奖励积分。文章开头的 **本文永久链接** 即为本文在 GitHub 上的 MarkDown 链接。

---

> [掘金翻译计划](https://github.com/xitu/gold-miner) 是一个翻译优质互联网技术文章的社区,文章来源为 [掘金](https://juejin.im) 上的英文分享文章。内容覆盖 [Android](https://github.com/xitu/gold-miner#android)、[iOS](https://github.com/xitu/gold-miner#ios)、[前端](https://github.com/xitu/gold-miner#前端)、[后端](https://github.com/xitu/gold-miner#后端)、[区块链](https://github.com/xitu/gold-miner#区块链)、[产品](https://github.com/xitu/gold-miner#产品)、[设计](https://github.com/xitu/gold-miner#设计)、[人工智能](https://github.com/xitu/gold-miner#人工智能)等领域,想要查看更多优质译文请持续关注 [掘金翻译计划](https://github.com/xitu/gold-miner)、[官方微博](http://weibo.com/juejinfanyi)、[知乎专栏](https://zhuanlan.zhihu.com/juejinfanyi)。
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
> * 原文地址:[5 optimization tips for your mobile web app for higher user retention](https://levelup.gitconnected.com/5-optimization-tips-for-your-mobile-web-app-for-higher-user-retention-3d6d158aadb7)
> * 原文作者:[Axel Wittmann](https://medium.com/@axelcwittmann)
> * 译文出自:[掘金翻译计划](https://github.com/xitu/gold-miner)
> * 本文永久链接:[https://github.com/xitu/gold-miner/blob/master/TODO1/5-optimization-tips-for-your-mobile-web-app-for-higher-user-retention.md](https://github.com/xitu/gold-miner/blob/master/TODO1/5-optimization-tips-for-your-mobile-web-app-for-higher-user-retention.md)
> * 译者:
> * 校对者:

# 5 optimization tips for your mobile web app for higher user retention

![Photo by [Jaelynn Castillo](https://unsplash.com/@jaelynnalexis?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)](https://cdn-images-1.medium.com/max/9310/0*Cj9Dw7l2u-wSTCqK)

> Your mobile website can be more appealing to mobile users by going beyond css style optimization

As of 2020, internet traffic is around half mobile and half desktop. Google looks to your mobile website version to determine at what position to rank your pages when it indexes. A significant share of young users don’t even use desktop devices at all anymore.

These 3 facts show why optimizing your website for mobile usage is more important than ever. And even more importantly: Mobile users are way more picky and subconsciously irritated by UX issues on mobile devices than desktop users. If there are issues in how your website behaves on a mobile device, it’s highly likely your mobile user retention rate is suffering.

Here are a few tips to optimize your mobile website beyond just using different CSS styles for devices below 600px width.

## 1. Remove mobile ghost shadowing click effects

Native apps don’t have them, mobile browsers do. When you click on any button or anything clickable such as an icon, users on browsers such as Safari or Chrome will see a shadow click effect.

The `\<div>`, `\<button>` or other element that is clicked on will have a brief underlying shadow effect. This effect is supposed to give users feedback that something was clicked on and something should happen as a result. Which makes sense for a lot of interactions on websites.

But what if your website actually is responsive enough already and includes effects for loading data? Or you use Angular, React or Vue and a lot of the UX interaction is instantaneous? It is likely, that the shadow click effect gets in the way of your user experience.

You can use the following code in your style-sheet to get rid of this shadow click effect. Don’t worry, it won’t break anything else, even though you need to include it as a global style.

```css
* {
/*prevents tabing highlight issue in mobile */
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-moz-tap-highlight-color: rgba(0, 0, 0, 0);
}
```

## 2. Use the user-agent to detect whether the user accesses from a mobile device

I am not talking about abandoning style-sheet specific @media code for devices below 600px width. Quite on the contrary. You should always use your style-sheet to make your website mobile friendly.

However, what if there is an additional effect that you want to show based on whether the user is on a mobile device? And you want to include it in your JavaScript functions — and you don’t want this to change if a user changes its smartphone direction (which increases the width beyond 600px).

For these kind of situations, my advice is to use a globally accessible Helper-function that determines based on the user-agent of the browser if the user device is a mobile device or not.

```js
$_HelperFunctions_deviceIsMobile: function() {
if (/Mobi/i.test(navigator.userAgent)) {
return true;
} else
{return false;
}
}
```

![Photo by [Holger Link](https://unsplash.com/@photoholgic?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)](https://cdn-images-1.medium.com/max/6716/0*qYl5LnaPjGjQqXfp)

## 3. Load mobile versions of larger images

If you use large images and want to make sure that the loading time on mobile is still adequate for your mobile users, always load different versions of images.

You don’t even need JavaScript for it (well, you can also do it with JavaScript too…). For a css version of this strategy, look at the following code.

```html
<!-- ===== LARGER VERSION OF FILE ========== -->
<div class="generalcontainer nomobile">
<div class="aboutus-picture" id="blend-in-cover" v-bind:style="{ 'background-image': 'url(' + image1 + ')' }"></div>
</div>

<!-- ===== MOBILE VERSION OF FILE ========== -->
<div class="generalcontainer mobile-only">
<div class="aboutus-picture" id="blend-in-cover" v-bind:style="{ 'background-image': 'url(' + image1-mobile + ')' }"></div>
</div>
```

And in your CSS file, define mobile-only and nomobile.

```css
.mobile-only { display: none; }

@media (max-width: 599px) {
...
.nomobile {display: none;}
.mobile-only {display: initial;}
}
```

## 4. Try out endless scrolling and lazy loaded data

If you have large lists such as users or tasks that run into dozens or hundreds, you should consider lazy loading more users when a user scrolls down instead of showing a `load more` or `show more` button. Native apps typically include such a lazy loaded endless scrolling feature.

It is not hard to do so in a mobile web in Javascript frameworks.

You add a reference ($ref) to an element in your template or simply rely on the absolute scroll position of your window.

The following code shows how to implement this effect in a Vue-app. Similar code can be added in other frameworks such as Angular or React.

```js
mounted() {
this.$nextTick(function() {
window.addEventListener('scroll', this.onScroll);
this.onScroll(); // needed for initial loading on page
});
},
beforeDestroy() {
window.removeEventListener('scroll', this.onScroll);
}
```

The onScroll function loads data if a user scrolls to a certain element or to the bottom of the page:

```js
onScroll() {
var users = this.$refs["users"];
if (users) {
var marginTopUsers = usersHeading.getBoundingClientRect().top;
var innerHeight = window.innerHeight;
if ((marginTopUsers - innerHeight) < 0) {
this.loadMoreUsersFromAPI();
}
}
}
```

## 5. Make your modals and popups full width or full screen

Mobile screens have limited space. Sometimes developers forget that and use the same type of interface they use on their desktop version. Especially modal windows are a turn off for mobile users if not implemented correctly.

Modal windows are windows you overlay on top of other content on a page. For desktop users, they can work great. Users very often want to click on the background content to get out of the modal window again — typically when a user decides to not perform the action the modal window suggests.

![](https://cdn-images-1.medium.com/max/4816/1*J7cegVnnZMO7zl6uv357tA.png)

![](https://cdn-images-1.medium.com/max/3912/1*6tVjltC9faX0gnRT25xKaQ.png)

Mobile usage of a website and modals represent a different challenge. Due to the limited screen space, large companies with well designed mobile web apps such as Youtube or Instagram make modals full width or full screen with an ‘X’ on the top of the modal to close it.

This is particularly the case for sign-up modals, which in desktop versions are normal modals windows, while full screen on a mobile version.

> 如果发现译文存在错误或其他需要改进的地方,欢迎到 [掘金翻译计划](https://github.com/xitu/gold-miner) 对译文进行修改并 PR,也可获得相应奖励积分。文章开头的 **本文永久链接** 即为本文在 GitHub 上的 MarkDown 链接。

---

> [掘金翻译计划](https://github.com/xitu/gold-miner) 是一个翻译优质互联网技术文章的社区,文章来源为 [掘金](https://juejin.im) 上的英文分享文章。内容覆盖 [Android](https://github.com/xitu/gold-miner#android)、[iOS](https://github.com/xitu/gold-miner#ios)、[前端](https://github.com/xitu/gold-miner#前端)、[后端](https://github.com/xitu/gold-miner#后端)、[区块链](https://github.com/xitu/gold-miner#区块链)、[产品](https://github.com/xitu/gold-miner#产品)、[设计](https://github.com/xitu/gold-miner#设计)、[人工智能](https://github.com/xitu/gold-miner#人工智能)等领域,想要查看更多优质译文请持续关注 [掘金翻译计划](https://github.com/xitu/gold-miner)、[官方微博](http://weibo.com/juejinfanyi)、[知乎专栏](https://zhuanlan.zhihu.com/juejinfanyi)。
Loading