teleren/devto huggingface dataset:
Deploying Your First Amplify Project with Serverless
Tags: aws, serverless, nextjs
Published: 2021-01-16 17:49:25

It is everyone joy to see what he or she has done no matter how little the project might be.

In a [previous article](https://dev.to/iammiracle/creating-your-first-amplify-project-with-next-js-app-10j8), I showed you how to create your first amplify project and now we will be deploying the static project.

The traditional approach will be to get an EC2 instance and deploy your app on the instance, but there is an easy, cost effective and modern approach of deploying your app.

This modern way is by using the Serverless approach. In our case, we started our project with Next.js, so we are going to be using the **[Serverless Next.js](https://github.com/serverless-nextjs/serverless-next.js)**

In the root directory of your project, you should add a YAML file, called `serverless.yml`, then add this line of code

```
# serverless.yml

myFirstApplication:
  component: "@sls-next/serverless-component@1.16.0"
```

Once this is done, you can run this command:

`npx serverless`

Wait for some minutes for the process to complete. Once the process is complete, a URL will be created for you to see your app. Here is [mine](https://d2ygsuq8gr01pn.cloudfront.net/)

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

Note, if the generated URL shows **This site can't be reached**, you will have to be patient and keep reloading till it shows your app.

Congratulation, your first amplify app is now live.
the return statement in functions
Tags: python, programming, tutorial, beginners
Published: 2021-01-16 17:49:00

*Let me start with a fact: Every function returns a value when called.*

Well, I don't know about you, but I was surprised to know about it in the first place!

Let's see an example to prove my point:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gzo8m0us2lrw708ob1la.png)

Output:
```
Welcome to my blog post
None
```

Did you see that?
When I called the function, it has returned the special type `None`.
The variable `post` stores it and prints it out in the second line.


Now, we can explicitly return a value from a function by using the `return` keyword.

## return statement
* The return statement includes a `return` keyword followed by an expression.
* An expression is a set of conditions which produces a value.
* So, the return statement can contain an expression or an explicit value to be returned.
* A return statement also ends the function execution. This means that any statements inside a function following the return statement will not be executed.
* Take a **note** that return statement cannot be used outside a function.

Let's code a few examples:

### 1) Single return statement
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/p29se4137v6npd84jsfb.png)
Output:
```
21
```
As you can see in this example, we have given an expression which returns the product of given two numbers.

### 2) Multiple return statements
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0ebk7v1ygydcisjgbnpi.png)
Output:
```
21
3.14
Try again!
```
Here, an explicit value is specified in multiple return statements.

### 3) return statement with multiple values
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/zuec2h0t0f967vai6p4y.png)
Output:
```
(21, 63, 210)
```
This example returns dynamic values in a tuple based on the given argument.

### Best Resources

- [Python Blog Series](https://dev.to/aswin2001barath/series/10416) : A Blog series where I will be learning and sharing my knowledge on each of the above topics.

- [Learn Python for Free, Get Hired, and (maybe) Change the World!](https://academy.zerotomastery.io/a/aff_tz1t0tpx/external?affcode=441520_dcwk-s8s) : A detailed roadmap blog by Jayson Lennon (a Senior Software Engineer) with links to free resources.

- **Zero To Mastery Course** - [Complete Python Developer](https://academy.zerotomastery.io/a/aff_9khypm7v/external?affcode=441520_dcwk-s8s) : A comprehensive course by Andrei Neagoie (a Senior Developer) that covers all of the above topics.

**Who Am I?**

I’m Aswin Barath, a Software Engineering Nerd who loves building Web Applications, now sharing my knowledge through [Blogging](https://medium.com/techsoftware) during the busy time of my freelancing work life. Here’s the link to all of my socials categorized by platforms under one place: https://linktr.ee/AswinBarath

**Thank you** so much for reading my blog🙂.
Creating Your First Amplify Project with Next.js App 
Tags: aws, nextjs, amplify
Published: 2021-01-16 17:48:21

To create your first Amplify project with Next.js, you first need to create a Next.js App and this can easily be done by running:

`npx create-next-app project-name`

Wait for some minutes for the process to complete, then you can move to the project directory from your terminal and you will be ready to create your amplify project.

If you need little understanding of what Amplify is, you can check it out [here](https://aws.amazon.com/amplify/).

The first step to creating your amplify project is by Initialization. Here is how you can do that:

`amplify init`

You will be asked some questions, to make it easy, kindly see image below;

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

Once you are done filling the questions, the initialization process will begin

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

Now you have created your project, you can search for amplify in your AWS search box, click on Amplify and you will see your project.

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

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

There are lot of things you can still add to your project. You can add authentication flow, lambda functions and many more.
Otimizando Imagens PNG
Tags: otimizacao, imagem, png, tamanho
Published: 2021-01-16 17:47:00

### Introdução
Uma demanda que surgiu no [7Belts](https://7belts.com/?utm_source=nobeltdev) foi da otimização e redução de tamanho das imagens, que são armazenadas na AWS S3, para melhorar a velocidade de renderização da aplicação e melhorar a experiência do usuário.

O optimize-png-images é um script bash utilizado em sistema unix para compactar imagens png sem quase perder a qualidade da imagem original.

[Github - Optimize Png Images](https://github.com/joaofernandez/optimize-png-images)

### Otimização dos arquivos PNG

Para otimizar as imagens utilizei 2 cli:
* optipng - Otimiza um png sem perder nenhuma informação;
* pngnq - Quantiza imagens em PNG em formato 8 bit RGBA.

### Script de otimização

Criei o script optimize-png.sh que recebe como parâmetro um pasta que possuí imagens *png* e vai otimiza-los reduzindo seus tamanhos sem quase nenhum efeito.
_O script também irá varrer todos os arquivos *png* das subpastas._

```bash
# optimize-png-images.sh
#!/bin/bash
if [ -z $1 ] ; then
  echo "Error: Necessário informar um path contendo imagens png!" && exit 1;
fi
pngnq $(find $1 -type f -name '*.png') -e -temp.png  # Realiza a quantização
rm $(find $1 -type f -name '*.png' | grep -v "\-temp.png") # Remove os antigos arquivos
find $1 -type f -name '*.png' | grep "\-temp.png" | awk -F '-temp.png' '{print "mv "$1"-temp.png "$1".png"}' > temp-script.sh # Cria um script temporário que removerá os sufixo "-temp"
sh temp-script.sh # Executa o script temporário
rm temp-script.sh # Remove o script temporário
optipng $(find $1 -type f -name '*.png') # Otimiza o resultado
```

### Exemplo de resultado

Exemplo real da aplicação do script. Utilizo ele na pasta *static* que guardam as imagens utilizadas numa aplicação web:

![Resultado da aplicação do script](https://dev-to-uploads.s3.amazonaws.com/i/ddz7f1amo7c2t078gvjq.png)

O resultado foi a redução de 2.7Mb -> 1.2Mb, redução de 44% do tamanho total.
Fastest Google Fonts | Notes
Tags: notes, webdev, css
Published: 2021-01-20 08:52:43

---
title: Fastest Google Fonts | Notes
published: true
date: 2021-01-16 17:38:37 UTC
tags: notes,webdev,css
canonical_url: https://abhi.page/notes/fastest-google-fonts/
---

> **Direct Links:**
> - [csswizardry.com/2020/05/the-fastest-google-fonts](https://csswizardry.com/2020/05/the-fastest-google-fonts/)
> - [css-tricks.com/how-to-load-fonts-in-a-way-that-fights-fout-and-makes-lighthouse-happy](https://css-tricks.com/how-to-load-fonts-in-a-way-that-fights-fout-and-makes-lighthouse-happy/)

- Preconnect to Google Font server.
- Use `preload` to asynchronously load the font fast on supported browsers.
- In the link to the main font stylesheet:
  - Set `media=print` on the stylesheet to stop loading it during page load.
  - On page load, set `media=all` on stylesheet (using Javscript) to load the font.
- As a fallback for browsers where Javascript is disabled, include a normal link to the stylesheet within `<noscript>` tag.

Here is a recommended snippet:

```html
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />

<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" />

<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" media="print" onload="this.media='all'" />

<noscript>
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" />
</noscript>
```

* * *

[**Read on abhi.page**](https://abhi.page/notes/fastest-google-fonts/)
Excluding Hibernate entities from auto-generation
Tags: java, hibernate, tips
Published: 2021-01-16 17:31:56

Today I had to do something completely new with Hibernate, within the scope of a unit test. I had a group of entities and wanted to exclude one of them from the schema auto-generation (hibernate.hbm2ddl.auto=create).

After spending a couple of hours trying out different things and reading Stackoverflow answers, I hit jackpot with this cool solution:

- implement the SchemaFilterProvider and the SchemaFilter interfaces
- in the SchemaFilter implementation, add an if condition to includeTable so that it returns false for the table that you don’t want to create
- add hibernate.properties to the classpath and define hibernate.hbm2ddl.schema_filter_provider to point to the SchemaFilterProvider implementation

What follows is an example of an implementation. In my case, I want to exclude all entities that would create a table that has namespace in its name.

{% gist https://gist.github.com/treaz/4c576f6701385a727a6df4cd479089d5 %}

{% gist https://gist.github.com/treaz/3cd4ec457eefbf2b79ce01a527022160 %}

Reference: https://stackoverflow.com/questions/6212144/how-to-disable-schema-validation-in-hibernate-for-certain-entities
Fugitive - vim and git
Tags: git, vim, fugitive
Published: 2021-01-16 17:30:50

---
title: Fugitive - vim and git
series: git tools
published: true
tags: git, vim, fugitive
---

[vim-fugitive](https://github.com/tpope/vim-fugitive) is the go-to git extension for VIM. I think there is no other git extension which is working so well. 
Fugitive is not only a simple git wrapper, but it can act like, if its needed.

The most used mapping in my case are:

```vim

noremap <leader>ge :Gblame<CR>
noremap <leader>gs :Gstatus<CR>
noremap <leader>gc :Gcommit<CR>
noremap <leader>gl :Gpull<CR>
noremap <leader>gh :Gpush<CR>

```

With `Gstatus` you get a git status of your current repository.

![fungitive-git-status.png](https://www.dropbox.com/s/3jrhm17jzdwysxk/fungitive-git-status.png?raw=1)

If you want to stage a file. Use `s` or `-` for staging the file. 
You can also stage all your file at once, if you are using `s` or `-` on the header `Unstage`.

If you want to unstage, us `u` on your item, or on the `Stage` header.

![fungitive-git-status-2.png](https://www.dropbox.com/s/gyhg28l1ik2zpzq/fungitive-git-status-2.png?raw=1)

If you want to see a diff, you go on the line of your changed file and hit `=` or `i`.

![fungitive-git-status-3.png](https://www.dropbox.com/s/sj07plb9m2yasfc/fungitive-git-status-3.png?raw=1)

If you want to open the file, hit `Enter`. The status buffer will stays, and the selected file will be open in a different buffer.

With `Gcommit` a additional split for your commit message will open. With save and close, the commit will be executed.

With `Gpush` your commit will be pushed to your remote. 

In the case you have to revert you local changes, with `Gread` it will be performing a `git checkout -- %`

If you want to take a look on your git logs? No problem, fungitive is covering that too.
It will open your git log in a quickfix list, and it shows you what happened in previous commits.

![fungitive-git-log.png](https://www.dropbox.com/s/7tszan44vy7p1vw/fungitive-git-log.png?raw=1)
I reviewed nearly 70 software developer portfolios. Here's what I discovered. 
Tags: beginners, education, career, portfoliocon
Published: 2021-01-16 17:28:35

---
title: I reviewed nearly 70 software developer portfolios. Here's what I discovered. 
published: true
description: This past week I reviewed nearly 70 software developer portfolios and noticed some interesting trends.
tags: beginner, education, career, portfoliocon
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/10w9eq47n897r4t4os3m.jpg
---

This past week I reviewed nearly 70 software developer portfolios on [my YouTube channel](https://www.youtube.com/realtoughcandy?sub_confirmation=1 ). 

I had a blast! I also noticed some trends & patterns I thought were interesting. Here are a few of my findings: 

### **TRENDS** 

- **Dark mode.** This was a nice UX/UI addition I saw in many of this year's portfolio submissions. I wear dark mode to life, so thank you for going easy on my eyeballs.   

- **Static site deployments to Netlify.** While last year's submissions did feature quite a few github.io static pages, this year's crop of portfolios featured numerous Netlify deployments. 

- **A larger international audience.** Compared to last year, this year's collection of portfolios featured a larger international audience. Just about every continent was represented, including submissions from Qutar to Poland to Kenya and so many more. Antarctica for Portfoliocon 2022? 

We also gave away some wonderful prizes, so thanks to our prize sponsors Educative.io, ZeroToMastery.io, CodeBreakthrough.com (we also gave away a few courses on RealToughCandy.io including [Portfolio Surgery](https://www.realtoughcandy.io/p/portfolio-surgery)). 

### **Thank you everyone for tuning in! I can't wait for Portfoliocon 2022 and have big plans for it – possibly even making it an in-person event!**
Keep vim Location List Closed
Tags: vim, linux
Published: 2021-01-16 17:24:03

---
canonical_url: https://waylonwalker.com/keep-location-list-closed
cover: /static/keep-location-list-closed-xmas2020.png
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/yywxp8w6x6vkzzrp1ec9.png
tags: ["vim", "Linux"] 
title: Keep vim Location List Closed
published: true
status: draft
---

Vim's (neovim in my case) location list can provide some very useful information while developing.  Mine gives me information about linting and type checking errors with fairly little config.  Generally, it sits nicely at the bottom of the screen and barely affects me.  Other times, especially while zoomed way in during a presentation, it just gets in the way.

![location list eats the screen](https://waylonwalker.com/location-list-eats-screen.png)

> Location List eating up the screen while I am zoomed in and trying to live code

## Toggling the location list

Through some google search I found the culprit was syntastic.  It has an `auto_loc_list` feature.  We can turn it off by setting
`syntastic_auto_loc_list=0`.

``` vim
let syntastic_auto_loc_list=0
```

## Keybindings

I want to keep the location list open automatically most of the time, but when I don't want it to keep opening it's generally detrimental.  Trying to live code while the location list keeps taking up the whole screen is not cool.


First, create a function that will toggle both the location list and syntactic together.

``` vim
let s:syntastic_auto_loc_list = 0
function! s:ToggleLocationList()
    if s:syntastic_auto_loc_list == 1
        let s:syntastic_auto_loc_list = 0
        let syntastic_auto_loc_list = 0
        :lclose
    else
        let s:syntastic_auto_loc_list = 1
        let syntastic_auto_loc_list = 1
        :lopen
    endif
endfunction
```

This binding will allow me to use `gtl` from normal mode to toggle the location list.

``` vim
:command! ToggleLocationList :call s:ToggleLocationList()
nnoremap gtl :ToggleLocationList<CR>
```

I am starting a set of **toggle** keymaps under the `gt` keybinding, this one is the second one after a keybinding made to toggle paste mode.
Why Can’t I Add or Install Plugins in WordPress?
Tags: wordpress, webdev, php, plugin
Published: 2021-01-16 17:20:06

The solution is here 
Please find below the code into your 
“wp-config.php” file.

define('DISALLOW_FILE_MODS',true);
define('DISALLOW_FILE_EDIT',true);

If above code is used then replace with below code,

define('DISALLOW_FILE_MODS',false);
define('DISALLOW_FILE_EDIT',false);

Thanks!
#Day 31 & 32: DSA Learning Series Week-2 solved 3 problems.
Tags: 100daysofcode
Published: 2021-01-16 17:12:36

I have solved just 3 questions and I'm stuck in 2 problems namely: Matched brackets and Not all flavour. I'll solve it by tomorrow for sure. I'm gonna rack my brain until I find the solution. I was a little disappointed as earlier I was unable to solve even a single question related to DSA but now I'm able to solve a few. The progress is slow and steady but I will make sure to be consistent.
My experience in hacker community: MLH
Tags: mlh, community
Published: 2021-01-15 04:16:00

MLH—with its organized, self-appointed set of leadership—was what first brought the collegiate hackathon community together back in 2013. But that label has since been taken over by the self-governed Hackathon Hacker community, which is somewhat less exclusive.

Nowadays, I would say that MLH's main value is the role the organization plays in how hackathons are perceived outside of the community. For example:

The recent MLH livestream at PennApps and MHacks that was featured on Twitch.
Being #1 in the MLH ranking helps convince school administrators that hackathons are valuable and worthwhile.
A blog of professionally taken and well-written articles featuring hackers and hackathons.
Their copywriting emphasizes learning and creating, avoiding the negative connotations of "hacking" as much as possible.
Sponsorship by several well-known tech companies that help increase the legitimacy of hackathons.
They are going international.

Snakes and ladders (8–10th January):- My first hackathon was the one organised by MLH. I didn't have team till the last moment, still I happily joined and started to think about the idea. Since it was the first-ever hackathon for me, I didn't know much about the implementation of the things but I ended up making a checkers game with AI with super mario theme. xD

LOCAL HACK DAY (10th-18th January):- Second hackathon was also hosted by MLH in a gap of an hour. AN HOUR! Till now I got the idea of how to implement things,and joined a super active, supportive community Eddie hub! I met really cool, experienced people from various parts across the globe. In three days our guild is on top of the charts and this is all because of hard working people in our guild. I'm really greatful. I'm on 75 th position among thousands of hackers now. We formed a team inside a guild for another Hackathon :hack the northeast and beyond this weekend. That will be my third Hackathon!
Really looking forward to that and big shout-out to the MLH mentors who manage these hackathons in a really professional and fun way and give chance to beginners as well as experienced programmers all around the world. I haven't attended in person Hackathon yet because my first Hackathon happened in the pandemic and it might take an year more for this to happen I guess but I'm loving Hackathons and the community already!

Don't fear to attend hackathons even if you're a beginner, you learn, network and grow your skills here. 

Thank you for reading :)
How To Curl Single File Using Access Token In Gitlab
Tags: gitlab, token, cloudopz, devops
Published: 2021-01-16 17:02:24

## What’s In This Document 
- [Create access token](#-Create-access-token)
- [Get project ID to call API](#-Get-project-ID-to-call-API)
- [Get raw file from repository](#-Get-raw-file-from-repository)


### 🚀 **[Create access token](#-Create-access-token)**
- Go to `User Setttings` -> `Access Tokens`

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

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

### 🚀 **[Get project ID to call API](#-Get-project-ID-to-call-API)**
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5g1ub7tnfdal48pz5noj.png)

### 🚀 **[Get raw file from repository](#-Get-raw-file-from-repository)**
Ref: https://docs.gitlab.com/ee/api/repository_files.html#get-raw-file-from-repository

- Format: `GET /projects/:id/repository/files/:file_path/raw`

- Example 
```
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fmodels%2Fkey%2Erb/raw?ref=master"
```

- To get file `scripts/run.sh` in project the url is
```
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/13083/repository/files/scripts%2Frun.sh/raw?ref=master"
```

<h3 align="center">
  <a href="https://dev.to/vumdao">:stars: Blog</a>
  <span> · </span>
  <a href="https://vumdao.hashnode.dev/">Web</a>
  <span> · </span>
  <a href="https://www.linkedin.com/in/vu-dao-9280ab43/">Linkedin</a>
  <span> · </span>
  <a href="https://www.linkedin.com/groups/12488649/">Group</a>
  <span> · </span>
  <a href="https://www.facebook.com/CloudOpz-104917804863956">Page</a>
  <span> · </span>
  <a href="https://twitter.com/VuDao81124667">Twitter :stars:</a>
</h3>
Xray & Ultrasound

Published: 2021-01-16 16:53:18

X-rays and ultrasound examinations are often necessary and valuable for our diagnostic approach. A simple x-ray can sometimes be adequate, but some other times multiple x-rays should be performed (i.e. barium contrast, musculoskeletal conditions etc).
Ultrasound examination is always more detailed and can provide us with special information about the visceral organs of the abdomen or thorax.
At Al Wasl and Abu Dhabi The City Vet Clinic Branches our specialists can also perform a detailed Cardiology examination via advanced ultrasound machines (colour Doppler).
https://thecityvetclinic.com/service/x-rays-ultrasound/