teleren/devto huggingface dataset:
C3AI IPO
Published: 2020-12-09 22:42:02

C3 AI 調高目標價到$42開始，
按照之前LAZR的數字來算，一開始會衝很高，一個小時大約會來到低點。但是這個低點也是之前最低點再加5-6%左右

C3 AI, 開盤，直接在$95 - $115的範圍。最多漲了170%。
根據這個來算，價錢會是(95+115)/2 * 1.05 = 102.5，或是把最低點*1.06 = 100.7

一開始，先放10股，買Market Price , 看市場行情。之後就零零散散的買。

結果，價錢在一個小時左右，大約就在100.7左右。
心太急，$102就急著買了200股，買下的時候，又再買200股。

後來，應該這個行情實在太高了，下午就往下拉。拉到$90左右。不知道還會下多少，就沒有動，明天再看。

最後價錢收到$92.49

============================
學到的是：
如果一開始就漲那麼多，要好好考慮，市場實在是過熱。2020年，大家買股都買瘋了。到Unlock的時候，應該會很快下來，最近要考慮怎麼下車。
下面這個文章有提到，Lockup一般是180天。
2021/6/6(星期天) is the lockup expire day.
之前就要注意一下價錢的變化。

參考文章：
https://www.ig.com/en/trading-strategies/what-is-an-ipo-lockup-period-and-how-do-you-trade-it--191018

=============================
另外的想法：
目前的股份有限，應該還是有足夠的人願意進來。
最近漲了30%-50%，應該就可以閃人了。
要補，6/6再來補。

SEC Filing
https://www.sec.gov/Archives/edgar/data/1577526/000162828020016443/c3ais-1.htm

=============================
和阿叔談過，
留自由資金3成，進可攻、退可守。
一開始過高，如果被套牢，可以等到下一次到達這一波的高點之後，再加碼。
如果一直下，不知道會下到哪裡，等到過這一波的高點，套牢的都解套了，又再上去，就是大家看好這個股票。
再繼續追下去。

在大盤利空的時候，分析師不看好，但是股價不跌，就是法人看好這個方向，這時候，就可以加碼。
Start a new library with TS in under 30 seconds
Tags: typescript, tdd, jasmine
Published: 2020-12-09 22:27:12

Have an awesome idea you wanna try?

Great! 

You can start coding it in under 30 seconds with Typescript, Jasmine, TDD and even a coverage report!

```bash
mkdir -p idea/src
cd idea
npm init -y && npm i -D @types/jasmine \
 ts-node typescript nodemon nyc jasmine
```

Now open `package.json` and add this to the "scripts" section:
```json
...
"scripts": {
  "test": "./node_modules/.bin/ts-node ./node_modules/jasmine/bin/jasmine --config=./jasmine.json",
  "tdd": "./node_modules/.bin/nodemon -w src -e ts -x ./node_modules/.bin/ts-node ./node_modules/jasmine/bin/jasmine --config=./jasmine.json",
  "coverage": "./node_modules/.bin/nyc -r html -e .ts -x \"src/**/*.spec.ts\" npm run test",
  "build": "tsc --project ./tsconfig.json"
}
...
```

Doing good!

Now create a `jasmine.json`
```json
{
  "spec_dir": "src",
  "spec_files": ["**/*.spec.ts"]
}
```

Still counting? Okay, last one!

Create a file called `tsconfig.json` with this:

```json
{
  "compilerOptions": {
    "moduleResolution": "node",
    "target": "es2019",
    "lib": ["ESNext", "DOM"],
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "typeRoots": ["./node_modules/@types"],
    "types": ["jasmine"],
    "outDir": "./dist"
  },
  "include": ["./src/**/*.ts"]
}
```

You did it!

Now create a folder named `src/`, run the test suite with `npm run tdd` and start coding!

When you're ready to show it to the world, `npm run build` and publish to NPM :)

And make sure your package.json is up to date! Change name, version and main file if needed.

By the way, did you know you can also [automate your releases to npm?](https://dev.to/darlanalves/automated-semantic-releases-with-npm-and-github-actions-1bmj)
The Ultimate Python Guide For Beginners
Tags: python, beginners, codenewbie, tutorial
Published: 2020-12-09 22:18:20

Python has become one of the fastest-growing programming languages over the past few years.

Not only it is widely used, it is also an awesome language to tackle if you want to get into the world of programming.

This Python Guide for Beginners allows you to learn the core of the language in a matter of hours instead of weeks.

You can download a PDF version of this guide: [The Python Guide for Beginners](https://renanmf.com/python-guide-beginners/).

## Table of Contents

* [Introduction to Python](https://renanmf.com/introduction-to-python/)
* [How to Install Python 3](https://renanmf.com/how-to-install-python-3/)
* [How to Run Python Code](https://renanmf.com/how-to-run-python-code/)
* [Syntax](https://renanmf.com/python-syntax/)
* [Comments](https://renanmf.com/comments-python/)
* [Variables](https://renanmf.com/variables-python/)
* [Data Types](https://renanmf.com/python-data-types/)
* [Type casting](https://renanmf.com/type-casting-python/)
* [User input in the command line](https://renanmf.com/user-input-command-line-python/)
* [Arithmetic Operators](https://renanmf.com/arithmetic-operators-python/)
* [Assignment Operators](https://renanmf.com/assignment-operators-python/)
* [Logical Operators](https://renanmf.com/logical-operators-python/)
* [Comparison Operators](https://renanmf.com/comparison-operators-python/)
* [Identity Operators](https://renanmf.com/identity-operators-python/)
* [Membership Operators](https://renanmf.com/membership-operators-python/)
* [Bitwise Operators](https://renanmf.com/bitwise-operators-python/)
* [Conditionals in Python](https://renanmf.com/conditionals-python/)
* [Lists](https://renanmf.com/python-list/)
* [Tuples](https://renanmf.com/python-tuple/)
* [Sets](https://renanmf.com/python-set/)
* [Dictionaries](https://renanmf.com/python-dictionary/)
* [`while` Loops](https://renanmf.com/while-loops-python/)
* [`for` Loops](https://renanmf.com/for-loops-python/)
* [Functions](https://renanmf.com/functions-python/)
* [Scope](https://renanmf.com/scope-python/)
* [List Comprehensions](https://renanmf.com/list-comprehensions-in-python/)
* [Lambda Functions](https://renanmf.com/python-lambda-functions/)
* [Modules](https://renanmf.com/modules-python/)
* [`if __name__ == ‘__main__’`](https://renanmf.com/if-__name__-__main__-python/)
* [File Handling](https://renanmf.com/file-handling-in-python/)
* [Organizing Files](https://renanmf.com/organizing-files-python/)
* [Object-Oriented Programming: Classes and Objects](https://renanmf.com/classes-objects-python/)
* [Object-Oriented Programming: Encapsulation](https://renanmf.com/object-oriented-programming-encapsulation-in-python/)
* [Object-Oriented Programming: Inheritance](https://renanmf.com/inheritance-python/)
* [Object-Oriented Programming: Polymorphism](https://renanmf.com/object-oriented-programming-polymorphism-in-python/)
* [Handling Exceptions](https://renanmf.com/handling-exceptions-python/)
express-session failing with typescript (@types/express-session)
Tags: typescript, express, security, errors
Published: 2020-12-09 22:10:58

### **Typescript can be weird.**

TL;DR 
The problem stems from `req.session` being immutable, and can fixed by bumping your `@types/express-session` version down to 1.17.0, as shown down below, [here](#solution).

## **The Problem**

This was supposed to be a longer post, but doesn't matter. 
A lot of people have been experiencing issues when using `express-session` with the new version of `@types/express-session`, since it straight up doesn't work. The documentation is scarce and outdated, and the comments next to the type declarations don't work.

By don't work, I mean the Request.Session (req.session) object is immutable, meaning that, for example, this block of code:

```ts
router.get("/", req => {
  req.session.username = "username";
  console.log(req.session);
});
```

Will throw a typescript error like: 

`Property 'username' does not exist on type 'Session & Partial<SessionData>'.`

Now, it should of course not be throwing this, in fact the reason it's doing so is this line of code:

```ts
interface SessionData {
  [key: string]: any;
  cookie: SessionCookieData;
}

```

being changed to this

```ts
interface SessionData {
  cookie: Cookie;
}
```

As pointed out in [this](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/49941) pull request.

** Long story short, it doesn't work. **

<a name="solution"></a>
## **The Solution**

The solution is of course reverting to an older version of `@types/express-session`, by running the following commands:

yarn:

```bash
yarn remove @types/express-session
yarn add -D @types/express-session@1.17.0
```

npm:

```bash
npm uninstall @types/ty
npm install -D @types/express-session@1.17.0
```

Have a nice time :P
Real-world UX part 2
Published: 2020-12-09 22:04:07

In the not so distant future - you'll be expected to understand UX / design-thinking / strategy _AND_ programming... 

Plan ahead!

This one is about defining the goals of a project (WAY BEFORE YOU START 'making' THINGS!)

(and - if you're going to watch these... you should really watch them in order: full list [here](https://perpetual.education/free-crash-course/))

{% vimeo 487065673 %}
How Minecraft: Pi Edition Is Being Brought Back From The Dead
Tags: programming, minecraft, raspberrypi, github
Published: 2020-12-09 22:04:01

# Wait, what? I never heard of a Minecraft: Pi Edition!
If you have never heard of Minecraft: Pi Edition, I wouldn't be surprised. Its an obscure version of Minecraft from 2013 that only received one update and only ran on Raspberry Pis. Yeah, it was obscure. Minecraft: Pi Edition is a modified version of Minecraft: Pocket Edition Alpha v0.6.1 that run son the Raspberry Pi. A scripting API was added and many Minecraft: Pocket Edition features lie Survival Mode were removed, presumably so there wasn't a free version of Minecraft: Pocket Edition floating around.

![Minecraft: Pi Edition Title Screen](https://dev-to-uploads.s3.amazonaws.com/i/4hzy2mcwxljwv1k64qs4.png)

# Why was it abandoned by the community?
There were many reasons for its abandonment. The first was the lack of normal Minecraft features like Survival Mode. Without these features, it just wasn't that fun. It also never received any updates, so it was permanently stuck with only the blocks and items in Minecraft: Pocket Edition Alpha v0.6.1. It also only ran on the Raspberry Pi, severely limiting the amount of people who could play it. The last straw however, was when the scripting API was ported to Minecraft: Java Edition, and then Minecraft: Java Edition was ported to the Pi. Now there was no reason to use it whatsoever.

![Limited Creative Inventory](https://dev-to-uploads.s3.amazonaws.com/i/imemwr0kslargww0vcxz.png)

# What Changed?
What changed was the 2020 global pandemic. Now millions of people were trapped in their homes, and very **very** bored. These people decided to team up, to do something truly challenging, they wanted to revive Minecraft: Pi Edition.

# First Steps
The first step was the release of MCPIL. A community launcher for Minecraft: Pi Edition made for the purpose of uniting the few existing attempts at modding the game. For instance, it had built-in support for the infamous Survival Patch from 2013 and its mod containing extensions to the scripting API.

![MCPIL](https://raw.githubusercontent.com/Alvarito050506/MCPIL/master/screenshot.png)

# Next Steps
The spark started to transform into a roaring wildfire with many new projects join the group. With things like MCBES (a WIP proxy to allow Pi Edition to join modern Bedrock Edition) and various implementations of RakNet (the packet protocol used in Minecraft: Pocket/Pi Edition). Later MCPI-Reborn was released, allowing Minecraft: Pi Edition to run on desktop Linux and including a more refined Survival mode mod.

![Modded MCPI](https://dev-to-uploads.s3.amazonaws.com/i/4x8ove20qzs5apa1p0ho.png)

# What Next?
Currently there are multiple projects in development including a rewrite of MCPIL. Any contributions are extremely appreciated!

![MCPIL Rewrite Progress](https://dev-to-uploads.s3.amazonaws.com/i/i1wgaxf5od1a73u1197t.png)

# Links
- [GitHub Organization](https://github.com/MCPI-Revival)
- [Discord](https://discord.gg/MDedhKY)
- [Website](https://mcpi.tk)
Iterables & Iterators in JS, Part III - "Advanced" concepts (YouTube tutorial)
Published: 2020-12-09 21:38:34

This is the last video of my 3 part Iterables & Iterators series!

This time we cover some "advanced" concepts, which are actually not *that* advanced - I just needed some name for this episode. ;)

And in the next video we will finally move on to long-awaited **generators**, so stay tuned!

Enjoy!

{% youtube vJLRRuVzTCQ %}
Your tests can also be your documentation
Tags: testing
Published: 2020-12-09 21:35:58

---
title: Your tests can also be your documentation
published: true
date: 2020-12-09 21:34:24 UTC
tags: testing
canonical_url: https://le0nidas.gr/2020/12/09/your-tests-can-also-be-your-documentation/
---

Tests help as make sure that our code works, provide us a safety net when we need to refactor and, when having proper test names, can be a good documentation describing what the code does.  
The last one can be especially helpful for both newcomers that need to understand the system and old timers that haven’t visited the code for a while!

A couple of _tricks_ for achieving good names are:

1. **Avoid describing _how_ the code does something and try to describe what it does**  
For example:  
`calling add(item) results in calling recalculate`  
is way too specific without providing anything meaningful, or anything that we wouldn’t get from reading the code.  
On the other hand:  
`a recalculation of the order's value takes place every time a new item gets added`  
shares an important information about the `Order`‘s behavior when adding an item.
2. **Avoid being too abstract**  
For example:  
`a customer can buy alcohol when she is of legal age`  
can help the reader understand how the code behaves but in a documentation you need specific values.  
So:  
`a customer can buy alcohol when she is older than 21 years of age`  
is much better because it also provides the exact threshold that our code considers for allowing someone to buy alcohol
maintainVisibleContentPosition prop for Android react-native
Tags: reactnative, android, opensource
Published: 2020-12-09 21:27:35

In react-native, [ScrollView](https://reactnative.dev/docs/scrollview) (and [FlatList](https://reactnative.dev/docs/flatlist)) component have support for a prop [`maintainVisibleContentPosition`](https://reactnative.dev/docs/scrollview#maintainvisiblecontentposition), which is really useful for chat-like applications where you want to see new messages scroll into place. Also you might need it in other applications where you need bi-directional infinite scroll. Although this prop is  only supported on iOS for ScrollView/FlatList. 

But it's easy enough to get it working Android by a simple wrapper. We at [Stream](https://getstream.io/) built this wrapper for our in-house [react-native chat sdk](https://github.com/GetStream/stream-chat-react-native), but we are making it public, in case it helps other devs from react-native community.

- NPM - https://www.npmjs.com/package/@stream-io/flat-list-mvcp
- Github - https://github.com/GetStream/flat-list-mvcp

## Installation

```sh
yarn add @stream-io/flat-list-mvcp
```

## Usage

```js
import { FlatList, ScrollView } from '@stream-io/flat-list-mvcp';

<FlatList
    maintainVisibleContentPosition={{
        autoscrollToTopThreshold: 10,
        minIndexForVisible: 1,
    }}
    ...
/>

<ScrollView
    maintainVisibleContentPosition={{
        autoscrollToTopThreshold: 10,
        minIndexForVisible: 1,
    }}
    ...
/>
```

Cheers and happy coding :)

Special thanks to [stackia](https://github.com/stackia) for [this](https://github.com/facebook/react-native/pull/29466#issuecomment-664367382) :)
How a small team of developers revived a dead version of Minecraft
Tags: minecraft, github, python, showdev
Published: 2020-12-09 21:14:46

####Minecraft Pi edition is a bad version of Minecraft... At least it used to be. What changed?

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8lmphp761j1iycup4gti.jpeg)


A few months ago Minecraft Pi Edition was regarded as the worst version in existence. It’s only redeeming quality, it’s modding API. 
However through the hard work and dedication of a few developers, it’s grown to be something much more.

##The Beginning

Minecraft Pi Edition was released in 2013 as a stripped down version of the pocket edition (version for phones) and even then it was a bad version due to its characteristic lack of survival mode.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8npwszvg9288978s2q32.png)

A few people tried to mod it, to little success. However a in 2020 a new project started, called mcpil which allowed Minecraft pi to really take off!


##Mcpil

Minecraft Pi Launcher or MCPIL for short is the project that allowed Minecraft pi to enter its renaissance. It supports full mod loading, a custom modding API, survival mode, fancy graphics, and so much more!

###Mod Loading
By default Minecraft Pi has a mod API but it takes quite a while to setup, mcpil allows you to launch certain mods when you join a world, and automatically use them.

###Survival Mode
MCPIL also exposes the mcpi-docker API which allows support for survival mode. It even includes hostile mobs which the original version did not support.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/adzi4jjwkhsnhc92orma.png)
Even beyond this, mcpi-docker supports crafting and farming which are also accessible through MCPIL.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/onoytfkh6w21ghs71g5w.png)

###And So Much More
There’s so much more that MCPIL and mcpi-docker can do that I just don’t have time to mention in this short post. 

If you like what you read check us out on GitHub at mcpi-devs/mcpil or by clicking the card below
{% github mcpi-devs/mcpil no-readme %} 

Also check out our website at https://mcpi.tk

If you really like what you see feel free to also join our discord at https://discord.gg/UuR7WNx

Thanks!
Why Linux is important for you as a developer
Tags: linux, productivity
Published: 2020-12-09 21:11:42

Hey, guys! Last week I was talking with my friend about switching to Linux but he was completely refusing changing windows and asked what would be changed in his life if he switched to linux ?

I was thinking about that last night, so I wrote this post to explain why I think that linux is just better.

I won't talk about things like open-source or free price, I will only talk about things directly touching my life.

# 1- No Obligations
That's an important point, as a Windows user I had to keep some programs installed in my system even if I don't need them, I had to stay with the same user interface and accept 100% CPU usage
**Simply I had to do what I don't want just because Microsoft wants that.**

In Linux, that's different. I can remove whatever I want, use my system the way I want and change the system's look easily.
**I become really free**

# 2- I update what I want when I want
Windows updates aren't an option, they happen without your knowlege and don't give you any choice.
I hate that, I can't accept using my internet for downloading things I won't use. 😡😤
In Linux, I get a polite request informing me about updates and give me control of every single part of them. It's my own decision, not Microsoft's. I don't want to find some new apps downloaded and installed without even telling me, why do I put a password in my computer if I will find new apps installed next time i boot my system.

# 3- Control is simple, fast and effective:
In Linux, I install everything from terminal, I update from terminal ans I live in terminal. Every complicated long task has a one line command, that's all. I don't want to open 10 windows searching for configuration places, that's stupid and productivity killer.

# 4- Terminal Emulators
We can't talk about Linux without talking about terminal, as a developer terminal is a very important part of your job and as we know Windows suffers from a big lack of terminal emulators compared to Linux.

# 5- Better Performance
With Linux you get better performance compared to Windows in the same machine specially with a lightweight distro and that's a fact!

# 6- Ready out of the box
In Linux you can find distros for everything from medicine to running cars and phone, you get an operating system ready with tools, drivers and more with 0 effort, And as developers there are distros ready with IDEs, Compilers, Decompilers, Interpreters... and that saves lot of time and energie.

# 7- Compatibility
Linux can work with any hardware configuration out of the box, and if your computer's components have some problems with Linux, the big supportive community will help you, just ask.

# 8- Security
Linux isn't used by the majority of users that's why it's viruses are really less than Windows's and the majority of them are used to hack specific users or servers, so don't worry about your security.
GitHub has dark mode now—will you switch?
Tags: darkmode, opinion, watercooler, features
Published: 2020-12-09 21:07:17

### **GitHub finally has dark mode implemented**

Now that GitHub has dark mode in their web browser, it brings up a question to me: Which one will you use? For me, it’s dark mode, due to my aesthetic choices. But, it’s not as soft and well-known as Discord’s, which it doesn’t have to be–but right now, it looks bright and harsh on the eyes. But it still comes with benefits, such as lower eye strain. Also, we were bound to get a dark mode on the website, since the GitHub app has dark mode. On the other hand, the light theme has had plenty of time to grow in our hearts, and is iconic of GitHub. 

**Tell me which one you’ll use and why!**
Bitcoin Revolution
Published: 2020-12-09 20:57:58

Bitcoin is probably probably the most well-recognized cryptocurrency but they arrive in many varieties which embrace Ethereum, Ripple, Litecoin and Bitcoin Cash. These are all types of digital or virtual forex collectively generally known as cryptocurrencies. The cause I recommend bitcoin to novices is that it has a powerful background and it’s right here to stay. As earlier said, it does big favors for merchants since you can buy it in fractions and trade it with some other cryptocurrency worldwide. Unlike different cryptocurrencies that comes into the market and die off, bitcoin has its existence 2009.

In most instances, the raw public blockchain information is on the market for anyone to build the explorer, however in the case of the petro, the regime has not made the raw information out there. Even as U.S. adversaries continue with conventional sanctions evasion schemes, they more and more use new improvements like cryptocurrencies and blockchain know-how to build sanctions resistant economies. Such efforts are unlikely within the brief time period to build large enough methods to offset U.S. sanctions.

Offering top quality products and app reviews to help you live a better life with both joyful health and good financials.

Offical Site : http://wealthcode.over-blog.com/bitcoin-revolution-reviews
https://social.smartzworld.com/read-blog/6572
Put Design Patterns on the Flavor Wheel
Tags: showdev, designpatterns
Published: 2020-12-09 20:56:41

> Photo by [Mae Mu](https://unsplash.com/@picoftasty?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/spinning-wheel?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText)

Do you like coffee? *I do.*

Do you like design patterns? *I do. Well, most of them.*

So I brought [Coffee Tasters Flavor Wheel](https://scanews.coffee/wp-content/uploads/2016/01/SCA-WCR-Flavor-Wheel-768x996.png) and [design patterns](https://en.wikipedia.org/wiki/Design_Patterns) together with a [design patterns wheel](www.designpatternswheel.com). Unlike flavor wheel, this wheel has only 2 layers. Inner layer represents pattern categories and outer layer represents concrete design patterns. I find this kind of category visualization quite nice.

![scroll rotation](https://media.giphy.com/media/GHE74VClT7q5FiqoHY/giphy.gif)

![change themes](https://media.giphy.com/media/jg0EV57otEuLXRWrmK/giphy.gif)