teleren/devto huggingface dataset:
we are anxio.us: a collection of mental health and wellness apps
Tags: showdev, beginners, mentalhealth, wellness
Published: 2019-07-19 14:37:31

---
title: we are anxio.us: a collection of mental health and wellness apps
published: true
description: Need a reminder to think about things you're grateful for, or just a break from workday stress?
tags: #showdev, #beginners, #mentalhealth, #wellness
cover_image: https://thepracticaldev.s3.amazonaws.com/i/te055xq06981qeskk8s8.jpg
---

Hello, DEV! 

A few months ago I posted my [Three Good Things](https://three-good-things.glitch.me) app, and I was so happy that people seemed to find useful. Later that month, I deployed m1 of a [worry tree app](https://worry.netlify.com) that I use constantly to get myself out of thought loops.

I'm finding that I really like making these kind of tools, and thought it was probably time to put up a simple site to compile all of them together. 

So in my proudest moment, I purchased [weareanxio.us](https://weareanxio.us) (get it? Anxious? _anxio.us_? I'm so glad my partner thinks I'm funny.) and yesterday, [I deployed to Netlify](http://we-are-anxio.netlify.com). 

I'm excited and proud - it's the first time I've successfully deployed from Github 😂 and while the design iterated a bit from my initial sketches, it's really cool to see my vision live out there in the world.

In addition to Three Good Things and the worry tree, there's also m1 of a "calm down" bottle and some previews of other things I'm working on. At the bottom, there's also a list of resources for mental health and wellness. 

Thanks DEV.to for being so encouraging and helpful along the way, and I hope that you find something helpful or useful here!
3 Different ways to cOmbine Arrays in Javascript
Tags: node, coding, tutorial, javascript
Published: 2019-07-21 03:35:19

---
title: 3 Different ways to cOmbine Arrays in Javascript
published: true
tags: node,coding,tutorial,javascript
canonical_url: https://medium.com/better-programming/3-different-ways-to-combine-arrays-in-javascript-b273c9225e0d
---

### 3 Different ways to combine Arrays in Javascript

![](https://cdn-images-1.medium.com/max/1024/1*tsghe5KfLV_uirA8eJrIBA.jpeg)

Hi everyone this is my second post, and I am very excited, in this post I will talk about different methods of combining two or more arrays. Before We get started, check out my first post on how to create a twitter bot in javascript in a few steps.

[Create a simple yet effective Twitter BOt in nOdejs (javascript)](https://medium.com/@lelouchb/create-a-simple-yet-effective-twitter-bot-in-nodejs-javascript-4fbabc359404)

So let’s get started.

I am going to use Visual Studio code editor,

### 1. Concat()

The most basic way is using the concat method and concating two different arrays

Its very simple, you just have to define two arrays and combine them as shown

Remember the sequence matters

{% gist https://gist.github.com/lelouchB/2fef683a95a03e36e2b92177577cfb9f.js %}

OR

Another way to use concat is by concating two or more arrays in an empty array

{% gist https://gist.github.com/lelouchB/fe9bf281c7c43c2ee56c56ecd724f4cc.js %}

### 2. using … (Spread Operator)(ES6)(shortcut)

Now the second method is like a shortcut, you just have to store the values of two or more arrays in a different array using …(three dots) or spread operator, it is only available in ES6 version only and its very efficient way to combine arrays and is my personal favorite

{% gist https://gist.github.com/lelouchB/189d4c80062dbf8b9614a20dc7ccc666.js %}

As you can see, sequence matters here to

### 3. Merge Arrays with push

You can also use the push method to combine different arrays like as shown

{% gist https://gist.github.com/lelouchB/63c9ea71da3ade3e46e9946bb68868bd.js %}

As you can see first declare an empty array and then use push with … and the contents of the arrays will be copied in the desired array.

Remember if,

don't use … (spread operator), then the whole array will be pushed and you will get a nested array called **Two-Dimensional Arrays** (that is for another day’s discussion, so let’snot get into that)

{% gist https://gist.github.com/lelouchB/6d00059a9bc8a7fcc3dda3507252bbc2.js %}

That’s all thanks for being with me if you think there are any errors or you want to insight some information feel free to comment below

* * *
The 10 best projects for an impressive portfolio
Tags: discuss
Published: 2019-07-19 14:30:21

---
title: The 10 best projects for an impressive portfolio
published: true
tags: discuss 
---

Good morning guys, here to ask you today, what kind of personal portfolio projects do you think are the most interesting to create when it comes to web development? Something like a MEAN/MERN stack app, a clone. 

Do you think that is better to have many 'good' projects or a unique 'amazing' one?

Comment below ======>
How to create animated multicolour border on element 
Tags: css, rgb, bordercolor, gradient
Published: 2019-07-19 13:18:51

---
title: How to create animated multicolour border on element 
published: true
description: Quick example of how to create an animated multicolour border to an element using CSS only
tags: CSS, RGB, border-color, gradient
---

Here a quick example of how you can create an animated multi colour border effect to you element using CSS only


{% codepen https://codepen.io/polettoweb/pen/NQPypa default-tab=result %}

and here the youtube video and my channel:

{% youtube vCbYH3r4Uv8 %}
Daily Challenge #19 - Turn numbers into words
Tags: challenge
Published: 2019-07-19 14:07:11

---
title: Daily Challenge #19 - Turn numbers into words
published: true
description: Part of "Daily Challenge" series
tags: #challenge
series: Daily Challenge
---

We have another [challenge](https://www.codewars.com/kata/553a2461098c64ae53000041) from MMMAAANNN on Codewars. Today, you are asked to:

> Turn a given number (an integer > 0, < 1000) into the equivalent English words.
> For example: 
>
wordify(1) == "one"
wordify(12) == "twelve"
wordify(17) == "seventeen"
wordify(56) == "fifty six"
wordify(90) == "ninety"
wordify(326) == "three hundred twenty six"  

Good luck, and happy coding!

***
_Thank you to [CodeWars](https://codewars.com/), who has licensed redistribution of this challenge under the [2-Clause BSD License](https://opensource.org/licenses/BSD-2-Clause)!_

_Want to propose a challenge for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
Why so serious? #1
Tags: fun, twitter
Published: 2019-07-19 13:05:16

Take a pause. Put work aside for a minute and look how much fun is on Twitter. Many knowledgable people share tons of great tips there. But today, I gathered tweets containing entertaining and sometimes even very realistic content.

They come from different areas: [`#development`](https://dev.to/t/development), [`#design`](https://dev.to/t/design), [`#UI`](https://dev.to/t/ui)/[`#UX`](https://dev.to/t/ux), [`#philosophy`](https://dev.to/t/philosophy), office and ordinary [`#life`](https://dev.to/t/life). Sorted in random order without any preference and split across four posts.

I hope my selection will make your Friday even more joyful!

{% twitter 1053163060871884801 %}
{% twitter 788288674228305921 %}
{% twitter 787969734918668289 %}
{% twitter 1146488996052099072 %}
{% twitter 1120126789316009985 %}
{% twitter 1145216305240387584 %}
<center>👆 _(click the tweet to see all images)_ 👆</center>
{% twitter 896010517617180672 %}
{% twitter 1113831379152908288 %}
{% twitter 904697259345969152 %}
{% twitter 1093035828538818560 %}
<center>👆 _(click the tweet to see the original post)_ 👆</center>

This is the first post of the "not so serious" series:

- Why so serious? #1 👈
- [Why so serious? Collection of remarkable tweets #2](https://dev.to/rmnvsl/why-so-serious-collection-of-remarkable-tweets-2-10hj)
- [Why so serious? Collection of remarkable tweets #3](https://dev.to/rmnvsl/why-so-serious-collection-of-remarkable-tweets-3-mgo)
- [Why so serious? Collection of remarkable tweets #4](https://dev.to/rmnvsl/why-so-serious-collection-of-remarkable-tweets-4-28g0)

See you next Friday. If you want, put your favorite tweets in the comments section. 🎉
Generating Sequence Numbers In LINQ
Tags: csharp, linq, sequencenumbers
Published: 2022-11-08 15:00:07

---
title: Generating Sequence Numbers In LINQ
published: true
date: 2019-07-19 12:58:07 UTC
tags: Csharp,linq,sequencenumbers
canonical_url: https://coderethinked.com/generating-sequence-numbers-in-linq-query/
---

In this post, we'll see how to generate sequence numbers along with the data that we need in LINQ C#.

### Generating sequence numbers in SQL

In general, we can write a stored procedure something like this in `SQL` and then map this to a DTO or a ViewModel in C# so that we can get the sequence numbers along with the data.

```sql
SELECT 
    ROW_NUMBER() OVER (ORDER BY Column1) AS SeqNo, 
    DataColumn1, 
    DataColumn2 
FROM TestTable 
WHERE IsActive = 1
```

But, this isn't any good if we are using `Entity Framework`. Let's see what we can do to generate the sequence numbers in C#.

### Generating sequence numbers in C# LINQ

First, we'll write our query with DB context to fetch the data we want.

```csharp
var data = DbContext.TestTable 
                    .Where(a => a.IsActive)
                    .Select(a => new { 
                         DataColumn1 = a.DataColumn1, 
                         DataColumn2 = a.DataColumn2 
                     });
```

The above LINQ query just pulls Datacolumn1, Datacolumn2 from TestTable if executed. Now, to get another column with sequence number, we'll just enumerate the results of the above LINQ query so that we'll get the columns we want.

Luckily, the `IEnumerable` interface provides an overload of `SELECT` which can do this.  
Here is the `SELECT` overload definition.

```csharp
public static IEnumerable Select<TSource, TResult>(
this IEnumerable source,Func<TSource, int, TResult> selector)
```

So, we'll see how it's done.

```csharp
var withSequence = data.AsEnumerable()
                   .Select((a, index) => new 
                      { a.DataColumn1, 
                        a.DataColumn2, 
                        SequenceNo = index + 1 
                       });
```

As you can see in Line 01, we've enumerated the results from the LINQ to Entities and then we performed a `.Select()` on the enumerated set.  
The index will have a starting value of zero so we'll increment it to make the indexing start from 1. It's up to you.  
Here is the result.

![](http://coderethinked.com/wp-content/uploads/2020/01/output.png)<figcaption>output</figcaption>

### Why didn't we do it on the first LINQ query?

The first LINQ query is `IQueryable` and it doesn't have the overload of `.Select()` that has an index. So, we have to enumerate the results and then add sequence. So, in order to do it, we've to first make the `IQueryable` result to and `IEnumerable` result (as we did this in our second query using `.AsEnumerable()`).

Thanks for reading.

The post [Generating Sequence Numbers In LINQ Query](https://coderethinked.com/generating-sequence-numbers-in-linq-query/) appeared first on [Code Rethinked](https://coderethinked.com).
A Plan for the Improvement of English Spelling
Tags: watercooler, offtopic, friday
Published: 2019-07-19 12:55:23

---
title: A Plan for the Improvement of English Spelling
published: true
description: 
tags: watercooler, offtopic, friday
---
by Mark Twain:

> For example, in Year 1 that useless letter "c" would be dropped to be replased either by "k" or "s", and likewise "x" would no longer be part of the alphabet. The only kase in which "c" would be retained would be the "ch" formation, which will be dealt with later. Year 2 might reform "w" spelling, so that "which" and "one" would take the same konsonant, wile Year 3 might well abolish "y" replasing it with "i" and Iear 4 might fiks the "g/j" anomali wonse and for all.

> Jenerally, then, the improvement would kontinue iear bai iear with Iear 5 doing awai with useless double konsonants, and Iears 6-12 or so modifaiing vowlz and the rimeining voist and unvoist konsonants. Bai Iear 15 or sou, it wud fainali bi posibl tu meik ius ov thi ridandant letez "c", "y" and "x" -- bai now jast a memori in the maindz ov ould doderez -- tu riplais "ch", "sh", and "th" rispektivli.

> Fainali, xen, aafte sam 20 iers ov orxogrefkl riform, wi wud hev a lojikl, kohirnt speling in ius xrewawt xe Ingliy-spiking werld.
A Weird Hack using TypeScript
Tags: typescript, react, node
Published: 2019-07-19 12:22:38

Hi! In a project in my last company, I ran into a weird issue with the modern JavaScript build system and to work around it, wrote an even weirder hack.

Sorry if you found the title being click-baity. Alternative title: Using constant assertions in TypeScript to keep constants in sync.

## The Problem

The project was created using create-react-app (CRA) with TypeScript and it also had an Express server, that too in TypeScript. The project structure was simple (and an even more simplified version is shown here).

```
./
  src/
    App.tsx
  server/
    app.ts
```

then there was a constant.

``` ts
const options = ["1 day", "1 week", "2 weeks", "1 month", "1 year"];
```

The constant `options`, was required in client side to show a list of allowed options in a `<select>` and the server needed it for validating the requests coming from client. Now using the DRY principle, I shouldn't be writing that same value of `options` in two files - as the values at two places may get out of sync. So, it needed to be shared between `src` and `server` - that's where the problem started.

Turns out, create-react-app doesn't allow imports outside `src` directory ([See this Stack Overflow post](https://stackoverflow.com/a/44115058)), so I can't import `options` from `server` directory.

Hey Sid, why don't you do import from `src` instead?
``` ts
// server/app.ts
import { options } from '../src/App.tsx';
```

The build process in `server` was simple. Take a `.ts` file, and run it through `tsc` to create a `.js` file, keeping the same directory structure.

So, when I ran `tsc` on my `server/app.ts`, instead of creating a directory structure like:
```
./server-build/
  app.js
```

it ended up creating:
```
./server-build/
  server/
    app.js
  src/
    app.js 
```

Oops. Messing up build directory or build process just to share a constant? Not cool.

## The Hack

A prior day, I came across [constant assertions](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions), a new TypeScript feature.

Turns out, in create-react-app, we can't import values outside `src` directory, but we can import types.

``` ts
// server/app.ts
// a const assertion
const options = ["1 day", "1 week", "2 weeks", "1 month", "1 year"] as const;
// export the type instead of value
export type Options = typeof options;
```

``` ts
// src/App.tsx
import { Options } from '../server/app.ts';
const options: Options = ["1 day", "1 week", "2 weeks", "1 month", "1 year"];
```

How does it work? Lets say, I change "2 weeks" in `server` to "3 weeks". What happens? Well, the client fails to compile! It fails as it's expecting options to have type `Options`, but "3 weeks" doesn't exist in `Options` at index 2. It works similarly if I change only in `src`.

So, we've two variables in sync using TypeScript. Not very DRY, but it works™️.

See for yourself:
{% youtube NR6VQ0awdQs %}
What The #1 Thing That Affects Software Quality In Your Opinion?
Tags: discuss
Published: 2019-07-19 12:16:11

---
title: What The #1 Thing That Affects Software Quality In Your Opinion?
published: true
tags: discuss
---

Out of all coding practices, team management tools, project management tools, frameworks, development approaches, methodologies, etc. - what have you found to be the biggest contributor to **quality** software?
A COMPLETE GUIDE OF BIGCOMMERCE MIGRATION SERVICE
Tags: bigcommerce, migration, ecommerceplatform, webdev
Published: 2019-07-19 12:01:57

Everything in this ever-evolving world requires change and your eCommerce website is no exception. There can be many numerous reasons like outdated design, lack of functionalities, performance issues, huge maintenance costs, scalability to name a few, behind that decision to replatform the website.

I have prepared and shared this guide to equip you with the basic information required to make those right options when you are transitioning to BigCommerce. continue here

Start to Live - A Complete Guide of BigCommerce Migration Service
https://www.dckap.com/blog/start-live-complete-guide-bigcommerce-migration-service/
How to install and configure mongodb on ubuntu 18.04
Tags: mongodb, mongo, mongodbinstall, sagarjethi
Published: 2019-07-19 11:49:54

---
title: How to install and configure mongodb on ubuntu 18.04
published: true
description: 
tags: mongodb,mongo,mongodb install,sagar jethi
---
<h4>Introduction</h4>

MongoDB is opensource NoSQL(document) database and document database designed for ease of development. It provides Rich Query Language, High Availability, Horizontal Scalability, Support for Multiple Storage Engines.
More check: <a href="https://docs.mongodb.com/manual/introduction/">official intriduction 

<h4>Install MongoDB<h4>

The following is stepped to install MongoDB Community Edition. This step by step guideline which you can follow

<b> step 1. Import the public key used by the PMS(package management system)</b>

The Ubuntu package management tools ensure package consistency and authenticity by verifying that they are signed with GPG keys. The following command will import the MongoDB public GPG key.

```
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
```

<b> step 2. Create a list file for MongoDB.
</b>
Create a source list file for MongoDB
```
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
```

<b> step 3 Reload local Ubuntu package database.</b>
``` 
sudo apt-get update
```

<b> step 4 Install the MongoDB package

Install the latest version of MongoDB.

```
sudo apt-get install -y mongodb-org
```

Install a specific release of MongoDB.

```
sudo apt-get install -y mongodb-org=4.0.10 mongodb-org-server=4.0.10 mongodb-org-shell=4.0.10 mongodb-org-mongos=4.0.10 mongodb-org-tools=4.0.10
```

For help with troubleshooting if errors encountered then check <a href="https://docs.mongodb.com/manual/reference/installation-ubuntu-community-troubleshooting/#install-ubuntu-troubleshooting">troubleshooting
</a>

Configure and Run MongoDB 
te
The following step by step instructions can excute after download MongoDB and not the unofficial MongoDB package provided by Ubuntu.

<b> Step 1:Start MongoDB.</b>
Follow command start mongodb
```
sudo service mongod start
```

<b> Step 2 Verify that MongoDB has started successfully</b>

```
sudo systemctl status mongod
```

```
Output
mongod.service - MongoDB Database Server
   Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: 
   Active: active (running) since Fri 2019-07-19 16:50:52 IST; 15min ago
     Docs: https://docs.mongodb.org/manual
 Main PID: 30977 (mongod)
   CGroup: /system.slice/mongod.service
           └─30977 /usr/bin/mongod --config /etc/mongod.conf
```

you enable automatically starting MongoDB when the system starts. it is upto you

```
sudo systemctl enable mongod

```

<b> Step 3 Stop MongoDB.</b>
By following command stop mongod

```
sudo service mongod stop

```
<b> Step 4 Restart MongoDB.</b>
The following command to restart mongod:

```
sudo service mongod restart

```

<b> Step 5 Begin using MongoDB.</b>

```
mongo
```
Cache large drop-downs in Rails
Tags: rails, cache, performance
Published: 2019-07-19 11:17:16

---
title: Cache large drop-downs in Rails
published: true
description: 
tags: Rails, cache, performance
---

Today I noticed that a couple of drop-downs in a key form were taking several seconds to load.

At first I figured it's a slow query, because the drop-downs load data from the DB and there's several dozen records. But, no, queries take only a couple of ms. It's the rendering that is slow.

Implementing a view cache for the drop-downs is straightforward, just have to come up with an expirable key. 

The two core elements that can expire the cache are dropdown elements changing, and the selected value changing.
Usually with view caches it is also prudent to scope the key to the resource id or other unique piece of data.

In my case dropdown holds all the `Thing`s in the DB. A handy way to check for changes is to look up the most recent `updated_at` and expire if that's changed. This approach works well for new records and updates,
but will not expire the key if a record gets deleted. Usually this is not a big problem though, especially if the records are managed infrequently. If, however, it is important that deleting a record expires the cache,
adding the count of records may be necessary (and computationally expensive!)

Hacking away I realised that the scoping to resource id is not needed at all,
because I only care about the selected value.
So I got an idea to cache the dropdown globally and do some after-processing with `gsub`, rather than calculating keys and storing separate cache entries.

The after processing is simple, but detail-specific.
In this case if I cache the dropdown HTML globally, I needed to make sure to remove the 'selected' attribute from whatever option (if any!) has it in the cached HTML, and add it to the appropriate option.

Here's my final solution:

```rb
:ruby
  key = cache_key(
    locale: I18n.locale,
    in: "app/views/users/_edit.field.thing_id.html.haml",
    for: "thing_dropdown",
    # lookin up the most recent update time, will expire on another update
    most_recent_thing_change:
      Thing.pluck("MAX(#{ Thing.table_name }.updated_at) AS stamp").last.to_s
  )  

  thing_dropdown =
    Rails.cache.fetch(key, expires_in: 24.hours) do
      select_options = options_from_collection_for_select(
        Thing.all.order(:name), "id", "to_text", user.thing
      )

      render(
        "edit.field_type_item",        
        select_options: select_options,
        include_blank: true,
        input_attributes: {multiple: false}
      )
    end
  
  # clear whatever is selected in the global cache
  thing_dropdown.gsub!(%r'\s*selected=\S+\s*', " ")
  # make the correct option selected
  thing_dropdown.gsub!(%r'value="#{ user.thing }"', "value=\"#{ user.thing }\" selected=\"selected\"")

= thing_dropdown.html_safe
```
What should I learn, React Js or React Native?
Tags: discuss, beginners, javascript, react
Published: 2019-07-19 11:15:21

---
title: What should I learn, React Js or React Native?
published: true
description: React Js or React Native? Please help! 
tags: discuss, beginners, javascript, react
---

Hi everyone! I'm willing to enter the mobile development world, I did some research and I was going to learn React but then I notice that React Native exists, now I don't know what path should I go?
I've been working as a web developer, I love BackEnd more than FrontEnd, but I don't mind to work both parts, I want to develop an app that can work flawless on mobiles but also on desktops.