teleren/devto huggingface dataset:
Code Questions Bot
Tags: showdev, python, contributorswanted
Published: 2020-01-25 20:54:24

### Why build a tweeting bot?

It all started with a fleeting idea and a tweet. Wait, don't all projects start this way?

{% twitter 1217882454436012037 %}

So, with 80% of respondents giving a positive reaction to the idea, I started to plan the project.

I started thinking about the goals, why I was building it, and how it could have a big picture impact. So, here's the main goal:

> Have fun & meet other devs while learning and helping each other learn.

There is a secondary piece. I want to make it easy for people to take their first steps into open source contributions. I included a section on contributing in the `readme.md`. This should make it a bit easier for someone new to contributing on GitHub.

{% github http://github.com/VickiLanger/code-questions-bot %} 


### Requirements

The bot was to be built with Python and Tweepy. 
Previously, I made the [Vets Who Code Bot](https://dev.to/vickilanger/vetswhocode-retweet-bot-3j97). So, I already had some experience with Tweepy.

This bot was a little different because I was looking to `update_status`. I spent a lot of time trying to figure out how to do this and made it out like it was going to be super complex. It turned out to be a rather tiny piece of code that actually does the work.
```python
api.update_status(question)
```
Yup, that's pretty much it. There are a few other lines and some importing files to other files, but that's the statement that does the job.

---
### What Next?
- Work on automating this follow-up tweet that I've been putting on each question.
{% twitter 1221078387885776898 %}
- Add more questions
- Write a Dev.to post detailing the steps to making open source contributions with GitHub

### Links
Here's the [Code Questions Bot](https://twitter.com/CodeQBot)
{% post https://dev.to/vickilanger/trivia-and-facts-1g21 %}
{% github http://github.com/VickiLanger/code-questions-bot no-readme%}
Test Driven Development - not Unit Test Driven Development
Tags: tdd, codequality, testing, discuss
Published: 2020-01-25 19:42:45

---
title: Test Driven Development - not Unit Test Driven Development
published: true
description: We often give a lot of focus on TDD and the lowest level of testing: "unit" - but is it always the right choice?
cover_image: https://thepracticaldev.s3.amazonaws.com/i/hh726mmgclmpysfaf6w9.png
tags: tdd, quality, testing, discuss
---

A lot of us in software development would have heard of Test Driven Development. Some swear by it - some hate it and say it is fully unnecessary. 

In my opinion people often attribute TDD to the following:
``` 
Write unit test -> Red -> Write code to make it pass -> Green -> Refactor
```

Now although this is one of the approaches that is very common I think the focus is too often given to the lowest level of testing: “unit”.

The practice is called Test Driven Development and not Unit Test Driven Development and a more accurate and common example of flow is:
```
Test case -> Red -> Write code -> Green -> Refactor
```

Unit tests are a wonderful technique in our toolbox to help us navigate the problem and keep us laser-focused, but it’s not an antidote to all coding problems. Sometimes in smaller pieces of software it is a lot more valuable and straight forward to write an Integration test first or even an end-to-end test.

Example: In AWS Lambda it is easier to have an end-to-end test that will not only test the result of the function but can catch any permission issues, this is a more likely scenario of something going wrong in AWS world :)

Of course you could argue that what I am describing is Acceptance Test Driven Development (ATDD) - and you would be right. But my main point I am trying to put across: Unit tests are useful when you break down bigger pieces of problem to help find a solution, but at some point the higher level tests are more useful - especially on smaller codebases. For example a small service.

To do Test Driven Development you don’t have to concentrate on “unit” as long as you understand the trade-offs that come with it, for example, less granular feedback of test cases and risk of over-engineering a solution.

One thing for sure: quality and tests are important. Make sure that whatever you do it helps you deploy your code with confidence.
Time to Git to it - Creating a repo from the command line
Tags: git, github, basics
Published: 2020-01-25 18:54:33

Coming from Flatiron there is a checklist of things I'm required to do each week during my job search. Although I've already been doing them I have not been tracking them until recently. One of the things being tracked is one of the basics I struggled with during my time at Flatiron: using Git and Github. Knowing that I will be required to make a minimum of 5 Git commits per week I've decided to review some Git basics. 

![](https://pics.me.me/github-stack-code-stack-overflow-github-code-overflovw-compiling-github-41987107.png)


Generally, I create a new repository on the GitHub site, but did you know you can actually do this from the terminal?
To begin, navigate to the directory you wish for this new repo to live. If you have access to the curl command which comes built-in with Mac, you can create a repository from scratch by making a call to the [GitHub API](https://developer.github.com/v3/repos/#create). 
 
Send a post request using the following:
`curl -u "YourGitHubUsername" http://api.github.com/user/repos -d '{"name":"Name of Your Repository"}'`

When you enter, you will be asked for your GitHub password.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/zu1bsdfyjegr5pr0jsaw.png)
You've just created a new repository from the command line!
Next.js persistent state with React hooks and localStorage. How to make it work?
Tags: react, nextjs, discuss, help
Published: 2020-01-25 18:45:28

I'm trying to create persistent state with localStorage and React hooks in Next.js SSR app and everything seems to look good but when I reload page after update my data I'm getting error:

 > Warning: Text content did not match. Server: "0" Client: "5

What can I do to repair that? This is my code:

 

```javascript 
//  src/utils/Store.js

import React, { createContext, useContext, useReducer, useEffect } from "react";
import lscache from "lscache";
import Reducer, {initialState as defaultState} from "../utils/Reducer";
const StoreContext = createContext();
  
const initialState = lscache.get('state') ? lscache.get('state') : defaultState;

 export const StoreProvider = ({ children }) => {
    
  let [state, dispatch] = useReducer(Reducer, initialState);

  useEffect(
    function saveStateToLocalStorage() {
      lscache.set('state', state) 
    },
    [state]
  );

  const updateStateFromLocalStorage = () => {
    const newState = lscache.get('state') ? lscache.get('state') : defaultState;
    dispatch({ type: "updatefromlocalstorage", newState });
  };

  useEffect(function watchForChanges() {
      window.addEventListener("storage", updateStateFromLocalStorage);
    return () => {
      window.removeEventListener("storage", updateStateFromLocalStorage);
    };
  }, []);

  return (
    <StoreContext.Provider value={{ state, dispatch }}>
      {children}
    </StoreContext.Provider>
  );
};
 
export const useStore = () => useContext(StoreContext); 
 

```

Working example in codesandbox:

{% codesandbox s0hu8 %}

[![Edit intelligent-lamport-s0hu8](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/intelligent-lamport-s0hu8?fontsize=14&hidenavigation=1&theme=dark)
What more can a CDN do on the JAMstack?
Tags: jamstack, jamuary
Published: 2020-01-25 18:29:34

Compared to their predecessors, modern CDNs are not limited in their capacity and can do a lot more than serve static assets. The emergence of edge computing bolstered modern CDNs with the capability to handle crucial business logic like redirects and authentication at the edge. By forgoing the extra trip to the origin server, edge logic at the CDN layer brings the server ever closer to the user. With the increasingly blurred distinction between what an edge server can do and what an origin server can do, CDNs are increasingly being referred to as Application Delivery Networks (ADNs). With an ADN, logic once reserved for origin servers an now be implemented at the edge. Cache invalidation is one such example of this. In the context of an ADN, a new site build invalidates the old cache and replaces it with the updated content. Given the difficulty of managing the cache of a globally distributed network of edge servers, a CDN/ADN that updates its own cache quickly and reliably with every site build is incredibly convenient. This is doubly the case since CDNs of the past used to rate limit the cache purge and provided little control over how the cache was managed.

The ability to run functions at the edge is yet another powerful feature of the CDN. Previously, functionality like A/B testing, authentication and form validation could only be handled at the server level. The introduction of Cloudflare workers and Amazon Lambda@Edge has made it possible to execute functions from the edge layer and provide dynamic functionality to a JAMstack site without the added cost of a server. Running functions at the edge layer means that content can now be delivered with close to zero origin infrastructure. On the fly functionality like image optimizations, and access control can also be achieved with this model. The advancements in CDN technology has been a key catalyst for the rise of the JAMstack. If you're keen on learning more about the advances of the CDN, check out [Netlify Edge, the ADN built by Netlify to deliver blazing fast sites and modern workflows.](https://www.netlify.com/products/edge/?utm_source=devto&utm_medium=netlifyedge-div&utm_campaign=devex)
The things you know that you don’t know
Tags: management
Published: 2020-01-25 18:25:16

You’re busy I get it, we all are. One of the most important things for a tech leader is not lost touch with the current trends and updates.
Actually, we can sum up the knowledge you should be up to date to the following 

categories:
**The stuff you know that you know you need to updated about**
**The stuff you know that you don’t know**
**The stuff you don’t know that you don’t know**

##**“The Stuff you know that you know toy need to be updated about”**
If you’re using ReactJS or .NET Core, you still have to make sure you’re up to date with the latest changes. 
You might be missing the new functionality of C# 8 that can make you life easier or you’re might be struggling with bugs that were already fixed in the latest version.
How should I get the info?
I can assume you already part of some community , you already follow some sub-reddits or some blogs. If not , you should. In addition, sign up for updates, get email weekly summaries or even just make sure to check the landing page of your favorite framework once a week (make a reminder!)

##**“The stuff you know that you don’t know”**
You might have heard that Python is getting a lot of attention since AI, Machine learning and Deep learning are on the rise or you heard that everyone is using Redis, but you know nothing about it. As a tech leader you should get at least an overview of the topic, take a note and if you think you might need it in the future, you’ll be able to dive it.
How should I get the info?
You should really try to follow the trends by googling about it from time to time. I find educational sites like “Pluralsight” very useful to get me started. Some of the courses offer great overview on various topics and are a good starting point to learn about new stuff.

##**“The stuff you don’t know that you don’t know”**
Since we’re all very busy with our important tasks, we might not even know that Blockchain is a thing. Since software development is big and vast, we tend to try and focus on our own technologies. That might do for regular developers but if you’d like to be considered as a tech lead, you have to know what’s up with the outside world.

##**How should I get the info?**
Check out the most popular meetups at meetup.com. Search for those you know nothing about, if you’re a back end guy, go for the front end ones, if you’re working in a corporate environment, check out the ones for startups. Try to attend one every couple of months.

As a tech leader, we are expected to have a deep understanding of our core technologies but adding tools to your “tool belt” is super important. You should always look for the next thing and encourage your developers to do the same.
a great article on the history of IE
Tags: ie, microsoft, browsers
Published: 2020-01-25 18:09:41

---
title: a great article on the history of IE
published: true
description: 
tags: ie,microsoft,browsers
---

This is a great write up on the history of IE.

https://schepp.dev/posts/today-the-trident-era-ends/

Great to read all of the innovations that came from those times.

This is the money quote (for me at least) at the end of the article


> The final nail in the coffin was that after the release of Internet Explorer 6, Microsoft decided to tightly couple new Internet Explorer releases to Windows releases. So they dismantled the Internet Explorer team and integrated it into the Windows product team


Somewhere in MS there is probably one or more people that made that choice. It was a REALLY bad choice. I remember at the time being an end user of IE and a computer science dude that I actively thought what a short sided dumb choice it was.

That choice and the group/person who made it singly killed IE. I am sure there are some other mitigating factors.

Good stuff.
Do you ask for "offline" test project when applying for job?
Tags: career
Published: 2020-01-25 17:40:40

General process of getting hired includes interview with, probably, some time dedicated to assessing technical skills of pretender. It usually starts with talks about past projects (if any) and / or bulk of technical questions.

Sometimes (rarely enough) I'm proposed to try do some **"offline test project"** - like write such and such server, collecting such and such incoming data, displaying them so and so etc.

**What is your experience and your opinion? How much time have you happened to spend on test projects? Were any projects really interesting for you?**

_For me usually such project may take from 4 to 20 hours and could be done in a few days or couple of weeks. One of the toughest was in Haskell (just because of the language) and perhaps another very long ago, when I first tried to apply for Java developer job._

I know some people frown upon this approach, regarding this as "unpaid job" which no one should be willing to do.

On contrary, I myself am usually eager to get such project. So I often ask for it (though they are still rare). Surely it will take some time - but there are advantages (in my opinion):

- it usually gives better understanding about what technologies people use on their project and what task they solve
- for me "success rate" after submitting such projects is very high, about 80% (compared to about 25% after normal interviews).

_As for "unpaid job", being experienced myself, I know that for interviewer usually it is easier to do stuff him(her)self rather than explain to other and then fix other's clumsy errors etc. So it is rather "free exercise", never "free job". Just an opportunity to learn._
You timetravel to when you were a kid, and past-you wants to learn to code. How would present-you teach them?
Tags: codenewbie, discuss, motivation, teaching
Published: 2020-01-25 17:32:37

---
title: You timetravel to when you were a kid, and past-you wants to learn to code. How would present-you teach them?
published: true
description: 
tags: #codenewbie #discuss #motivation #teaching
---

What languages/technologies would you use, what concepts would you start with, and how would you make it fun for past-you?
Simple Web Development Starter Pack for future projects
Tags: webdev, html, javascript, css
Published: 2020-01-25 17:01:56

###Hello DEV community!

I have created something that may make my (or your) life easier.
It's a simple boilerplate to use for new projects.
It includes basic setup with Parcel bundler, Babel, Sass and recommended ESLint configuration (can be easily configured with your favourite set).

Thanks to it I no longer have to spend time on configuring project from the scratch. I found it a good idea to share GitHub repo here with DEV community.

[Here](https://github.com/adamwojnicki/web-dev-starter)  

Some of you may find it useful. 
I am also open for any feedback and opinion on this. I would really appreciate it.

For now I wish you peaceful weekend and happy coding! :)

Adam
How to Install React Native with Expo - Quick & Easy
Tags: mobile, reactnative, react, expo
Published: 2020-01-25 16:43:35

---
title: How to Install React Native with Expo - Quick & Easy
published: true
description: learn to install React Native without stress
tags: #mobile #reactnative #react #expo
---
 

Hey there!, so you want to get into mobile development or you're already familier with mobile development and you want to install/set-up React Native on your machine, but your machine is slow😥 and or you live in a country where the cost of good internet data is quite expensive so you can’t afford to install Android studio or Xcode

Never say never!, after reading this you'll have React Native up and running on your machine without consuming ridiculous amount of space on your machine with the help of this life saver called Expo!, Lets get started.

####STEP 1 - Install Node.js
If you have the Node 10 LTS or greater installed on your machine. kindly move to the next step!, If you dont, visit [nodejs website](https://nodejs.org/en/) to install the recommended version for your OS.

####STEP 2 - Install the Expo CLI
We'll install Expo CLI with npm, npm comes along with Node, you can confirm this by running the following command.
```zsh
npm -v
```
it will print the version of npm installed in your machine.

Now, we install Expo CLI by running the following command:
```zsh
npm install -g expo-cli
```

####STEP 3 - Create a new React Native project
Run the following commands to create a new React Native project called "NewProject":

 ```zsh
expo init NewProject

cd NewProject
npm start # you can also use: expo start
```

Awesome!!, now you've successfully installed and set-up a new project, next step you'll learn how to run your app.

####STEP 4 - Running your React Native application
Install the Expo client app on your iOS or Android phone and connect to the same wireless network as your computer. On Android, use the Expo app to scan the QR code from your terminal to open your project. On iOS, follow on-screen instructions to get a link.

Congratulations!!, You have successfully installed React Native, go forth and build!!!❤️❤️❤️
Conditional Statement – JavaScript Series – Part 8
Tags: javascript, codenewbie, beginners, webdev
Published: 2020-01-25 16:19:31

Up until now we never wrote any condition in our code, we just write one line code and executed those. But now we are going to learn about conditional statements in JavaScript.

There are
- if
- else
- else if &
- switch
these are available in JavaScript to write conditions. You can write ternary operators too. But for now let's just focus on if statement.

This is like English. We'll write if first then first brackets and in the brackets we'll write the condition and finally there will be second brackets where we'll write what we want to do. Look at this code -

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/5jq2n3mttny8d2uk4whr.png)

Now let's break it down from the way. First we store midoriya string into the name, then we checked if the name is equal to midoriya then we just print in console a new string. This is easy right ? Just it's almost like plain English

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/5jq2n3mttny8d2uk4whr.png)

Else part is easier also. If the condition doesn't match then else part will work. look here -

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/kw18he3i0e7k8mlbv9r5.png)

Now we'll learn about the else if. But let's change the name to "todoroki" first.

Like before if midoriya doesn't match then always the else part was printed, but now we want to check if the string is todoroki or midoriya or none of them. We can do it easily by just using a new else if(conditions) - 

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/kxh7rd9a5707fc3q6d5l.png)

So finally what is our code ?
```
if(condition) {
block of code 
} else if (condition) {
block of code
} else {
block of code 
}
```
Let me know if you understand this part clearly or not!

You can see the graphical version here
{% instagram B7v5KMIlEG6 %}

Source Codes - { Check commits }
{% github nerdjfpb/javaScript-Series %}

Originally it published on [nerdjfpbblog](https://blog.nerdjfpb.com/javascript-part-8/). You can connect with me in [twitter](https://twitter.com/nerdjfpb) or [linkedin](https://www.linkedin.com/in/nerdjfpb/)!
Best Way To Validate Email In Javascript
Tags: javascript, regex, tutorials
Published: 2020-02-05 07:41:18

---
title: Best Way To Validate Email In Javascript
published: true
date: 2020-01-25 15:30:38 UTC
tags: Javascript,javascript,regex,tutorials
canonical_url: https://codesquery.com/validate-email-javascript/
---

Javascript is one of the most trending programming language these days. Be it frontend development or backend development, Javascript used widely in almost every field of web development. While development of any websites or applications using the Javascript, we have to create a contact form, signup form, sign in form or any other type of [...]

The post [Best Way To Validate Email In Javascript](https://codesquery.com/validate-email-javascript/) appeared first on [CodesQuery](https://codesquery.com).
Place to see other dev's side project
Tags: showdev, watercooler
Published: 2020-01-25 15:11:22


I like to see other developers' work to get inspired. Currently, I am checking these websites.

showdev in dev.to(here)
[r/sideproject](https://www.reddit.com/r/SideProject/)
i-made-this in [reactflux](https://discordapp.com/channels/102860784329052160/312761588778139658)
[showHN](https://news.ycombinator.com/show)
[indie hacker](https://www.indiehackers.com/)


If you know any other websites, please share it!