teleren/devto huggingface dataset:
GCP Cloud Functions with a Static IP - Terraform version
Tags: googlecloud, serverless, terraform
Published: 2021-01-10 14:06:45

---
title: GCP Cloud Functions with a Static IP - Terraform version
published: true
description: 
tags: googlecloud, serverless, terraform
//cover_image: https://direct_url_to_image.jpg
---
Following this [great post](https://dev.to/alvardev/gcp-cloud-functions-with-a-static-ip-3fe9) from [Alvaro](https://dev.to/alvardev), I converted the `gcloud` commands, to their respective Terraform config.
```
resource "google_compute_network" "cloud_function_network" {
  name = "cloud-function-network"
  auto_create_subnetworks = false
}

resource "google_vpc_access_connector" "connector" {
  name = "connector"
  region = "europe-west3"
  ip_cidr_range = "10.8.0.0/28"
  network = google_compute_network.cloud_function_network.name
}

resource "google_compute_address" "egress_ip_address" {
  name = "egress-ip-address"
  region = "europe-west3"
}

resource "google_compute_router" "router" {
  name    = "egress-router"
  region  = "europe-west3"
  network = google_compute_network.cloud_function_network.name
}

resource "google_compute_router_nat" "cloud_function_nat" {
  name = "egress-router-nat"
  router = google_compute_router.router.name
  region = google_compute_router.router.region
  nat_ip_allocate_option = "MANUAL_ONLY"
  nat_ips = google_compute_address.egress_ip_address.*.self_link

  source_subnetwork_ip_ranges_to_nat = "ALL_SUBNETWORKS_ALL_IP_RANGES"

  log_config {
    enable = true
    filter = "ERRORS_ONLY"
  }
}
Changing How You Eat
Published: 2021-01-10 14:02:24

As you may know, not fueling up with the right 
nutrients can affect how well your body performs 
and your overall fitness benefits.  Even though 
healthy eating is important, there are myths that
hinder your performance if you listen to them.

Below, you'll find some myth busters on healthy
eating.

1.  Working out on an empty stomach.
If you hear a rumbling noise in your stomach, the
rumbling is trying to tell you something.  Without
listening to them, you are forcing your body to
run without any fuel.  Before you exercise or do
any physical activity, always eat a light snack
such as an apple. more at https://cara-ku.com
MYSQL up!  Waiting on DNS Propagation.
Published: 2021-01-10 14:01:03

series: [“Ordinary Geeks Covid Tracker 5”]

Well, I spent one hour deciding I would shortcut my coding and instead of following instructions, do what I thought was best. Anyway, it didn't work. My cousin told me the deadline was today ( yesterday I said it was tomorrow morning).  So, at least I am using Digital Ocean for the database. Now I can move on other aspects of the code. I think I'll stick with the website I already have and use the Digital Ocean database (most the work is on the database anyway) for now. That way if I can't submit to my new digital ocean hosting, I won't be mad.
Improve your skills by practicing in real-world projects
Tags: programming, github, codenewbie
Published: 2021-01-10 13:50:46


If you're at that stage of your journey where you can build a simple project from scratch, but you're not sure you're capable of working in an existing codebase, this article might help you.

In this article, I'll show an approach that gets you experience working on existing codebases, while still providing a fallback if things get too hard.

## Overview

The approach can be summarized by the following steps:
1. Find an open-source project on Github that uses the technologies you use and that interest you.
2. Go through the list of merged pull requests and find one related to a new feature or a bug fix. Be careful not to start with overly complex ones. The number of lines of code changed is a good indicator.
3. Clone the repository from which the PR originated.
4. Checkout into the commit previous to the first commit of the PR. You are now looking at the codebase the contributor was looking at before starting to work.
5. Implement the feature or fix of the PR you chose.

If you ever get lost, you can always look at PR to have an idea of what you have to do.

Also, be sure to read the issue(s) associated with the PR. There you'll find the requirements of what you need to implement.

Another benefit of this approach is it will make you accustomed to the architecture of the project. Which will make it much easier for you to one day contribute to it.

Let's look at an example of how this would work in practice.

## Example

To exemplify, I'll use a [PR](https://github.com/excalidraw/excalidraw/pull/2150) I've submitted a while ago to [Excalidraw](https://excalidraw.com/).

We start by cloning the repository the PR comes from:

```
git clone ttps://github.com/Jnforja/excalidraw.git && cd excalidraw
```
Then we find and copy the id of the first commit of the PR.

To do that we go to the PR page on Github, click on the [commits tab](https://github.com/excalidraw/excalidraw/pull/2150/commits), and copy the id of the oldest commit.

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

Then we checkout into the first commit:

```
git checkout -b new-branch 7b5fc6b8162b5e0d387093dfdc48225572656c73
```

All that's left is to go to the commit previous to the first one:
```
git reset HEAD~1 && git stash
```

You're now ready to start coding.

I hope this technique is useful to you and that you use it to learn something new.

---

Enjoyed this article? Then consider following me on [Twitter](https://twitter.com/ImForja).
Feed not importing to Dev.to
Tags: help
Published: 2021-01-10 13:40:03

Could anyone help me figure out why my xml feed isn't importing to dev.to? 

Feed link: https://danielkelly.io/feed.xml

I go to Settings > Extensions > Publishing to DEV Community from RSS and click "Fetch Feed Now" and it gives me a timestamp of being recently fetched but when I go to my dashboard I don't see any new post drafts. 

Thanks!
Boost Your Productivity in 2021, get a Notion 😎
Tags: productivity, career, webdev
Published: 2021-01-10 13:37:09

I recently discovered the Notion App this week, and it's honestly been the best thing in 2021 so far! For those who don't know what Notion is, here's the Wikipedia definition:
`Notion is an application that provides components such as databases, kanban boards, wikis, calendars, and reminders. Users can connect these components to create their own systems for knowledge management, note-taking, data management, project management, among others. These components and systems can be used individually, or in collaboration with others.`

![that sounds good](https://media.giphy.com/media/eXnLOTCiLID841VN4a/giphy.gif)

Here are the main things you need to know about Notion:
### It works like any other text editor.
### It's features are built-in.
* You can access features easily by starting your line with the following character: `/`.
* You'll get access to numerous 'block' options where you will be able to add in tables, calendars, kanboards, you name it, in order to customize your page to your liking.
* ULTIMATE CUSTOMIZATIONNNN

### Start with a Template
My recommendation would be to get started with a template, when you're just learning how to navigate through Notion. Explore options, play around with the interface. Once you're comfortable, start a page of your own or make your own custom template!

free templates [here](https://www.notion.so/Bachelor-of-Arts-in-Organization-Fall-2020-02272d62ab204e88817b5ab3f332617f), [here](https://www.notion.so/2021-Goals-and-Reflections-Template-282f0ef2c7a146abb37a0fa2153072be) and [here](https://www.notion.so/twirling-pages-notion-5e98a9e589274f9089db30a16ef58e6d)

You can also use one of the many build-in templates that come with Notion.

***Resources***
* Notion's plethora of tutorials on Youtube https://www.youtube.com/c/Notion/featured
* Keep Productive, Beginners Guide to Notion https://www.keepproductive.com/blog/notion-for-beginners#:~:text=What%20is%20Notion?,toolkit%20to%20get%20work%20done
* youtube walkthrough https://www.youtube.com/watch?v=lZ83Vu0SoG0&t=925s
Deploying a Static Website to the Cloud with DigitalOcean App Platform for dohackathon
Tags: dohackathon, showdev, digitalocean
Published: 2021-01-10 13:34:37

## What I built
Build a personal portfolio site as my submission for [DigitalOcean App Platform Hackathon on DEV!](https://dev.to/devteam/announcing-the-digitalocean-app-platform-hackathon-on-dev-2i1k)

### Category Submission: 
Personal Site/Portfolio

### App Link
[🔗Live app ↗️](https://hrshmistry-8yvjk.ondigitalocean.app/)

### Screenshots
![Home page](https://dev-to-uploads.s3.amazonaws.com/i/51j4phmlb1dqt30lgt0v.png)

![Project page](https://dev-to-uploads.s3.amazonaws.com/i/181tnqmd4liw9o5inc2i.png)

![Blog page](https://dev-to-uploads.s3.amazonaws.com/i/1h65u92b5by9ix42nsyc.png)

### Description
A simple Static website to showcase my personal portfolio made using only HTML and CSS. Having my projects and blogs link as well as social media links. and also it's responsive so easy to use on mobiles too.

### Link to Source Code
{% github https://github.com/hrshmistry/hrshmistry-portfolio no-readme %}

### Permissive License
[MIT](https://choosealicense.com/licenses/mit/)

## Background
Personal/portfolio sites give you your own place on Web to showcase your work to the World. also [neog.camp](neog.camp) inspired me a lot to build projects like this.

### How I built it 
To deploy my website on Web I used DigitalOcean App Platform, it is really very easy to deploy with app platform. it's integration with GitHub and similar services deliver an easy and flawless way to deploy websites. Deployment on DO's app platform is free up to 3 static websites.  

### Additional Resources/Info
You can follow [this article](https://www.digitalocean.com/community/tutorials/how-to-deploy-a-static-website-to-the-cloud-with-digitalocean-app-platform) from DigitalOcean to deploy app from GitHub with auto deploy. to get started with App Platform follow [this](https://www.digitalocean.com/community/tags/digitalocean-app-platform?subtype=tutorial) and [this](https://www.youtube.com/watch?v=8ScLbnjbRnw&feature=youtu.be).

{% user hrshmistry %}
Start an external program with Python
Tags: python
Published: 2021-01-10 10:49:43

You can start a program using just Python code. You do so by a module called subprocess. 

If it is a terminal program, you can save its output in your Python program. 

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

from subprocess import Popen, PIPE

process = Popen(['cat', 'test.py'], stdout=PIPE, stderr=PIPE)
stdout, stderr = process.communicate()
print(stdout)
```

The *cat* command outputs the contents of a file on a Linux system. This may also work on Mac, but if you're on Windows try another command.

You can start non-terminal programs. This works for any program regardless of if it's something simple like notepad or something more advanced like chrome. 

On Linux there's the program mousepad, which is a clone of the notepad program. You could run it like this:

```python
>>> import subprocess
>>> import sys
>>> result = subprocess.run(["mousepad"])
```

The [subprocess](https://pythonspot.com/python-subprocess/) module lets you do all kinds of things with running programs.

This module is part of the standard modules, so you don't have to install it with the [Python package manager](https://pythonbasics.org/how-to-use-pip-and-pypi/). 

If the program is taking to long to execute, you can use a timeout

```python
import subprocess
import sys

result = subprocess.run([sys.executable, "-c", "import time; time.sleep(3)"], timeout=1)
```
Daily Developer Jokes - Sunday, Jan 10, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-01-10 13:00:15

---
title: "Daily Developer Jokes - Sunday, Jan 10, 2021"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Sunday%2C%20Jan%2010%2C%202021"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1258a3e5534.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ Why did the developer ground their kid?

___A:___ They weren't telling the truthy
 -->
Micell - A collection of functions assisting frontend development
Tags: utility, helper
Published: 2021-01-10 12:59:40

You maybe always need to write some utility or helper functions in your projects,regardless of the size of the project. These functions are consist of many categories. Some can be **shared across the projects**, such as:

* Cookie manipulation
* Parse or format the date
* Format the number
* Detect the type of browser
* Base64 conversion
* Common regular expressions
* And so on.

These are the functions we care about. These are the functions [Micell](https://micell.org) cares about.

## So, what is Micell?

[Micell](https://micell.org/) (pronounced /maɪˈsel/, like my-cell) is a collection of functions which is used with web development daily. Micell only includes the common functions
in the most projects. Also, for integrity, it will include some uncommon functions.

### What is not Micell?

* It is not a replace to Lodash, Momentjs or Dayjs.
* It is not to include all utility functions in your application.

## Why Micell?

* **Shared in community**: You don't need to write the common utility functions repeatedly. Micell make reusing across all projects.
* **Typescript support**: Source code is written with TypeScript. And type declaration files is bundled in npm package.
* **High reliability**: Test in all modern browsers, even in IE 11. Up to 96% test coverage.
* **Import as need**: Use [babel-plugin-lodash](https://www.npmjs.com/package/babel-plugin-lodash) to import the used modules.

## Install

**Npm**

```shell
npm i --save micell
```

**Yarn**

```shell
yarn add micell
```

**CDN**

If you want to use micell with `<script>` directly, you can use [jsDelivr](https://www.jsdelivr.com/package/npm/micell).

```html
<script src="https://cdn.jsdelivr.net/npm/micell"></script>
```

## Usage

```js
import micell from 'micell'

// Generate a random string
micell.randomString();

// Get a cookie value
micell.cookie.get('name')
```

More functions see the [Docs](https://micell.org/docs/).

> Tip: In the micell website, you can try micell in the console of browser which is exported as the global micell object.

## Conclusion

While micell has been intermittently developed for more than one year and includes more than 100 functions, but there are many things you could contribute to make. For example:

* Use it in your project
* Improve the document
* Make the Feedback of bug
* Request the new feature
* And many other things you think micell should do

All contributions are welcome.

* Official website: [https://micell.org](https://micell.org)
* Github repository: [micell](https://github.com/micell/micell)
What 's the Golang developer salary in Germany?
Tags: devops
Published: 2021-01-10 12:52:05

In Berlin, Germany there are tech companies with [golang](https://golang.org/) jobs.

So what is the average annual salary you can expect?

It is seventy thousand three hundred seventy five euros (73.175 euros or $89.427). That is gross so *before tax* the salary range for golang engineers in Berlin Germany is from 65000 euros per year up to 73175 euros per year.

This is gross before tax!

Now the weather you fall on the lower range of that scale or the upper range of that scale well depends on a number of factors. 

## How to get the higher paid job?

I find that the two most important ones are your seniority (something you can't really change) and the financial situation that the company is in (pick the company wisely)

Your seniority will also depend on a number of factors like the years of experience working as a full-time developer is one thing and you need to have minimum three years of full-time experience to be considered the mid-level in Berlin.

If you are new to Golang, there's a good [tutorial](https://golangr.com/) here.

## How to get a Golang job?

But many companies don't just look at the years of experience some actually look much deeper into the complexity of the systems that you have developed in the past as well as at your ability to write reliable code code that scales and code that is clean.

The financial situation of the company always depends on a number of factors but the basic ones include is it a privately owned company does it have investors is it an international corporation with headquarters in Berlin or or just Berlin office.

## Am I eligable?

It's fine if you speak only English, German companies
don't usually require German for their engineering jobs. When you're looking at salaries in Berlin Germany keep in mind that the numbers I shared with you is the base salary so around 60, 70 thousand euros per year.

If you are from outside of the European Union you will need either a blue card or a regular work permit to start a job in Berlin.
Day 1, 2 - 100daysofcode
Tags: 100daysofcode, react, javascript, webdev
Published: 2021-01-10 12:44:10

# Started the react tutorials
Just got started with the course and got introduced to react.
Got to know what components are and how they are structured in the application.
Read about JSX and why it important in writing React application and what the difference if will not use JSX.
Can wait to learn more about it.

Pss - Use JSX 😜
Graphql field to select data from the database
Tags: graphql, dynamicatrribute, apolloserver, javascript
Published: 2021-01-10 12:41:32

The way graphql structures the data fetching architecture is simply awesome. While working with graphql we might have the case where we want to get only certain data from the database. The database has some secret credentials like password, keys, auth ids which we don’t want to disclose even to the API.

So we have to get data from the database dynamically that means select database fields dynamically. For example, if the client selects the only username and email, the graphql API has to fetch only those values from the database.

There are packages that do this for us but we need to avoid installing packages for every bit of the problem. We can do it without any sort of the third packages using the apollo server’s info argument on the resolver.
#####We are using an apollo server here.

```javascript
const resolvers = {
  Query: {
    user(parent, args, context, info) {}
}
```

##

> [info] contains information about the operation's execution state, including the field name, the path to the field from the root, and more. - Apollo server docs

We have the client query:

```javascript
query userDetail($email: String!) {
  getUser(email: $email){
    username
    email
  }
}
```

##

The info arg contains the field name that comes from the client. Now we use it to extract the selection field as:

```javascript
const fields = info.fieldNodes[0].selectionSet.selections;
const attributes = fields.map(field => field.name.value);

console.log(attributes); // ['username', 'email']
```

##

We have both username and email. Now we'll fetch data from the database.

#### sequelize

```javascript
const user = await User.findOne({
  where: { email },
  attributes,
});
```

##

#### With mongoose,

```javascript
const user = await User.findOne({ email }).select(attributes);
```

##

We can modify the user further according to our needs and return to the client.

### Full code

```javascript
const resolvers = {
  Query: {
    getUser: async (_, args, __, info) => {
      const { email } = args;

      try {
        const fields = info.fieldNodes[0].selectionSet.selections;
        const attributes = fields.map(field => field.name.value);

        const user = await User.findOne({
          where: { email },
          attributes,
        });

        return user;
      } catch (error) {
        throw error;
      }
    },
  },
};
```

##

### Final Note

The code above is just for the demo purpose. It might not be the right approach for this kind of simple API but for the more advanced or heavy API, it gives a higher performance as the database selects only given attributes.

Database benchmark also shows selecting only certain fields/attributes increases the query performance because the database only needs to make calculations on given fields.
10 things about the Ruby programming language
Tags: ruby
Published: 2021-01-10 12:38:00

Ruby is an interpreted, high level, general purpose language.It supports different paradigms like functional procedural and object-oriented.

From the [official website](https://www.ruby-lang.org/en/), it is stated that Ruby is, *"a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write."* Ruby on Rails on the other hand is a **full stack web development framework**. 

Packages (programs and libraries) are referred to as **gems** in Ruby. RubyGems is a package manager for Ruby.Some implementations include GoRuby, Topaz, Opal, mruby and JRuby.

I would like to share this quote from the creator of the language. He built a language to suit his needs and this was part of it. 

Ruby is a pure object oriented language. *Everything is an object.* Even a class is an object.

Some programming constructs that are supported by Ruby include mixin, open classes, meta programming, duck typing, YAML, automatic returns.

Features of Ruby lend itself to high quality coding.The redo keyword caught my attention as interesting. Redo, next and retry can be used to control loops.

Finally, I would like to share this [useful tutorial](https://ruby-lang.co/) I found
Write Letter #4 Finally theming, hashtag system, tweaking UI/UX 
Tags: dohackathon, typescript, graphql, react
Published: 2021-01-10 12:27:12

# This is final part of Write Letter retouching welcome page, added light and dark theme and hashtag system !

#### First, I'm glad to say that this gonna be the final part of series !

![Glad sonic](https://media.giphy.com/media/LMQgs60HFzAfdZYKtn/giphy.gif)

Developer love dark mode isn't it ? So I implemented dark/light theme into my app.

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

Gonan be honest at first I was meant to add more theme or even custom color (you choose it !).

Also at first I also want to add background changing system too but that make it look strange somehow...

Alright enough for theming, now hashtag system, just like hashtag system on facebook or twitter it allow anyone to look up for letter with matching hashtag.

And lastly just some minor tweaking to UI like better loading spinner, animationing

### Remark what we've archived
- Theme
- Hashtag
- Better UI/UX
- Minnor bug fixed

That's it for this series, Thanks for reading along here ! I've deployed this app to [DigitalOcean](digitalocean.com) which is lived [here](https://write-letter-ay2j8.ondigitalocean.app/)

### Source code can be found here
- Client: https://github.com/littleboycoding/write-letter
- Server: https://github.com/littleboycoding/write-letter-apollo

---

### Timelapse
Check out my timelapse tool https://github.com/littleboycoding/timelapse
{% youtube Xf4wfpMTHV8 %}