teleren/devto huggingface dataset:
How to prevent local composer upgrades from breaking your live environment
Tags: composer, php
Published: 2020-08-02 14:38:25

---
title: How to prevent local composer upgrades from breaking your live environment
published: true
description: Use the composer settings to set a fixed PHP version.
tags: composer, php
---

*For the scope of this article, I'll assume you have (basic) experience with composer and are familiar with the way dependencies are defined.*

When you want to upgrade your dependencies, composer is smart enough to take your PHP version into account: it'll only upgrade every package to compatible versions. Let's say your local environment uses PHP 7.4, but the live environment is still on 7.2. **Any upgrade will work with your local 7.4 but might break on 7.2 when being pushed to live.**

## Telling composer about the PHP version of your live environment

```json
{
    // requires (...)
    "config": {
        "platform": {
            "php": "8.0" // Version from the live environment
        }
    }
}
```

**Composer will now know about this version**, and never upgrade a package to an incompatible version. So any local upgrades can be safely executed!

> If your live PHP version is outdated, also consider upgrading! This will bring both performance and security improvements.

Often running into problems with different environment settings? Options exist that will create a complete container to run your application in, that will replicate the live environment - they need some setup though. (e.g. [Docker](https://www.docker.com/))

**Have you got other composer tips to share? Eager to hear about them!**
Dynamic GitHub readme
Tags: githubreadme, github, readme
Published: 2020-08-02 14:33:26

---
title: Dynamic GitHub readme
published: true
description: 
tags: #githubreadme #github #readme
//cover_image: 
---
###**`1) Sign in/ Sign up`**
Sign in / Signup to your GitHub account and create a new repository

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

###**`2) Repository Name`**
You will be asked to give a repository name. *Make sure your repository name and the account name are same.* 

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

###**`3) Create Read me File`**
Its mandate that you should have **“readme.md”** file while initialising repo if not make sure you are adding it as part of your repository. 

Another key thing to notice is that the repository must be a **“public” repository**. 

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

###**`4) Static readme generator`**
Once the repository is created with above criteria you will be seeing a **readme.md** file where you will describe about yourself.

I found a static readme generator site useful. Click [here](https://arturssmirnovs.github.io/github-profile-readme-generator/) to generate yours. 

Don’t hesitate to add a discussion note if you don’t find this information suffice. I ll respond ASAP.

[Here](https://github.com/saleemmalikraja) is mine. Hope this article helps. Hit ❤ when you like this article. 

(: Happy coding :)
Codewar Day2
Published: 2020-08-02 14:27:40

i rest some day because i got busy with ied adha, now i try solve a litle problem
the question : 
Trolls are attacking your comment section!

A common way to deal with this situation is to remove all of the vowels from the trolls' comments, neutralizing the threat.

Your task is to write a function that takes a string and return a new string with all vowels removed.

For example, the string "This website is for losers LOL!" would become "Ths wbst s fr lsrs LL!".

Note: for this kata y isn't considered a vowel._

my solving : 
```javascript
const disemvowel = data => {
  let regex = /[aiueoAIUEO]/g;
  return data.replace(regex, "");
};
```

the popular solving 
```javascript
disemvowel = str => str.replace(/[aeiou]/gi,'');
```
Seven problems nuxtjs resloved
Tags: javscript, notes
Published: 2020-08-02 14:21:46

---
title: Seven problems nuxtjs resloved
published: true
tags: Javscript, Notes
cover_image: https://nuxtjs.org/logos/nuxt-icon@2x.png
---

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/oijt11zt3gqztpm1tg0t.jpg)

Have you thinks about  [nuxtjs](https://nuxtjs.org) resloved what problems ? we know that **nuxtjs** are awsome farmwork to write less and do more things automaic. 

Likes you can create file in `pages` directory **nuxtjs** will generate router for you. also you can create file in `store` directory **nuxtjs** will create namespace store for you when you use [vuex](https://vuex.vuejs.org/). 

Easy to use and organization you code logic in **nuxtjs** also best developer experience.  i have got seven point the **nuxtjs** resloved for us from [official webstie](https://nuxtjs.org).  



### Building from scratch is difficult ? 

**Nuxtjs** help us intelligent **vuex**, **vue-router**, **vue-meta** you just need run command `npx create-nuxt-app <project-name>`  the full project necessary file and config will create for you.



### No standard folder structure ?

Write project with vuejs and whitout farmwork not easy if you want to use **vuex** ,**vue-router**, **vue-meta** etc.  organization the file structure by self is repetitived and cumbersome. **Nuxtjs** can reslove it you can create file in pages directory will genreate route automaic. create file in store will create vuex store with namespace for you.



### Routing config can get lengthy ?

Use **vue-router** you can custom you route one by one, it's ok when you project are small or simple. when you have big project and more and more page should defined in router. have you thinks use script to generate route config? **Nuxtjs** resloved this problem, all you need is just create page you want in **Nuxtjs** pages directory. 



### No strandard way to configure ?

All configure file and configuration will defined and config in **nuxt.config.js** all you need care about just one file. all intelligent module will worker.



### Not SEO firendly ?

**Nuxtjs** use **vue-meta** generate SEO content info, you just need config less and more things **Nuxtjs** will do.



### Vue apps can load slowly ?

If you use **Nuxtjs** with `universal` mode you can prerender page content with html, so that your user can fetch the page content quickly. which mean's you can use `universal` mode to open **SSR** mechanism



### Difficult to change behavior ?

You can extend **Nuxtjs** farmwork functaion with nuxt `modules` , `modules` can write hight level funcation to you use nuxtjs core.



Hopt it can help you :)
Throwing exceptions vs Returning failure object
Tags: discuss, exceptions, functional, javascript
Published: 2020-08-02 14:09:51

I'm aware that clean And maintainable code is more important than premature optimizations. Throwing exceptions seems to be more suggestive than return codes. But i'm not talking about return codes. Here a example.

```typescript
function SignIn(user) {
   const userExist = logics()
   if (!userExist) throw UserNotExistError('message', user)

   const token = generateToken(user)
   return token
}
```

Here's the same but with return objects
```typescript
function SignIn(user) {
   const userExist = logics()
   if (!userExist) return {token: null, error: 'no-user'}

   const token = generateToken(user)
   return {token, error: null}
}
```

The second looks like a better option **to me**. Because handling exceptions is theoretically less performant, and with try/catch is it's sync. Besides over time there'll be lots of exceptions.
```typescript
UserNotExistError, UserExistError, ValidationError, DBError, QueryFailedError, UnknownError, FunctionSpecificError, OtherFunctionSpecificError.
```

And I myself noticed few millisecs delay in requests when handling exceptions on my computer and on a relatively small project. It can add up in a larger scale.

I'm by no means not saying not to use exceptions. They're quite handy. But why everywhere, when a signup/signin fails, something doesn't exist or does..

The lots of SO threads seem to discuss more about theory and less specific details. What about your opinion? How have you been doing this?
🤖E3 | Favorite language, practice API, Bootstrap & CSS | 2020
Tags: qna, bootstrap, css, api
Published: 2020-08-02 14:09:35

In this series, I am going to be answering your coding/designing questions. I don't claim I have a lot of experience or that I know everything, I am just going to give you examples that have worked for me and I hope they will work for you as well.


In this video, I answer:
👣GENERAL QUESTIONS
0. Let's start 0:00
1. Which programming languages do you know? 1:12
2. What languages do you code in? 2:08
3. What is your favorite language? 2:18
4. Are you a motivational speaker? 2:47
5. How do you stay motivated through the day? 3:35
6. How do you get ideas before building an app? 4:36
7. How do you start UX/UI, I'm a back end developer 5:29

👣API & BOOTSTRAP QUESTIONS
8. How to use API? How to practice? 6:34
9. Could we combine Bootstrap with custom CSS? 7:25
10. Should we use bootstrap CDN? 8:01
11. What is the best way to use Bootstrap? 8:30

👣COMING UP QUESTIONS
12. Feel free to ask me anything about code/design, motivation/inspiration or internships/jobs 8:57

RELATED VIDEOS
💪This is the [video](https://youtu.be/Y7m6rZXtNn8) on how I started my coding journey 
💪 Q4: Some of my [motivational talks](https://www.youtube.com/playlist?list=PLxktx98zP3aCYRP1-HCUgyHE3qowkQ01A) on conferences 
💪 Q5: Tips on [motivation](https://youtu.be/oTEzCr-FmPc)
💪 Q7: About UX and UI [(playlist)](https://www.youtube.com/playlist?list=PLxktx98zP3aBJpKas1z2zLQjSmzE3_CT3)

✅Season 1 of QnA can be found [here](https://www.youtube.com/playlistlist=PLxktx98zP3aDdYxC55TRQlm9k7nD60Wcb)
✅Season 2, [Episode 1](https://youtu.be/TjV7Lnl2AMQ)
✅Season 2, [Episode 2](https://youtu.be/oTEzCr-FmPc)
✅Season 2, [Episode 4](https://youtu.be/EEqiXJP7GMc)

************************************

🤔If you have any question and you are searching for an answer, or you if you want a code/design review please choose a way to participate: 
1. leave a comment in this video.
2. or go the "community" tab on my YouTube channel and leave a comment there.
3. or go on twitter, find me on @BatsouElef, and ask me anything 


************************************

👋Hello, I' m Eleftheria, an app developer, master student, public speaker, and chocolate lover.

🍩Would you care about buying me a coffee? You can do it here: [paypal.me/eleftheriabatsou](paypal.me/eleftheriabatsou) but If you can't that's ok too!

**************************************

🙏It would be nice to subscribe to my [Youtube](https://www.youtube.com/c/EleftheriaBatsou) channel. It’s free and it helps to create more content.

🌈[Youtube](https://www.youtube.com/c/EleftheriaBatsou) | [Codepen](https://codepen.io/EleftheriaBatsou) | [GitHub](https://github.com/EleftheriaBatsou) | [Twitter](https://twitter.com/BatsouElef) | [Site](http://eleftheriabatsou.com/) | [Instagram](https://www.instagram.com/elefintech/)
Build a Real Time ISS Tracker using Javascript
Tags: html, css, javascript
Published: 2020-08-02 14:03:21

Howdy Folks! I am back with another simple yet fun tutorial ;)

Do you know about ISS? ISS aka International Space Station is an artificial habitable satellite that orbits Earth roughly 16 times per day. In just one day, the station travels about the distance it would take to go from Earth to the moon and back! ISS is mainly used as a laboratory to perform some space-related experiments. At the time of writing this article, there are three people up on the space station right now. And another interesting fact is that, If the conditions are favorable, then you can see the ISS with your own naked eyes from Earth's surface! (I had seen it 3 times!). Sounds interesting right? But wait, how do I know where the ISS is currently flying over? How do I track it? 

That's exactly what we are going to do! Today, you are going to learn how to build a Real-Time International Space Station (ISS) Tracker using Javascript :) Hope you are ready for this new adventure...

The finished product would look something like this:

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

You can download the completed project from GitHub - [ISS Tracker](https://github.com/the-coding-pie/ISSTracker)

You can find the full tutorial here on my blog - [How to build an ISS Tracker using Javascript](https://thecodingpie.com/post/build-a-real-time-iss-tracker-using-javascript/)

Hope you will definitely enjoy this :)
The best brazilian podcasts in my point of view
Tags: podcast, brazil
Published: 2020-08-02 13:53:10

## Table Of Contents
* [Why my point of view?](#whymypointofview)
* [My first time listening a podcast](#firsttime)
* [My favorites podcasts](#favorites)

### Why my point of view? <a name="whymypointofview"></a>
Just I why to share with you. I know that every person has the personal preferences and it´s good. I don't want to change an opinion just to share what's works to me.

### My first time listening a podcast? <a name="whymypointofview"></a>
If I remember well was on last decade on 2009 was a [CBN radio] (cbn.globoradio.globo.com) podcast made by Juca Kfouri and was about soccer, a common topic in Brazil.
In addition, I had no music on my iPhone and Spotify had not yet been released.

### My favorites podcasts<a name="whymypointofview"></a>
This is my list
1. [Scicast](https://www.deviante.com.br/podcasts/scicast/)
2. [Xadrez Verbal]()
3. [NerdCast](https://jovemnerd.com.br/nerdcast/)
4. [Anticast](https://anticast.com.br)
5. [Hipters](https://hipsters.tech/)
6. [Rapaduracast](https://cinemacomrapadura.com.br/rapaduracast/)
7. [Naruhodo](https://www.b9.com.br/shows/naruhodo)
8. [Inglês todos os dias](https://domineingles.com.br)
9. [Tecnocast](https://tecnoblog.net/editoria/podcast)
10. [Nexo Jornal](https://www.nexojornal.com.br/podcast) 

Cover image: [Pixabay](https://pixabay.com/photos/microphone-audio-recording-podcast-2618102/)
Logging REST API
Tags: restapi, webdev, help
Published: 2020-07-25 18:36:34

How do you log REST API on the backend, especially the Body?

If the data is in path params or querystring, it is probably not a real problem. Maybe log as a JSON, and the size usually isn't very big.

<small>But querystrings seem to have a problem of serialization format and URL length</small>

But if it is body, it is even possible that it is a large JSON string, or isn't even a string. How do you deal with that, to not to bloat the server logs?

---

Edit: it seems that an answer is [`Node.js`'s inspector.console](https://nodejs.org/api/inspector.html#inspector_inspector_console). It will log to Chrome DevTools, if you run `node --inspect server.js` or `ts-node-dev --inspect -- server.ts`

Making it work in Fastify requires not only `pino-pretty`, but also [pino-inspector](https://github.com/pinojs/pino-inspector), which is [a very simple module](https://github.com/pinojs/pino-inspector/blob/master/index.js).

Additional setup is this. Otherwise, it won't log `req.body`.

```ts
import { Serialize } from 'any-serialize'

const ser = new Serialize()

  f.addHook('preHandler', function (req, _, done) {
    if (req.body && typeof req.body === 'object') {
      req.log.debug(
        {
          body: filterObjValue(
            req.body,
            /**
             * This will keep only primitives, nulls, plain objects, Date, and RegExp
             * ArrayBuffer in file uploads will be removed.
             */
            (v) => ser.hash(v) === ser.hash(ser.clone(v))
          ),
        },
        'parsed body'
      )
    }
    done()
  })

function filterObjValue(obj: any, fn: (v: any) => boolean) {
  if (obj && typeof obj === 'object') {
    if (Array.isArray(obj)) {
      return obj.filter((a) => fn(a)).map((a) => filterObjValue(a, fn))
    } else {
      return Object.entries(obj)
        .filter(([, v]) => fn(v))
        .map(([k, v]) => [k, filterObjValue(v, fn)])
        .reduce((prev, [k, v]) => ({ ...prev, [k]: v }), {})
    }
  }

  return obj
}
```

Not sure how to make it work in Express or Winston module, though.
How to use different SSH Keys for different Bitbucket (git) Repositories
Tags: git, bitbucket, ssh, github
Published: 2020-08-02 13:20:26

---
title: How to use different SSH Keys for different Bitbucket (git) Repositories
published: true
description: A guide on how to use configure multiple ssh keys for use with GitHub
tags: git, bitbucket, ssh, github
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/8t2c9ur26cm7umrcs6mz.png
---

Bitbucket doesn't allow you to use the same SSH Key on more than one account. This means if you have more than 1 account but need to access the repositories on both (in my case a work account and a personal account) you will need to configure your SSH agent to allow you to choose which SSH Key to use when cloning over SSH.

Navigate to your SSH Directory
```bash
cd ~/.ssh
```

Ensure SSH Agent is running
```bash
eval $(ssh-agent)
```

Create your SSH Keys
```bash
# Run the following replacing EMAIL_ADDRESS with the email address associated with your bitbucket account
ssh-keygen -t rsa -b 4096 -C "EMAIL_ADDRESS"

# When prompted to enter a file name, enter a name to help you differentiate your two keys
Enter file in which to save the key (/c/Users/shane/.ssh/id_rsa): key-1
```

(optional) Remove previous SSH Keys for your SSH Agent (this does not delete the actual key from your ~/.ssh directory)
```bash
ssh-add -D
```

Add your newly generated SSH Keys to your SSH Agent
```bash
ssh-add ~/.ssh/key-1
ssh-add ~/.ssh/key-2
```

Check that your SSH Keys have been added
```bash
ssh-add -l

# Sample output
4096 SHA256:Mo+oiomJASfjlksc6Qj0KcQpUXRVpyvsEIHdXNYDL1c user@website1.com (RSA)
4096 SHA256:6Jt908009upoASFjjkljsflkj9iaGebl7pNr6vuezPI user@website2.com (RSA)
```

Create your SSH Config file
```bash
touch config
```

The format of our SSH Config
```bash
Host bitbucket-key-1 # Friendly name
  HostName bitbucket.org # The server we opening the SSH connection with
  User git # The SSH user (which for bitbucket is git eg. git@bitbucket.org)
  IdentityFile ~/.ssh/id_rsa # The private key file
  IdentitiesOnly yes # Tells SSH to only use keys provided by IdentityFile above
```

Create your different SSH Configs
```bash
# Bitbucket - SSH Key 1
Host bitbucket-key-1
  HostName bitbucket.org  
  User git
  IdentityFile ~/.ssh/key-1-id_rsa
  IdentitiesOnly yes

# Bitbucket - SSH Key 2
Host bitbucket-key-2
  HostName bitbucket.org
  User git
  IdentityFile ~/.ssh/key-2-id_rsa
  IdentitiesOnly yes
```

*Important* At this point, reload your terminal

Now when cloning via SSH we replace the usual host name (bitbucket.org) with our new "friendly" name
```bash
# Usual format
git clone USER@HOST:ACCOUNT_NAME/REPOSITORY_NAME.git
# Example
git clone git@bitbucket.org:username/repository.git

# Format using our new SSH Host config (replace bitbucket.org with the user friendly host name from our .config file)
git clone git@bitbucket-key-1:username/repository.git

```
เลือก
Tags: choose
Published: 2020-08-02 13:19:14

---
title: เลือก
published: true
description: เลือกอย่างไร
tags: Choose
---
"การเลือก หมายถึง การคัดสิ่งที่มีจำนวนมากกว่าหนึ่งขี้นไปเพื่อเอาไว้หรือเอาออกตามต้องการ"

คุณผู้อ่านเคยไหมครับ ที่ต้องอยู่ในสถานะการณ์หรือสภาวะที่ต้องเลือกว่าจะทำไม่ทำ ทำอันไหนดี และทุกครั้งเราต้องการเวลาในการคิด เพื่อตัดสินใจ ความเห็นและข้อพิจารณามากมากไหลเข้าในสมอง แต่ก็ยังไม่สามารถตัดสินใจได้ว่าจะเอาอย่างไร

ยิ่งแย่ไปกว่านั้น หากเลือกอะไรไปแล้ว เป็นทุกข์ ไม่น่าเลือกแบบนี้เลย รู้งี้ไม่ทำดีกว่า หรือยังลังเล สับสน ว่าที่เลือกไปนั้น ถูกหรือเปล่า 

ถ้าหากคุณผู้อ่านมีความลังเลสงสัยในสิ่งทีได้เลือกไปแล้ว แสดงว่า เราอยู่ในพืนที่การตัดสินใจ อยู่ในข้อคิดพิจารณา ยังไม่ได้เลือกจริงๆหรอกนะครับ

การตัดสินใจ มาจากข้อคิดพิจารณา แต่การเลือก คือ ปล่อยวางความคิดพิจารณานั้น แล้วเลือก

และในชีวิตคนเรา บางครั้งมันไม่ได้โชคดีแบบนั้น ที่มีสิ่งมากกว่าหนึ่งอย่างให้เราได้เลือก ความจริงเหตุการณ์หรือสิ่งต่างๆ ที่เกิดในชีวิตเรามันมาอย่างเดียว เช่น หมอบอกว่าผลตรวจชิ้นเนื้อของคุณเป็นมะเร็ง ไม่มีอย่างอื่น มาอย่างเดียวคือ คุณเป็นมะเร็ง 

ถ้าคุณต่อต้านมัน คุณก็เป็นเหยื่อของสถานะการณ์ ได้แต่ร้องไห้คร่ำครวญ ตีอกชกตัว หรือโทษคนอื่น

แม้สิ่งที่เข้ามามันจะเลวร้าย จงเลือกที่จะ**<u>มี</u>**สิ่งนั้นถ้าสิ่งนั้นคุณไม่ต้องการ และจงเลือกที่จะ**<u>เป็น</u>**สิ่งนั้นถ้ามันให้พลังกับคุณ 

การเลือกไม่มีถูกผิดหรอกนะครับ ขอเพียงยืนเป็นต้นเหตุรับผิดชอบในสิ่งที่เลือก พูดถึงสิ่งที่เลือกได้อย่างเต็มที่ และเต็มใจรับผลกระทบที่เกิดขึ้น

การเลือกสำหรับคุณไม่ได้จำกัดอยู่แค่การคัดสิ่งที่มีจำนวนมากกว่าหนึ่งอีกต่อไป แม้สิ่งที่เข้ามาจะมีอย่างเดียวและเลวร้าย เมื่อคุณเลือกมีมัน คุณจะได้พบอิสระ พลัง และความสงบในจิตใจ

ขอให้คุณผู้อ่านมีการเลือกอย่างทรงพลัง กับทุกเรื่องทั้งดีและร้ายที่ผ่านเข้ามาครับ
#100DaysOfCode | I Need Your Help(Day 8, 9)
Tags: 100daysofcode, challenge, help, python
Published: 2020-08-02 13:13:17

Hey everyone, I wanna share my experience and feeling about day 8 and 9 of __#100DaysOfCode Challenge__!
I know it's not a long way but I have problem to solve most of the problem.
From two days ago I spend my time on a challenge which is called __Twelve Days of X-mas__, I'll share this challenge in my next post.
But you know what? 
I'm not feeling good Cause in two days I couldn't even get close to solve this problem!
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/lv2px95ytocxhq4he9ui.png)<figcaption>Me, Drinking some Juice </figcaption>
I even have problem to read the others code!
I mean I can read but I can not understand what the hell is going on.

I don't know if it's normal to get stuck to solve an easy problem for two days and at the end of the day you have no  result!

I'm reading a lot of tutorial, watching online courses but in some case I'm feeling depressed cause I fail to solve an easy or medium level problem.

So If you had same experience in your programming and developing journey pleaseeeee share you experience with me and let me know about How did you control your emotions when you think you're not good enough or whatever!


Keep Moving Forward ツ

Code with 💛

🅑🅐🅝🅙🅘