写点什么

ARTS 打卡第一周

作者:怂恿
  • 2023-08-19
    广东
  • 本文字数:5105 字

    阅读完需:约 17 分钟

ARTS 打卡第一周

1、Algorithm 一道算法题

leetcode 387. 字符串中的第一个唯一字符给定一个字符串,找到它的第一个不重复的字符,并返回它的索引。如果不存在,则返回 -1。


示例:
s = "leetcode"返回 0
s = "loveleetcode"返回 2
s = "lovveleetcode"返回 -1
复制代码


思路:看到取唯一的字符时,就得想到用{}或者map来处理,遍历完字符串中的字符后,取出出现次数为 1 的字符,并返回索引。


function firstUniqChar(s) {  let map = {};  for(let i = 0; i < s.length; i++) {    if(map[s[i]]){      map[s[i]].count = map[s[i]].count+1    }else {      map[s[i]] = {index: i, count: 1}    }  }  for(let i in map) {    if(map[i].count===1) return map[i].index  }  return -1}
复制代码

2、Review 读一篇英文文章

《Bored? 7 Fun Things You Can Build》原文链接:https://medium.com/better-programming/bored-7-fun-things-you-can-build-91833439b5d4


《无聊? 你可以构建的 7 件有趣的事》


From Tetris to smart contracts and more

从俄罗斯方块到智能合约等等


There is no real secret when it comes to becoming a great developer. The thing that separates great developers from mediocre developers is the effort they’ve put in. Unfortunately, there are no shortcuts. Getting your hands dirty is what will make you grow as a developer.


成为一名伟大的开发人员并没有什么真正的秘密。优秀的开发人员和平庸的开发人员的区别在于他们所付出的努力。不幸的是,没有捷径可走。亲自动手是使你成长为一名开发人员的原因。


So while you’re on your way to becoming a fantastic developer, why not do it making something that’s actually fun to build?


因此,在你努力成为优秀的开发者的同时,为什么不去做一些真正有趣的事情呢?


What’s fun to build? You’ve probably thought about this for a while. You want to build something but you don’t know what…well, let me help you out.


什么是有趣构建?你可能已经考虑了一段时间了。你想开发一些东西,但你不知道…好吧,让我帮你。


In this piece, I’ll share seven projects with you that are both challenging and fun.


在这篇文章中,我将与您分享七个既具有挑战性又有趣的项目。


Project 1: Hardware That Waters Your Plants


项目 1:浇灌植物的硬件


This is a project I’ve been wanting to work on for myself for quite some time. When developing, I spend a lot of my time on web development. But software development is just so much more! If you like the combination of software and hardware this project is for you.


This project aims to water your plants automatically. All you need for this is an Arduino (or Raspberry Pi), a moisture sensor, and a water pump. The goal is to write a piece of code that keeps your plants alive for as long as possible.

What you’ll learn:The basic usage of an Arduino (or Raspberry Pi).Reading sensors.The interaction between software and hardware.


这是我很长一段时间以来一直想为自己工作的项目。在开发时,我花了很多时间在 Web 开发上。但软件开发远不止于此!如果你喜欢软件和硬件的组合,这个项目适合你。


该项目旨在自动为您的植物浇水。您所需要的只是一个 Arduino(或 Raspberry Pi),一个湿度传感器和一个水泵。目标是编写一段代码,让您的植物尽可能长时间地存活。

您将学到什么: Arduino(或 Raspberry Pi)的基本用法。 读取传感器。 软件和硬件之间的交互。


Project 2: Tetris


项目 2:俄罗斯方块


Building Tetris is a great way to get a feeling of how games are developed from a basic perspective. If you want to make an app you could use Swift for this project. If you want to make this using HTML5, you could go for a JavaScript framework, like React or Vue. Things you’ll learn:The movement of entities.The detection of key presses.Collision detection.


构建俄罗斯方块是从基本角度了解游戏开发方式的好方法。如果你想做一个应用程序,你可以在这个项目中使用 Swift。如果你想使用 HTML5 来实现这一点,你可以选择 JavaScript 框架,如 React 或 Vue。

您将学到的东西: 实体的移动。 按键检测。 碰撞检测。


Project 3: Smart Contract


项目 3:智能合约


Cryptocurrency has been a hot topic for a few years now. Despite this, there still aren’t many developers capable of writing smart contracts.Many blockchains that use smart contracts — the Ethereum blockchain currently being the biggest of them. The programming language that’s used for these Ethereum smart contracts is called Solidity.To get started with writing a smart contract you could start with a smart contract that sends transactions. If you want a more advanced smart contract, you could make one that functions as an escrow.What you’ll learn:A whole different mindset when it comes to programming.Blockchain.The basics of Solidity.


几年来,加密货币一直是一个热门话题。尽管如此,仍然没有多少开发人员能够编写智能合约。 许多使用智能合约的区块链——以太坊区块链目前是其中最大的。用于这些以太坊智能合约的编程语言称为 Solidity。 要开始编写智能合约,您可以从发送交易的智能合约开始。如果你想要一个更高级的智能合约,你可以制作一个作为托管的智能合约。

您将学到什么: 在编程方面,一种完全不同的心态。 区块链。 坚固性的基础知识。


Project 4: Classification of Iris Flowers


项目四:鸢尾花的分类


If you are new to the world of machine learning, then the classification of iris flowers is a great way to get a grasp of what machine learning is all about. That’s because this project is known as the “Hello World” of machine learning projects.The aim of this project is to classify iris flowers among three species (setosa, versicolor or virginica) based on measurements of length and width of sepals and petals. This project is perfectly suited being made in Python. All you need to get started is the data set.What you’ll learn:You will get a grasp of machine learning


如果你是机器学习世界的新手,那么鸢尾花的分类是掌握机器学习的好方法。这是因为这个项目被称为机器学习项目的“Hello World”。 该项目的目的是根据萼片和花瓣的长度和宽度测量,将鸢尾花分为三个物种(setosa,versicolor 或 virginica)。这个项目非常适合用 Python 制作。您只需要开始使用数据集即可。

你将学到什么:你将掌握机器学习


Project 5: Contribute to Open Source


项目 5:为开源做贡献


If you’re not the type of person that likes doing solo projects, you could always choose to contribute to open source. It might seem scary at first sight but there are lots of projects that could use a little help.If you don’t feel comfortable enough to submit pieces of code, that’s fine. Contributing can be as simple as checking a pull request.Pick a project you like and start helping people out!Here’s a good starting point if you want to contribute to an open-source project on GitHub.What you’ll learn:Open source is fun and engaging, you meet awesome people.Huge variety in projects.Lots to learn from different people.


如果你不是那种喜欢做个人项目的人,你总是可以选择为开源做出贡献。乍一看似乎很可怕,但有很多项目可以使用一点帮助。 如果你觉得提交代码片段不够舒服,那也没关系。贡献可以像检查拉取请求一样简单。 选择一个你喜欢的项目,开始帮助别人! 如果你想为 GitHub 上的开源项目做出贡献,这是一个很好的起点。

您将学到什么: 开源是有趣和引人入胜的,你会遇到很棒的人。 项目种类繁多。 从不同的人那里学到很多东西。


Project 6: Creating Your Own Trading Algorithm


项目 6:创建自己的交易算法


Creating your own trading algorithm is a project that requires a lot of finetuning. But before you can start building your algorithm you should do some research on trading strategies. Once you’ve got your strategy figured out, you can use a free stock API, like IEX Cloud, to check current the prices of your stocks.Let the algorithm run for some time and see how it performs. There are plenty of stock simulators you can use that will let you play with virtual cash instead of real cash.What you’ll learn:Learning and implementing trading strategies (algorithm).Interacting with an API.You could go the extra mile by letting the algorithm decide which stocks or assets to buy.


创建自己的交易算法是一个需要大量微调的项目。但在开始构建算法之前,您应该对交易策略进行一些研究。一旦你弄清楚了你的策略,你可以使用一个免费的股票 API,如 IEX Cloud,来检查你的股票的当前价格。 让算法运行一段时间,看看它是如何执行的。您可以使用大量股票模拟器,让您使用虚拟现金而不是真实现金进行游戏。


您将学到什么: 学习和实施交易策略(算法)。 与 API 交互。 你可以通过让算法决定购买哪些股票或资产来加倍努力。


Project 7: Dashboard


项目 7:仪表板


There are lots of out-of-the-box projects available when it comes to dashboards — but nothing’s as fun as building your own!This is one of the easier projects from this list. Very useful for developers who are just starting out. You can make this in basic HTML5 and CSS but if you want to go the extra mile, add React or Vue into the mix.What you’ll learn:Web development basics, like HTML5 and CSS.Implementing graphs.Interacting with the database.Don’t want to do all the CSS yourself? Let Tailwind help you out!


在仪表板方面,有许多开箱即用的项目可用 - 但没有什么比构建自己的项目更有趣了! 这是此列表中较简单的项目之一。对于刚刚起步的开发人员非常有用。你可以在基本的 HTML5 和 CSS 中做到这一点,但如果你想加倍努力,那就把 React 或 Vue 添加到其中。


您将学到什么: Web 开发基础知识,如 HTML5 和 CSS。 实现图形。 与数据库交互。 不想自己做所有的 CSS?让 Tailwind 帮你!


Now it’s Your Turn!It’s time to do some real work and have fun while you learn new things. These projects should keep you busy for quite some time. Picked one and just go for it!I would love giving you feedback on your project — I’m looking forward to seeing the results.If you can’t have fun, there’s no sense in doing it — Paul WalkerHappy coding!


现在轮到你了! 是时候做一些真正的工作,在学习新事物的同时玩得开心了。这些项目应该会让你忙上一段时间。选了一个就去吧! 我很想给你关于你的项目的反馈——我期待着看到结果。 如果你不能玩得开心,那么这样做就没有意义——保罗·沃克 祝您编码愉快!

3、Technique/Tips 分享一个小技术

Vue3 defineEmits 获取 emit 执行后的返回值Vue3 defineEmits emit 获取返回值_直须的博客-CSDN博客

4、Share 分享一个观点

本周分享的观点是 “虚船触舟”

比如你正坐在船上,这时候有另外一艘船眼看就要撞上你的船了,但撞你的船上可能没有人,但是你不知道,这里你可能会怒吼:“要撞上了,快让开”。

结果撞上了,这时候,你可能就会破口大骂:“干嘛呢,你!你是不是瞎啊?你到底会不会开船啊,我这么大一条船在这,你看不到吗?快点让开,我还赶时间呢!” 但你骂了半天,结果发现船上根本没有人,就一艘空船,此时你的怒火一下就没有了。

这个故事来源于庄子“虚船触舟”的故事,可以看出,很多时候我们的怒火,并不是针对事情所引发的结果或者说不是事情的本身,是典型的“对人不对事”。

当一件事情发生时,如果是人为的,并且损害了你的利益,就可能会心生怒火。但如果是物为的,就无脾气可发。人如果太看重自己,无视别人,就很容易与别人发生争执。


#ARTS 打卡计划#  #30天 ARTS 打卡#


发布于: 刚刚阅读数: 4
用户头像

怂恿

关注

还未添加个人签名 2019-02-17 加入

还未添加个人简介

评论

发布
暂无评论
ARTS 打卡第一周_ARTS 打卡计划_怂恿_InfoQ写作社区