teleren/devto huggingface dataset:
Learning Rust by creating a terminal clock - Part 0
Tags: rust, cli, tui, github
Published: 2019-08-10 23:26:22

---
title: Learning Rust by creating a terminal clock - Part 0
published: true
description: Learning Rust by creating a terminal clock. 
tags: #rust, #cli, #tui, #github
series: Learning Rust by creating a terminal clock
---

I'm in the process of learning Rust. I am a believer in the best way to learn a language is to just start using it.

So with that, I've created https://github.com/bmitch/relogio which is a terminal clock, written in Rust and very much inspired by the https://github.com/rothman857/chronometer project.

The goal of this project is to build a cool terminal clock while learning Rust at the same time.

I've got a very initial version working. The code may not be the best but as I go I intend to clean it up as I learn things.

Are you experienced with Rust and want to provide feedback? That would be great, I welcome any and all feedback.

Are you also new to Rust and trying to learn it? Feel free to follow me as I continue on with the project. 

Have some feature ideas or found a bug? Please feel free to open an issue on the project. Thanks!

https://github.com/bmitch/relogio
Using a Chromebook for Web Development: Part 3
Tags: linux, chromebook, webdev
Published: 2019-08-10 23:22:04

I am writing this to update readers about the fix I have found for the Arm64 architecture issue I have been experiencing on my new-to-me, linux-enabled Chromebook. If you haven't read [parts 1](https://dev.to/angelarae63/using-a-chromebook-for-web-development-32pc) and [2](https://dev.to/angelarae63/using-a-chromebook-for-web-development-part-2-4e9f), they are short reads and worth your time if you are considering a Chromebook for development.
I was able to easily install linux from my settings, but began to have issues finding apps (.deb files) that would work on my arm64 machine. 
This has been resolved, however, by installing the Gnome Software Center on my Chromebook. 
Using instructions found on [Chrome Unboxed](https://chromeunboxed.com/news/installing-gnome-software-center-chrome-os-linux-crostini), I entered the following command at the linux terminal:

>sudo apt-get install gnome-software gnome-packagekit 

Enter "y" to proceed and the packages install beautifully....

![Gnome](https://thepracticaldev.s3.amazonaws.com/i/tph9f2r675rjzdxw6a71.JPG)

Notice that these packages are all arm64...Whoo-hoo!
Once this has completed, run the following:

>sudo apt-get update
>sudo apt-get dist-upgrade

Wait for these to complete and restart your Chromebook. You are good to go. Here's what you should see when you open Software App in your linux files...a nice graphical interface where you can search for the apps that will run on your system and easily download them.

![GnomeCenter](https://thepracticaldev.s3.amazonaws.com/i/ujx4rm0ls8m9n5cpf77w.JPG)

So this issue has been solved to my satisfaction. I hope some of you will find this helpful! 


If you'd like to give this Chromebook Dev Life a try, I would like to make the following suggestions: 

1. Buy a Chromebook on the r/crostini list of linux enabled devices with the following caveat:
Get one with a 64-bit architecture: amd64 and x86.64 seem to be the best choices. *Or* Buy a [Pixelbook](https://www.amazon.com/Google-Touchscreen-High-Performance-Chromebook-Generation/dp/B07KP9QYRK/ref=sr_1_1_sspa?keywords=Pixelbook&qid=1565479149&s=gateway&sr=8-1-spons&psc=1&smid=A30EPR1Q8JVZG5&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUExUVI5S1VaMVk1SEo4JmVuY3J5cHRlZElkPUEwMDU3MTMwMUlVNlZVM1lCVkpUTCZlbmNyeXB0ZWRBZElkPUEwNzY2NDMwM09LM1hWV0hYNjRFNiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU=)
2. If you already have an arm64 device and would like more app choices, do what I did or don't. You may be perfectly happy with VS Code alone.
3. Go for an Intel processor and get *at least* 32gb of drive space, more is better, and 4gb of Ram (2gb will be too slow). 
4. Reddit [r/crostini](https://www.reddit.com/r/Crostini/wiki/index) and [Chrome Unboxed](https://chromeunboxed.com) are excellent resources for running linux with Chrome OS.

I have to say, I have been using my linux-enabled Chromebook for 2 weeks now and am absolutely loving it! My son's ASUS ROG Laptop is gathering dust. He's getting it back tonight.
React Context Provider Gotcha
Tags: react, context
Published: 2019-08-10 22:03:55

---
title: React Context Provider Gotcha
published: true
description: A journal entry after debugging state that didn't update between screens.
tags: react, context
---

I used a global state store in my React Native app for data that needs to be available to multiple screens. I used a library to do this: 
https://github.com/jamiebuilds/unstated-next, but it’s basically just a combo of React’s `useState` and `useContext`.

The problem was, screen B added data to the global store of things, then navigated back to screen A. But screen A would never have the updated state. It was almost like there were two separate stores, one for each page 🧐.

I was just beginning to pursue this thought when I remembered that React’s context “Provider” does make a new copy of the state for any children below itself in the tree. I was wrapping each of the pages in its own provider! Once I wrapped the whole app in a single Provider component, both pages were sharing the same state again, and page B’s triggered updates immediately reflected on page A.

#react #state #context
Have you met Mark? Head of Mentorship
Tags: showdev
Published: 2019-08-10 23:06:41

---
title: Have you met Mark? Head of Mentorship
published: true
description: 
tags: showdev
---

[Mark Locklear](https://twitter.com/marklocklear) is a web developer at the eXtension Initiative and has 20 years of IT experience including network administration, quality assurance, and software development. He is an Adjunct Instructor at Asheville Buncombe Technical Community College and is passionate about education and teaching students software development. He also served in the US Army from 1990 -2003 and the author of Learning Rails 5.He's also a huge old car fan. We are happy that this veteran has chosen to work with our students and the other mentors to ensure our troops get the help they have earned to get every advantage to enter the industry. If you are interested in volunteering as one of our mentors please fill out the contact form on the web app.
Meet The Board: Christina Morillo
Tags: showdev
Published: 2019-08-10 23:03:15

---
title: Meet The Board: Christina Morillo
published: true
description: 
tags: showdev
---

[Christina Morillo](https://twitter.com/divinetechygirl) is a technologist at Microsoft, combining almost two decades of experience in information technology operations and process development/implementations with an expertise in enterprise-level identity access management/Information Security. She is a native New Yorker and co-founder of Women of Color in Tech Chat (wocintechchat.com), creator of the #WOCinTech Stock Photo(s) Collection. When she is not spending time with her family, she is supporting others in the tech community as an advisor and mentor. She lives in New York City with her husband and children.
Meet The Board: Amanda Casari
Tags: showdev
Published: 2019-08-10 22:56:52

---
title: Meet The Board: Amanda Casari
published: true
description: 
tags: showdev
---

We are excited to have [Amanda Casari](https://twitter.com/amcasari) as a new addition to the Vets Who Code Board!

Amanda is a well-rounded Developer Relations Advocate / Product Manager / Data Scientist at Google Cloud. Hailing from the Navy, she is a great addition to our board for Operation Shake N’ Bake ( Half Technical, Half Business savvy board, or having half of a board that can understand what I am saying 😂). She will also be an integral part in pushing us as we focus on going further into web architecture with our web app.Let's give her a warm welcome!
A CSS POEM
Tags: beginners, growth, css
Published: 2019-08-10 22:05:57

---
title: A CSS POEM
published: true
description: I have always wondered what my first post will be about, since I have to make a move and not wait till I am sure about what to write. I decided a poem will be a good ice breaker. 
tags: beginner, growth, css
cover_image: https://thepracticaldev.s3.amazonaws.com/i/iydkyb6h4pnhvrhjtkzx.jpg
---


I struggle a lot with what to write to contribute back to the community I consume a lot from, I could not wait till I had the perfect article so I thought to break the ice with a poem, just maybe it will help me start the journey. The name of this poem is Style-sheet in honor of <b>CSS</b>, I am a <b>CSS</b> fanatic. I highlighted some CSS terms in italics, the rest are sort of obvious. 

<h1> Style-sheet </h2>
 
Her body with that <em>alignment</em>, perfect <em>pargin</em>. Justifying her content could either start a <em>flex</em> or maybe put a space between us. 

She is in search of Mr perfect, not right. <quote>She just wants him to be positioned <em>relative</em>ly to her heart</quote>. His love should be <em>absolute</em> neither floating to the top or bottom, just clear to the eyes. 

Simple is her way of love, you can tell her mood by the <em>color</em> flushes in the background of her cheeks. <p> #Anurella </p>


<em>Notes</em>:
1. Pargin - is coined from padding + margin 
2. I played with the flex, positioning, float
3. Front Image Photo by [Micah Hallahan](https://unsplash.com/@micah_hallahan) on Unsplash

Thank you for reading and i hope to write more, either in poems or actual articles that help.
react-native-web tutorial quickstart
Tags: reactnative, reactnativeweb, react, pwa
Published: 2019-08-10 19:49:21

So after not finding an updated or proper getting started guide to react-native-web, I decided to create this.

#**TLDR**

To get things going,

`create-react-app my-app`
`yarn add react-native-web`

Now in `src/index.web.js` (create if doesn't exist)

```
// index.web.js

import App from './App';
import { AppRegistry } from 'react-native';
import * as serviceWorker from './serviceWorker';

// register the app
AppRegistry.registerComponent('App', () => App);

AppRegistry.runApplication('App', {
    initialProps: {},
    rootTag: document.getElementById('root')
});

serviceWorker.unregister();
```

Then delete `src/App.js` and create `src/App.js` again

```
// App.js
import React from 'react';
import { Text, View, StyleSheet } from 'react-native';

// react-native-web is aliased to react-native automatically by create-react-app

export default class App extends React.Component {
    render() {
        return (
            <View style={styles.container}>
                <Text style={styles.text}>
                    Welcome to react-native-web
                </Text>
            </View>
        )
    }
}

const styles = StyleSheet.create({
    container: {
        alignItems: "center",
        height: "100vh",
        backgroundColor: "black",
        justifyContent: "center"
    },
    text: {
        fontSize: 40,
        color: "silver"
    }
})
```

Then just `yarn start` and you should view that on the browser on `localhost:3000`



#**But, what's react-native-web?**

According to `necolas`'s github,

**React Native for Web** makes it possible to run React Native components and APIs on the web using **React DOM**. Check out the live demo of the React Native examples running on the web.

**Write once, render anywhere**: interoperates with existing React DOM components and is compatible with the majority of the React Native API. You can develop new components for native and web without rewriting existing code. React Native for Web can also render to HTML and critical CSS on the server using Node.js.

Who is using React Native in production web apps? `Twitter, Major League Soccer, Flipkart, Uber, The Times, DataCamp`.
TIL: Calculating n digits of pi using Chudnovsky Algorithm
Tags: pi, python, chudnovsky, todayilearned
Published: 2019-08-10 19:26:25

---
title: TIL: Calculating n digits of pi using Chudnovsky Algorithm
published: true
description: Python CLI app to calculate the value of Pi to n digits of precision using Chudnovsky Algorithm
tags: pi, python, chudnovsky, todayilearned, til
---

Today I stumbled upon [Chudnovsky Algorithm](https://en.wikipedia.org/wiki/Chudnovsky_algorithm) to calculate the value of π to N digits of precision. Python code for this algorithm looks like the following:

```python
import decimal

def compute_pi(n):
    decimal.getcontext().prec = n + 1
    C = 426880 * decimal.Decimal(10005).sqrt()
    K = 6.
    M = 1.
    X = 1
    L = 13591409
    S = L

    for i in range(1, n):
        M = M * (K ** 3 - 16 * K) / ((i + 1) ** 3)
        L += 545140134
        X *= -262537412640768000
        S += decimal.Decimal(M * L) / X
    
    pi = C / S
    return pi
```

I wrote a simple CLI to test this out:

```python
#!/usr/bin/env python3

import argparse
from lib import compute_pi

parser = argparse.ArgumentParser(description='Print n digits of pi.')
parser.add_argument('num_digits', metavar='N', type=int, help='no. of digits of pi to print')
args = parser.parse_args()

print(compute_pi(args.num_digits))
```

Here's the CLI in action:

```
> ./pi.py 30
3.141592653589741586517727315459

> ./pi.py 300
3.141592653589741586517727315457865035780252691261563179943288214795808630531389642185274931230804430454419117074147967105366083976712333542218321180274249883145873143454428446008580088034341219473373000151443532721504141865178673966393142941520166862874509797611548477147655085787688540025728361617601
```

The complete source code is [available in this Github repository](https://github.com/parambirs/n-digits-of-pi).
Tip for Preventing XSS in ASP.NET
Tags: dotnet, asp, aspnet, html
Published: 2019-08-10 18:43:04

I am going to show you an old but useful tip in order to prevent command injection in our forms.

First of all, We have this line that does not encode HTML:

{% gist https://gist.github.com/luisfernando-ch/308272d60f99cb6f15217ee453e670a7 %}

In order to encode correctly this output and avoid XSS attacks, you should convert it to this way:

{% gist https://gist.github.com/luisfernando-ch/e8193be2159a187846d4bf3887216e72 %}

However, ASP.NET MVC introduces this reduced syntax with the same purpose:

{% gist https://gist.github.com/luisfernando-ch/61c2d7309770c370c869745f8727045b %}

Did you see it?
The key is to replace <%= with <%:

Happy coding!
Finally found a way to search on GitHub for projects
Tags: github, react, javascript, reactnative
Published: 2019-08-10 18:36:17

---
title: Finally found a way to search on GitHub for projects
published: true
description: 
tags: github, reactjs, javascript, reactnative
---

Since my previous post I have been looking for projects to practice and learn standard practices. Most projects that interests me are about adding videos to your react/react-native app. I would also like to learn and explore how a data manipulation happens when the size is exponentially bigger and how to make chunks which can later be rendered.

The 2 suggestions for such thing I found is: 
- https://github.com/bvaughn/react-window
- https://github.com/bvaughn/react-virtualized


For searching, I have tried out some approaches and found out few ways in general on how can one search for such projects.


- Github has an article on this https://help.github.com/en/articles/finding-open-source-projects-on-github

- Kent C Dodds have also made a wonderful article : https://kentcdodds.com/blog/what-open-source-project-should-i-contribute-to


- Apart from this, going through your discovery feed may be a good option: https://github.com/discover

Alternatively, to find smaller projects you could try a custom search (this example I filtered for the react dependancy in package.json, with more than 10 stars, and written in js): https://github.com/search?l=&o=desc&q=%22react%22+filename%3Apackage.json+stars%3A%3E10+language%3AJavaScript&s=updated&type=Repositories

Another custom search for repositories containing issues tagged "good-first-issue": https://github.com/search?q=react+good-first-issues%3A%3E2

More on this: https://help.github.com/en/articles/helping-new-contributors-find-your-project-with-labels

As you guys suggested, I guess diving deep and just start doing it without thinking that it would be impossible would be the key here. Please do suggest more ways to do advanced searches on GitHub and other means like articles, blogs,etc.
🌐 How I host my projects on subdomains
Tags: tutorial, webdev, netlify, porkbun
Published: 2019-08-10 18:16:46

I like hosting my projects on subdomains and keep my main site focused on being the portal to my portfolio. Here's how I do it using [Netlify](https://netlify.com) and [Porkbun](https://porkbun.com).

## What is a [subdomain](https://en.wikipedia.org/wiki/Subdomain)?

A subdomain is a domain that is part of a larger domain; the only domain that is not also a subdomain is the root domain.

📐Example: 

```
root domain: www.mainSite.com

subdomain: someUrl.mainSite.com
```

## Why host projects on subdomains?

1. Doesn't bloat the main site's repo.
3. It's more flexible so that my projects can be different technology stacks.

## The steps

### Main site

#### Setup

1. Create a personal site.
2. Create a repo on GitHub for it.
3. Push it to the repo.

#### Deployment

1. On Netlify, I select the repo and master branch for my main site.
2. After it is successfully built and deployed, I have a someWeirdString.netlify.com that points to my deployed project. 
3. I'll rename it to something more easy such as `myPortfolio.netlify.com`
4. I setup the custom URL if I don't already have one at Porkbun.
5. Specify my custom URL such as www.myPortfolio.com.

#### DNS Settings

1. Login to Porkbun and select my custom URL details.
2. In the records, I update the ALIAS record that answers to my Netlify subdomain, which is `myPortfolio.netlify.com`.

It should look something like this:

|TYPE|HOST|ANSWER|
|----|----|------|
|ALIAS|myPortfolio.com|www CNAME myPorfolio.netlify.com|

3. After it propagates I move on to the next step and provision a SSL certificate.

### Add a subdomain

Once my main site is up and running with www.myPortfolio.com working, I'll setup another project from another repo to be found at `project.myPortfolio.com`.

1. Just like in the first previous steps, I add the project to Netlify and have it build and deploy.
2. I'll update the Netlify subdomain to `project.netlify.com`.
3. Then I go back to Porkbun and add another CNAME record to `www.myPortfolio.com`, it will look like this:

|TYPE|HOST|ANSWER|
|----|----|------|
|ALIAS|myPortfolio.com|www CNAME myPorfolio.netlify.com|
|CNAME|project.myPortfolio.com|project.netlify.com|

That's it! Now whenever I navigate to project.myPortfolio.com I'll go to my project which is auto deployed every time that project master branch is updated.

❗ Don't forget to add an escape hatch like a navigation icon that takes the user back to the main site and/or go another project...that's just good UX.

If you find this valuable, please leave a comment and follow me on [Dev.to @chiangs](https://dev.to/chiangs) and [Twitter @chiangse](https://twitter.com/chiangse), 🍻 cheers!
The new !dea PHP++ for 8 and above
Tags: php8, codequality, programming, webdev
Published: 2019-08-10 17:53:40

---
title: The new !dea PHP++ for 8 and above
published: true
description: What do you think about PHP and its progress? 
tags: PHP8, codequality, programming, webdev
---
What do you think about PHP and its progress?  Should PHP be forked? PHP still has many inconsistencies such as weird function names, weird returns, APIs, strict types need to be explicitly enabled, short tags from PHP 1 era, and similar legacy functionality. At the same time to fix this, major BC (backward compatibility) breaks should be done, which would break a lot of code out there. 
Recently, a brand new idea came to be, to fork PHP as we know it and develop it in two ways:
PHP (as we know it and with all the legacy things in it)
PHP++ -> P++ (modern, completely consistent).
https://wiki.php.net/pplusplus/faq
The Alternative of ngrok
Tags: productivity
Published: 2019-08-10 17:43:46

I like ngrok since it's easy to use and can use it for free. Then I saw an article on an alternative.


>Expose local servers to the internet
No installation, no signup
https://serveo.net/


### How to Use
```zsh
$ ssh -R 80:localhost:3000 serveo.net
```

#### Easy easy easy which is super nice
Syncing two Git Repos (By using below commands you can move contents of one git repo to another without losing history and tags)
Tags: git
Published: 2019-08-10 17:32:04

---
title: Syncing two Git Repos (By using below commands you can move contents of one git repo to another without losing history and tags)
published: true
description: By using below commands you can move contents of one git repo to another without losing history and tags.
tags: Git
---
**Cloning SourceRepo and Pushing that to TargetRepo**

*git clone --mirror SourceRepoURL*

The above git clone command will create a directory in your local machine with the name of your repo.

Change to that directory and add a remote to the target repo.

*cd SourceRepo
git remote add NEW-REMOTE TargetRepoURL*
It creates a connection with TargetRepo.
Here'NEW-REMOTE' is just a name, you can give your own Name. Remember that name to sync these two repos.

*git push NEW-REMOTE --mirror*
It will push all folders and history of Source repo to Target Repo.


**Syncing Those two Repos**

After cloning source and pushing to target if you make any more  changes to source simply use below two commands from the same directory to sync.

*git fetch origin*
To pull SourceRepo changes

*git push NEW-REMOTE --all*
To push(sync) SourceRepo changes to TargetRepo.