teleren/devto huggingface dataset:
How to switch themes in VS Code based on the time of day
Tags: webdev, programming, productivity
Published: 2021-02-17 15:59:10

---
title: How to switch themes in VS Code based on the time of day
published: true
date: 2021-02-16 19:53:57 UTC
tags: webdev, programming, productivity
canonical_url: https://burkeholland.github.io/posts/vscode/auto-switch-themes/
---

It’s a good idea to switch between dark and light mode depending on what time of day it is. During the day when your body is more awake, it might make more sense to use a light theme where reading comprehension is better. At night, your eyes become more tired and bright screen light can be harder on your tired eyes.

Visual Studio Code doesn’t do this out-of-the-box, but just like Steve Jobs once said, “There’s an extension for that”.

## Theme Switcher Extension

The [Theme Switcher Extension](https://marketplace.visualstudio.com/items?itemName=savioserra.theme-switcher) for VS Code will let you define times of the day at which to apply a different theme.

![](https://burkeholland.github.io/media/vscode/auto-switch-themes/theme-switcher-extension.jpg)

Open the `settings.json` file and add in the `themeswitcher.mappings` property which takes an array of time and theme combinations. The theme will take affect at the designated time (24 hour format). Here’s mine…

```
"themeswitcher.mappings": [
  {
    "time": "06:00",
    "theme": "GitHub Light"
  },
  {
    "time": "17:00",
    "theme": "GitHub Dark"
  }
]
```

You can have as many of these “change points” as you like. Change themes every hour if that makes you happy.

Last, make sure you set the “utcOffset” property in `settings.json` to account for your time zone. The extension doesn’t do that autmoatically. I’m Central Standard Time which is UTC - 6.

```
"themeswitcher.utcOffset": -6
```

You can find your UTC offset based on timezone [here](https://www.timeanddate.com/time/zones/).

Now VS Code will switch themes automatically based on the time of day. It’s not light theme vs dark theme, it’s enjoying the best of both worlds.
Alteração de letras no texto em Python
Tags: python
Published: 2021-02-16 19:40:48

Estou apredendo a programar, então se o código abaixo estiver com alguma informação incorreta, por favor deixe a explicação correta nos comentários. Tento explicar o código linha a linha para facilitar.

Exercício: O objetivo do programa abaixo é  trocar algumas letrar por outro caractere.

_______________________________
```python
def cripto (frase):
    tradutor = ""
    for letra in frase: 
        if letra in "Aa":
            tradutor = tradutor + "1"
            
        elif letra in "Ee":
            tradutor = tradutor + "2"
            
        elif letra in "Ii":
            tradutor = tradutor + "3"
            
        elif letra in "Oo":
            tradutor = tradutor + "4" 
            
        elif letra in "Uu":
            tradutor = tradutor + "5"
        
        else:
            tradutor += letra
    return tradutor
print(cripto(input("\n Digite aqui sua frase: \n")))
```
______________________________________________________
Como será exibido:

Digite aqui sua frase:

___
Como fica:

Digite aqui sua frase:
Programar em python é muito legal!
Pr4gr1m1r 2m pyth4n é m53t4 l2g1l!
_____________________________________________________

#Explicação do código:
```python
def cripto (frase): """ definimos uma variável que irá armazenar a frase"""

    tradutor = ""  """ variável vazia para depois armazenar o código

    for letra in frase: """ criamos um laço de for que lerá letra a letra da frase 
        if letra in "Aa": """ Se a frase possuir a letra A minuscula ou maiuscula
            tradutor = tradutor + "1" """ essa letra sera substituida pelo caractere que está entre aspas
            
        elif letra in "Ee":
            tradutor = tradutor + "2"
            
        elif letra in "Ii":
            tradutor = tradutor + "3"
            
        elif letra in "Oo":
            tradutor = tradutor + "4" 
            
        elif letra in "Uu":
            tradutor = tradutor + "5"
        
        else:
            tradutor += letra
    return tradutor
print(cripto(input("\n Digite aqui sua frase: \n")))
```
Get unstuck and start
Tags: beginners, programming, productivity, webdev
Published: 2021-02-16 19:38:01

I see this happen to everyone and I want to share one technique I picked up while being a developer that I use. 

I don't use this all the time. I can't work like that. But when I am #@$ stuck, feeling overwhelmed, and having something to do it is my go-to. 

I picked this up at a conference in my software engineering career but it is not specific to that. That session was on productivity hacks and in it, they introduced me to the Pomodoro technique. This is a time management method developed by Francesco Cirillo in the late 1980s. What I love about it is that you don't need anything special you can get started using what you have. The simple process is documented on the Wikipedia page. 

Yesterday I set aside some focused time to write and brainstorm. The idea of writing for thirty days started to invoke all kinds of fears and anxieties. What would I write about? Can I actually do this? etc. I almost quit. Well to be completely honest I almost said fine I will 'do this later' it is 'not important now' (avoidance for the win!). But, then I recalled this idea and it let me complete what I set out to do.

There is no magic to this and it cannot do your work for you. Yet, it will help you get started and focused. Sometimes that is the hardest thing and it is easier to quit, give up, do something else. 

Perhaps though that is the magic - getting started.  For me, once I start and momentum builds I notice my internal resistance start to fade. And from that place, you can do anything.
JS Test #12: Math.min()
Tags: beginners, learn, codenewbie, javascript
Published: 2021-02-16 19:35:36

![js-test-12](https://learn.coderslang.com/js-test-12.png)

How small is `Math.min()` in JavaScript?

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

The function `Math.min()` takes the variable number of arguments and returns the lowest number passed into it.

In our case, it’s called without any arguments which is a special case.

If `Math.min()` is called without any parameters, it will return `Infinity` which is the opposite of what you might have expected.

---

**ANSWER**: `true` will be printed to the screen as `Infinity` is greater than `0`.
3 Books That I Found Helpful During My Programming Journey
Tags: programming, resources, books, beginners
Published: 2021-02-16 19:35:06

There are plenty of books out there that involve programming, some helpful, others not so helpful.

These are some books that I have personally found helpful, but it is by no means an exhaustive list of topics.

I hope that you are able to find some use from these, and if you have any books that were helpful to you in any way feel free to share those with me in the comments!

---

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

###[Grokking Algorithms](https://www.goodreads.com/book/show/22847284-grokking-algorithms-an-illustrated-guide-for-programmers-and-other-curio)
If you're having any trouble understanding algorithms and data structures, put this book next on your list. Grokking Algorithms breaks down the large complex topics into pieces that are much easier to understand, complete with pictures!

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7w8gu5iip5hoo1lsdn25.jpg)

###[Code](https://www.goodreads.com/book/show/44882.Code)
This book doesn't really teach you how to program, but it does something that lots of people miss when trying to learn how to program. This book attempts to teach you how a computer actually works, from the electricity that goes in it to the tweets and cat videos that you see on your screen, in a way that is both readable and digestible.

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

###[Cracking The Coding Interview](https://www.goodreads.com/book/show/54845619-cracking-the-coding-interview)
I know this one probably gets recommended a lot, but it truly is a good resource for practicing the type of questions that you would get during a technical interview. There's also a pretty decent explanation of time complexity and Big O notation in general in the beginning of the book. You don't have to read this book front to back, and you can combine it with other resources such as [LeetCode](https://leetcode.com/) or [CodeWars](https://www.codewars.com/).

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/048zgkjn0qg0es47umf3.jpg)

###Honorable Mention: [Peak](https://www.goodreads.com/book/show/26312997-peak)
This book doesn't really have anything to do with coding or programming at all, but I still found it an important read. What it does do is shed light on the mystique of human ability, and it shows you that with the proper tools and the right frame of mind, you can achieve what you thought you once could not.

---
Learning to Learn
Published: 2021-02-16 18:46:52

Being in my mid 30's, I haven't been in a learning environment in more than a decade, but I have used learning in my day to day life working as a hotel manager. 

Learning new things is always a part of our daily lives, but learning a technical skill, such as coding, is much more in depth. You have to adhere to strict syntax or you'll produce an error. You have to map out your program or app, or else you'll be stuck in a loop you can't exit. 

I've always thought having a basic structure written out for what you want to accomplish is key. When I was training front desk staff at a hotel, I would give them a detailed outline of what needs to be done in order to complete the task at hand down to the keystroke. I took the check-in process and broke it down step by step, and unsurprisingly after a few times repeating the process, a brand new front desk agent understood how to do it without looking at notes!

Coding, no matter what language you chose to work in, is complex. Just viewing a tutorial or watching a lecture might not be enough for you to be able to grasp higher level concepts right away. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/itzze16chk6s9dhxougu.jpeg)

Take notes!

Taking notes is incredibly important when learning to code. When starting Flatiron School's software engineering program, I relearned my note taking process and adapted it coding. Here's a snippet of my notes from the creating migrations portion of ActiveRecord:

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

What I did was type out the actual code that's needed for the process, and added my own notations to clarify where I'm doing that process (in the text editor terminal, or in the rake console for this example). I've also noted the proper syntax for creating a migration. 

Now, doing all of this was time consuming. I watched a YouTube video of the lecture, and while watching I paused the video to write down each step, then resumed. Repeat until all the steps for what I wanted to accomplish was laid out in a format I understood.

Writing out your notes and adding comments in an easy to read format will definitely help a newbie to coding understand what's going on. Having each step written down one by one, especially if the video you're watching bounces around a bit to test out code or show a different example, will clarify the steps needed to accomplish your task.
¿Qué son las extensiones de PHP?
Tags: php
Published: 2021-09-16 12:14:05

---
title: ¿Qué son las extensiones de PHP?
published: true
date: 2021-02-16 18:45:52 UTC
tags: php
canonical_url: https://academy.leewayweb.com/que-son-las-extensiones-de-php/
---

Quién no se cruzó con mensajes como: Debes tener instalada/habilitada la extension en PHP sobre GD Pero… ¿qué es exactamente una extensión de PHP? Para comprenderlo debes conocer un poco cómo funciona PHP internamente. A continuación te daré una visión algo simplificada, si quieres una explicación completa y detallada te recomiendo este excelente tutorial de […]

La entrada [¿Qué son las extensiones de PHP?](https://academy.leewayweb.com/que-son-las-extensiones-de-php/) se publicó primero en [Leeway Academy](https://academy.leewayweb.com).
MongoDB Marvels - Data Between Dates - Series #13
Tags: mongodb, javascript, database, express
Published: 2021-02-16 18:43:32

## Intro

Let's look at a MongoDB query that uses the Mongo Aggregation Framework (AF) that retrieves a resultset of docs between two points in time.

```js
mgArr(dbEnum.nlpdb, collEnum.users_actions,
    { $addFields: { ts: { $toDate: "$_id" } } },
    {
      $match: {
        ts: {
          $gte: new Date("2021-02-01T00:00:00.000Z"),
          $lt: new Date("2021-02-15T00:00:00.000Z")
        }
      }
    },
    { $sort: { ts: 1 } },
    { $skip: 0 },
    { $limit: 100 },
  )
```

## Notes

There are 5 stages here.

1. extract the timestamp from the _id field (PK), as a new field called "ts" (timestamp)

2. filter (match) by dates that are greater than the earliest date and less than the latest date

3. sort by the earliest date (the 1 means ascending; a -1 would mean descending)

4. let's add pagination, which requires two stages, $skip and $limit. $skip: 0 mean get the first page of results without skiping to the next page

5. limit the resultset to the first 100 results, as page 1 (no skip)

These 5 stages are the raw AF (Aggregation Framework) syntaxes.



## Version 2 - using functional wrappers

```js
  mgArr(dbEnum.nlpdb, collEnum.users_actions,
    addField_ts(),
    matchBetweenDates("2021-02-01", "2021-02-04"),
    sortAsc("ts"),
    paginate(100, 1),
  )
```

## Notes

We've made the code more terse and increased its readability by abstracting away the tedious and repetitious curl braces. Now it looks more functional, since it's just one function call after another, passing in our argument that are particular to this queries use case.

Notice the naming convention for the addField_ts func. The underscore indicates a namespacing. I use namespacing to clearly specify a category of funcs. I have a number of "addField" funcs that add fields to a resultset for particular common use cases. Adding a new timestamp field is just one common use case.

Notice it appears we have 4 stages now instead of 5. The paginate func composes two stages, $skip and $limit to give us a simpler pagination behavior. The paginate func returns the $skip and $limit, so technically there are still 5 stages sent to MongoDB as a raw query.

I made the matchBetweenDates func to be inclusive of the start and end date.
Here is the source code:
```js
/**
@func
get docs between two dates
inclusive of days

@param {string} start - the earliest day to include
@param {string} end - the latest day to include
@return {object}
*/
export const matchBetweenDates = (start, end) => {
  return {
    $match: {
      ts: {
        $gte: new Date(start + "T00:00:00.000Z"),
        $lte: new Date(end + "T23:59:59.000Z")
      }
    }
  };
};
```


## What's Next

We'll be covering more advanced usages of partitioning your data on date dimensions, to allow you better insights into your data, and make better predictions about the future.

As always, if you have any questions on this let me know.
New VSCode Extension - 🦎 Chameleon
Tags: vscode, javascript, fun
Published: 2021-02-16 18:40:57

---
title: New VSCode Extension - 🦎 Chameleon
published: true
description: 
tags: vscode, javascript, fun
cover_image: https://raw.githubusercontent.com/timdeschryver/vscode-chameleon/main/resources/chameleon.png
---

Yes, I'm one of those peoples who regularly change their Visual Studio Code setup.
I want to cycle between different themes, try out new fonts, and switch between icons.

That's why I created **🦎 Chameleon** as a weekend project. 

Now, every time when I open up a new instance of Visual Studio Code, I get a new randomized look. 

**🦎 Chameleon** looks at all the installed themes (and icons) to pick a random one, and it shuffles the font family setting to change its font.

## Try it out

If you also can't choose between multiple themes from the marketplace, I think **🦎 Chameleon** will be for you. 

You can download **🦎 Chameleon** in the [marketplace](https://marketplace.visualstudio.com/items?itemName=timdeschryver.vscode-chameleon), and you can contribute or give feedback to the project on the [GitHub repository](https://github.com/timdeschryver/vscode-chameleon).
Daily or update diaries
Tags: firstpost, devdiary, help, webdev
Published: 2021-02-16 18:31:47

I have a project in mind that I wanted to documenting my progress for reference as well as starting to learn how to format and articulate dev diaries. I was wondering if it is more interesting or exciting to follow a long term project through daily short updates or announcing big feature fixes, updates, and things I learned throughout my process and wanted to share to other full-stack developers at all levels.

---
***Daily Diary format***
---
Date
TL:DR

in-depth highlight of the days update

---

***Major update Diary format***
---
Date

***Major Changes***
***Bug Fixes***
***Screenshot Updates***
***Upcoming Changes***
***Learning Notes***

TL:DR

---
How to Setup Flatpak on Ubuntu 20.04
Tags: flatpak, ubuntu, linux, server
Published: 2021-02-16 18:26:37

In this article, we’ll explain how to setup Flatpak on Ubuntu 20.04.

Flatpak is a next-generation technology for building and distributing desktop application on Linux. This article will guide you the installation and managing Flatpak packages in Ubuntu 20.04.

<a href="https://www.hostnextra.com/kb/how-to-setup-flatpak-on-ubuntu-20-04/">Install Flatpak on Ubuntu 20.04</a>

Let’s get started with the installation process.

####1. Keep the server updated

 # apt update -y && apt upgrade -y

####2. Install Flatpak

 # apt install flatpak -y

####3. Add the Flathub repository

Flathub is the best place to get Flatpak apps. To enable it, run:

 # flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

####4. Install apps

You can find list of apps here. Following command will install NordPass Password Manager.

 # flatpak install flathub com.nordpass.NordPass

To run the app, use the following command:

 # flatpak run com.nordpass.NordPass

To update the app, use following command:

 # flatpak update com.nordpass.NordPass

To uninstall the app, use following command:

 # flatpak uninstall com.nordpass.NordPass

To list all installed app, use following command:

 # flatpak list

That’s it. The installation has been completed successfully.

In this article, we’ll explain how to setup Flatpak on Ubuntu 20.04.

Get high performance <a href="https://www.hostnextra.com/10gbps-dedicated-servers.html">Intel Xeon dual E5 series server</a> and <a href="https://www.hostnextra.com/vps-hosting.html">KVM VPS</a> instantly.
DevOps for ASP.NET Developers: Hosting NuGet Packages
Tags: devops, dotnet, nuget, packages
Published: 2021-02-16 18:18:24

NuGet defines how packages for .NET are created, hosted, and consumed. Using NuGet feeds, you can make your packages publicly available or limit them to an audience, such as your internal team.

In this episode, Abel shows Jeremy some different options for publishing and hosting your own NuGet packages.

{% youtube 8zWcH6DwDKQ %}

If you liked this video and would like to see some more of our .NET content, please subscribe to our [.NET Developers YouTube Channel](https://www.youtube.com/channel/UCvtT19MZW8dq5Wwfu6B0oxw).

<ul>
<li><a href="https://docs.microsoft.com/nuget/create-packages/overview-and-workflow?WT.mc_id=dotnet-00000-cephilli" target="_blank">NuGet <strong>Package creation workflow</strong></a></li>
<li><a href="https://docs.microsoft.com/nuget/nuget-org/publish-a-package?WT.mc_id=dotnet-00000-cephilli" target="_blank">Publishing NuGet packages</a></li>
<li><a href="https://github.com/features/packages" target="_blank">GitHub Packages</a></li>
</ul>
The 7 Most Popular DEV Posts from the Past Week
Tags: top7
Published: 2021-02-16 18:15:16

---
title: The 7 Most Popular DEV Posts from the Past Week
published: true
description: A round-up of the most-read and most-loved contributions from the community this past week.
tags: icymi
cover_image: https://thepracticaldev.s3.amazonaws.com/i/sfwcvweirpf2qka2lg2b.png
---
Every Tuesday, we round up the previous week's top posts based on traffic, engagement, and a hint of editorial curation. The typical week starts on Monday and ends on Sunday, but don't worry, we take into account posts that are published later in the week. ❤️

### Senior Developers — They're Just Like Us!

@kevinhickssw touches on an important facet of being alive: that no matter your experience level, nobody is immune from impostors syndrome — not even senior devs.

{% link https://dev.to/kevinhickssw/even-senior-developers-have-imposter-syndrome-4e8f %} 

### Demystifying front end vs back end
Thanks for this explainer on the differences between front and back end development, @lanrewaju!

{% link https://dev.to/lanrewaju/front-end-vs-back-end-web-development-4olb %}


### A race to the solution

If you've ever gotten stuck on the `can’t perform a React state update on an unmounted component` warning, this thorough guide from @saranshk will be a life-saver.


{% link https://dev.to/saranshk/avoiding-race-conditions-and-memory-leaks-in-react-useeffect-3mme %} 


### The how, when, and why behind refactoring
After refactoring, @notsidney's team now has a more solid foundation to build more features on, they squashed a few tricky bugs, _and_ they came out of it with a guide on how contributors can write new field types. Great job, team Firetable!

{% link https://dev.to/notsidney/we-refactored-10k-lines-of-code-in-our-open-source-react-project-1a9a %}

### Your AWS study buddy
@scrummastert passed the AWS Certified Developer Associate exam with flying colors (96%!). In this post, they share how they did it so you can be better prepared if you're studying for this certification. 

{% link https://dev.to/scrummastert/how-i-passed-the-aws-certified-developer-associate-exam-1336 %}

### Delivering on promises

"Do you remember stumbling on your first `Promise {pending}`?" asks @spartakyste "Putting a `.then` just to see if it will magically work?" — If so, this article is for you.

{% link https://dev.to/spartakyste/the-promises-guide-i-would-have-loved-as-a-junior-developper-3621 %}

### COVID Crawler

@kaylasween wanted a way to track the moving average of COVID cases per day in their home state, Mississippi. To do it automatically on an ongoing basis, they wrote up a crawler to get all the important data from the state’s Department of Health website. Nice work!

{% link https://dev.to/kaylasween/i-wrote-a-crawler-for-the-first-time-58l3 %}

_That's it for our weekly wrap up! Keep an eye on dev.to this week for daily content and discussions...and if you miss anything, we'll be sure to recap it next Tuesday!_
Heroku Error - H10 App Crashed
Tags: heroku, kafka, snowflake, kafkaconnect
Published: 2021-02-16 16:59:30

I am trying to pipeline with heroku salesforce postgres to snowflake through heroku kafka and confluent kafka connect.

when my curl statement start execute am getting below error.

I am new to heroku and snowflake and am not sure where my configuration is breaking? 

My cURL Command:

curl -vvv -X POST -H "Content-Type: application/json" --data /etc/kafka-connect/connect-distributed.properties https://sfsc-kafka-c1-test.herokuapp.com/connectors

Error:
at=error code=H10 desc="App crashed" method=POST path="/connectors" host=sfsc-kafka-c1-test.herokuapp.com request_id=bbd73917-a817-c876-0383-ece8a1baa132 fwd="" dyno= connect=0ms service=0ms status=503 bytes=561 protocol=http tls_version=tls1.2