teleren/devto huggingface dataset:
7 Health Tips For Developers
Published: 2021-03-30 08:27:15

## Let’s talk about being a healthy programmer  👨‍💻 

We have to be in front of the computer for very long periods of time 🤷‍♂️but that doesn’t mean we can’t try to be a little healthier doing it.

### Here are some tips to feel better while being glued to the screen:

- 💻 Prep are healthy snacks before you get to work. So when you feel munchy you have something nutritious to snack on.

- 💻 Always have a bottle/glass of water next to you to make sure you get plenty of fluids. Can also be a herbal tea. Stay away from sugary drinks and soda.

- 💻 Set alarms for breaks, they are extremely important and can help you relax your brain and do something else even if for just 5 mins.

- 💻 Incorporate exercise like stretching or yoga, this can be done during your breaks even if just for 10 mins. This way you keep your body moving and prevent things like neck or back pains

- 💻 If you can, get a desk that goes up and down so you alternate between sitting and standing. Sitting for too long is bad but standing for too long is also bad. So the best option is sitting for a bit then standing for a bit and moving in between (as stated in previous point).

- 💻 Get a proper chair, gamers chairs are great or just a good office chair with back support.

- 💻 Move your eyes...that’s right...we tend to stare at the screen for too long, so once in a while do some eye movements like looking around or up and down, open and close your eyes, look at something far ahead. This can prevent headaches and your eyes get less tired. Google 20/20/20 rule.


Please kindly comment below for feedback and you can link up with me on [Twitter](https://twitter.com/chryz_codez) and on this platform for more engagement🤝!
Ruby on Rails 6: Disappearing flash messages with toastr
Tags: ruby, rails, flash
Published: 2021-03-30 08:23:31

---
title: Ruby on Rails 6: Disappearing flash messages with toastr
published: true
tags: ruby, rails, flash
canonical_url: https://blog.corsego.com/flash-messages-with-toastr-js
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q3ws1wazeplv637g6yxj.png
---
Source library: [https://github.com/CodeSeven/toastr](https://github.com/CodeSeven/toastr)

## Installation:

console:

```
yarn add toastr
```

Import toastr in app/javascripts/packs/application.js:

```
global.toastr = require("toastr")
```

app/javascript/stylesheets/application.scss:

```
@import 'toastr'
```

app/javascript/packs/application.js:

```
import "../stylesheets/application"
```

app/views/layouts/application.rb:

```
<% unless flash.empty? %>
   <script type="text/javascript">
      <% flash.each do |f| %>
    <% type = f[0].to_s.gsub('alert', 'error').gsub('notice', 'info') %>
   	 toastr['<%= type %>']('<%= f[1] %>');
   <% end %>
   </script>
<% end %>
```

customizing the flash:
```
<% unless flash.empty? %>
  <script type="text/javascript">
    <% flash.each do |f| %>
        <% type = f[0].to_s.gsub('alert', 'error').gsub('notice', 'info') %>
        toastr['<%= type %>']('<%= f[1] %>', '', {
          "closeButton": true,
          "positionClass": "toast-top-center", 
          "onclick": null, 
          "showDuration": "300", 
          "hideDuration": "1000", 
          "timeOut": "5000", 
          "extendedTimeOut": "1000", 
          "showEasing": "swing", 
          "hideEasing": "linear", 
          "showMethod": "fadeIn", 
          "progressBar": true,
          "hideMethod": "fadeOut" });
    <% end %>
  </script>
<% end %>
```

Footnote: `require("stylesheets/application.scss")` = `import "../stylesheets/application"`

## Final result:

![flash-message-example](https://blog.corsego.com/assets/2020-12-29-flash-messages-with-toastr-js/flash-message-example.png)
One-stop shop for working with semantic versions in your GitHub Actions workflows
Tags: showdev, github, actionshackathon
Published: 2021-03-30 08:21:56

GitHub Actions are so cool!

Check out [our recording](https://youtu.be/-sr9_AItFQQ) about them @ [Ministry of Testing Abu Dhabi](https://www.youtube.com/channel/UCFMIGfAAUXUqnnNcWpdezJQ) if you want a quick sneak peek, but today I want to self-advertise one of the reusable Actions I made for you. And it wasn’t hard at all, thanks to the way they work.

You have heard about [Semantic Versioning](https://semver.org), haven’t you? If you are a developer you probably know a lot of libraries using Semantic Versioning. Chances are, you even use it for your projects.

Sometimes during CI/CD in such projects, you need to take simple actions with versions: compare and parse them. E.g. you may want to check that a PR to the `main` branch increases the version (`$new_version` &gt; `$old_version`) or you may want to create or update a `v$major.$minor` / `v$major` tag whenever you release your project.

This is what [`madhead/semver-utils`](https://github.com/madhead/semver-utils) is for! Just drop it into your workflow and use it for various operations with versions:

``` yml
- uses: madhead/semver-utils@latest
  id: version
  with:
    # A version to work with
    version: 1.2.3+42.24

    # A version to compare against
    compare-to: 2.1.0

    # A range to check agains
    satisfies: 1.x
- run: |
    echo "${{ steps.version.outputs.major }}"             # 1
    echo "${{ steps.version.outputs.minor }}"             # 2
    echo "${{ steps.version.outputs.patch }}"             # 3
    echo "${{ steps.version.outputs.build }}"             # 42.24
    echo "${{ steps.version.outputs.build-parts }}"       # 2
    echo "${{ steps.version.outputs.build-0 }}"           # 42
    echo "${{ steps.version.outputs.build-1 }}"           # 24
    echo "${{ steps.version.outputs.comparison-result }}" # <
    echo "${{ steps.version.outputs.satisfies }}"         # true
    echo "${{ steps.version.outputs.inc-major }}"         # 2.0.0
    echo "${{ steps.version.outputs.inc-premajor }}"      # 2.0.0-0
    echo "${{ steps.version.outputs.inc-minor }}"         # 1.3.0
    echo "${{ steps.version.outputs.inc-preminor }}"      # 1.3.0-0
    echo "${{ steps.version.outputs.inc-patch }}"         # 1.2.4
    echo "${{ steps.version.outputs.inc-prepatch }}"      # 1.2.4-0
    echo "${{ steps.version.outputs.inc-prerelease }}"    # 1.2.4-0
```

Yeah, it's basically a wapper around [semver package](https://www.npmjs.com/package/semver), so the outputs may look familiar to you. But if you need more in your workflows — feel free to [open an issue](https://github.com/madhead/semver-utils/issues/new) with a feature you’re missing.

I want this action to become a one-stop shop for working with semantic versions in your GitHub Actions workflows one day!
Stuff I use daily to make me more productive
Tags: productivity
Published: 2021-03-30 07:57:17

This will be a strange article. I want to describe the stuff I use (software or hardware) that makes me productive and my life easier. This will not be a list of IDEs, libraries, etc... This will be a strange compilation of useful things that made me happy. And happy people are productive people. 

## Jabra headset

[Amazon](https://www.amazon.co.uk/Jabra-Evolve-Wireless-Bluetooth-headset-Black/dp/B00ODRSODQ)

I used quite a few headphones, microphones, etc.. set up to do my meetings. This one is the best for me. It's comfortable to wear, it can be connected to my Mac and phone at the same time, so that I can answer phone calls, do meetings, listen to music, etc.. with just one device. The audio quality is really good. The best thing is that the Bluetooth range is pretty far, so I can go through almost the whole house, without worrying about the range. It's not super cheap, but I would recommend buying it. 

## Moleskine notebook 

[Amazon](https://www.amazon.co.uk/Moleskine-Classic-Squared-Notebook-Elastic/dp/8883701135/ref=sr_1_4?crid=3B6FSC86KAWRT&dchild=1&keywords=moleskine+notebook+squared&qid=1617009113&s=officeproduct&sprefix=moleskine+notebook+sq%2Coffice-products%2C218&sr=1-4)

I am a pen and paper guy. I am not able to write my notes, TODOs, etc.. into any app. I find most apps annoying and hard to customize. With pen and paper, you can do almost anything. As my main notebook, I choose a large Moleskine notebook with squares. Why squares? you can easily draw UI sketches, etc.. with squares. I usually have one per year. 

## Nice keyboard

[Keychron.com](https://www.keychron.com/products/keychron-k3-wireless-mechanical-keyboard?utm_source=navi%20to%20K3&utm_medium=navi%20bar&utm_campaign=navi%20to%20K3)

whatever you do invest into a proper keyboard. I prefer mechanical ones. My keyboard of choice now is Keychron K3. It's ultra-slim tenkeyless, very nice to type. 

## Kindle

[Amazon](https://www.amazon.co.uk/kindle-now-with-a-built-in-front-light%E2%80%94with-special-offers%E2%80%94black/dp/B07FQ4DJ7X/ref=sr_1_3?crid=1ZJVGT71PN4OG&dchild=1&keywords=amazon+kindle+paperwhite&qid=1617009667&sprefix=kindle+paper%2Coffice-products%2C230&sr=8-3)

I love reading. It can be books, long articles, etc... I use Kindle for all of that. I just send everything there. Whenever I have few minutes I pick it up and read. This is how I stay current on all the technologies.

## HEY

[HEY](https://hey.com/)

I switched to Hey from Gmail whenever I got my invite. I never looked back. It's so much better. Have a look.

## Mindly

[Mindly](https://www.mindlyapp.com/)

I do not like apps for note-taking or TODOs, but for mind maps I much prefer Mindly. It's super easy to use, looks gorgeous and it's free (for a limited number of objects). You can hardly find a better app for mind maps. 

---

This is just a shortlist that helps me be productive every day. What helps you? You can always reach me on my [Twitter](https://twitter.com/pavel_polivka) to discuss.
A Progressive Web App(PWA)
Published: 2021-03-30 08:02:16

A progressive web app or a PWA is an idea for a new trending philosophy in the development world. Building websites as PWAs instead of following the traditional path has certain qualities to it.

In short, a PWA is a web application that camouflages itself as a native mobile application with a home screen app icon, responsive design, fast load speed, and offline functionality.

![photo from pexels](https://images.pexels.com/photos/6633921/pexels-photo-6633921.jpeg?auto=compress&cs=tinysrgb&dpr=2&w=500)

Let's look into it.

What makes a PWA?

A PWA has to be:
Responsive for mobile.
You could access it offline
Have a native app kind of interaction to it.
Fresh.
Https for safety.
Solid SEO.
People would find it easy to engage for a second time.
It has to be installable on a device.
It has to be linkable.

The code structure remains unchanged which means you could develop a simple app like you're used to. However, you need to include two files in your directory for it to qualify as a PWA:

1. A web app manifest
A web app manifest is a JSON file that provides the browser with information about your web app so you could save it on your home screen. There you reference an image in your image directory folder that would appear nice and tidily on your mobile home screen.

2. A service worker
A service worker provides support for an offline experience for your site and makes your site more resilient to bad network connections. It’s ultimately a piece of code that runs in the background separately. That's it.
So basically, instead of a user downloading a native app from the app store, he could access it through the web.
If you want, you can put your PWAs on the Apple store or on the Google play store for people to download and install on their devices.

That's the power of progressive web apps.
colabToolKit
Tags: webdev, tutorial, beginners, colab
Published: 2021-03-30 07:51:27

[![open in colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/DIp15739/colabToolKit/blob/main/colabToolKit.ipynb)

### Features

1.  **Mount & Umount Drive**
2.  **Transfer Tools** 
    -   Mega 
    -   Rclone
3.  **Torrent Clients**  
    -   SimpleTorrent
    -   Peerflix-Server
    -   Deluge
    -   qBittorrent
    -   µTorrent
    -   rTorrent
    -   Transmission-Web-Control
    -   Vuze
4.  **Other useful Tools**
    -   Jellyfin
    -   V2Ray
    -   pyLoad
    -   spotify-downloader
    -   aria2Rpc
    -   aria2Cli
    -   zip-tar-rar
    -   jDownloader
    -   Youtube-DL
5.  **Sys Tools**
    -   Wetty
    -   Glances
    -   NoMachine
    -   \_[' > ssh ']
    -   noVNC
    -   IceWM
    -   netData
6.  **File Manager**
    -   ghfs
    -   filebrowser
    -   cloudCommander
7.  **Programming**
    -   code-server (VScode) 
    -   Flutter 
    -   Kivy
8.  **Pentester**
    -   SocialFish
    -   L3Mon
    -   SayCheese
    -   Hashct

<a href="https://github.com/DIp15739/colabToolKit"><img src="https://github-link-card.s3.ap-northeast-1.amazonaws.com/DIp15739/colabToolKit.png" width="460px"></a>

> For New Updates Star or Fork repo
Sikuli Based Image Automation
Tags: tutorial, testing, programming, beginners
Published: 2021-03-30 07:48:24

Sometimes Salenium is not the answer to your automation needs, we need to rely on image based automation. Thus Sikuli gives you easy way of doing automation based on image. Uipath is also competing in same area with a cost associated with it.

I created below Tutorial to give how easy it is to create automation base.

{% youtube zwyJbRJ5UZM %}
Finally - How to understand math - Awesome resource list 🚀
Tags: productivity, webdev, beginners, javascript
Published: 2021-03-30 07:46:05

`Hello World` Here is the list of ... 1, 2, 3...

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bnj6eenc5d7jlvo8odbx.png)

Yes, 6 useful resources for you to learn math!

🔖 - Bookmark the article to save it *and* **remember the like ❤️ and maybe super like🦄**

You absolutely need to read that:
{% link https://dev.to/devlorenzo/200-js-resources-to-master-programming-3aj6 %}

Hey, remember to follow us!

## 1) [Khan academy](https://www.khanacademy.org/math)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5yts2ewgvlqvqm528m0p.png)

The most complete course path you can find online, from kindergarten to differential algebra.

---

## 2) [The EDx Math courses](https://www.edx.org/course/subject/math)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i0k40tvy9nfwon3bi0as.png)

Not really a course path, but a list of tons of useful courses in all the application fields about math. 

---

## 3) [IXL Math Courses](https://www.ixl.com/math/)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hloj3dtllg16chs791dc.png)

Work in grades and skills. You have a list of exercises for each skill. 

---

## 4) [I practice Math](https://www.ipracticemath.com/learn)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/acm0bkmtrimv0dqey7q8.png)
 
Courses organized in grade and then in subjects. More focused on exercises. 

---

## 5) [School Yourself](https://schoolyourself.org/)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/03znsolyr1fmsolf8ty8.png)

Lots of lessons (videos) based on subjects.

---

## 6) [Essentials of Linear Algebra - Youtube](https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab)

An incredible animated series about linear algebra, you will understand all the basics of algebra, in no time!

---

I hope they will help you improve, but if math makes you like that every time...

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/afaqsil6k58jtuo6oqen.png)
 
Just give up, and focus on programming!

---

Join us on [Discord](https://discord.gg/aWS2YKk6) to participate in hackathons with us / participate in our giveaways (we are offering a free Udemy course at 200 members)!

---

## **[Subscribe to my Newsletter!](https://chipper-motivator-3112.ck.page/05710ea3d3)**
A loooong, and fun, weekly recap for you 
Free PDF version of my articles
Highly customizable inbox
That's --> free <-- and you help me!

---

Thanks for reading!

Remember the like ❤️
How long to crack that password ?
Tags: security, cybersecurity
Published: 2021-03-30 07:38:26

Password is one of your best lines of defense against attackers, but they can crack it from you very, very quickly. 💨

{% youtube KIVno9B8xDI %}

---

But how quickly a hacker will be able to crack it. 🔓
The answer is, it'll be pretty quick if I don't use lots of upper case, lower case, numbers and special characters. ㊙️
We watch it together in the video. 📺

This will allow you to set the correct level of complexity for your own passwords.
You will see the gap is not huge to go from a password that cracks instantly to a password that takes several tens (hundreds) of years to be cracked.

---

*If you like this content, push the like button, that helps spread the message.* 👍🏼
*If you think it can be useful to anyone in your network, share it.* 📨

---

Video produced by [Wild & Secure](https://wildnsecure.com), your consulting firm to all things security and real estate.
If you want to receive weekly quality content about security, subscribe to our newsletter on our website. [https://wildnsecure.com](https://wildnsecure.com/contact)
How to do maintenance on a live website (Laravel 8)
Tags: laravel, php, webdev
Published: 2021-03-30 07:25:04

Maintenance injects fresh blood into the application.

After deploying your application to production it needs to be maintained. So Laravel makes it easy for you.
To active maintenance mode, you just need to run this command
```
php artisan down
```
This will disable your application and show a 503 error page for the user.

By adding a secret key while you enable maintenance mode you can access the application even it’s in maintenance mode
```
php artisan down --secret="123456789"
```
```
https://yourDomain.com/123456789 
```
What if you want to redirect all requests to a specific route? for doing that just add the flag of redirect while you enable maintenance mode.
```
php artisan down --redirect=/about
```
And finally after completing the maintenance run this command to disable maintenance mode & let the user enjoy using your application.
```
php artisan up
```

For digging deeper visit: Laravel Maintenance Mode
Techgig CodeGladiators 2021 is live now, Participate and prove your skills
Published: 2021-03-30 07:21:49

### [Participate from this referral link](https://tinyurl.com/yjxmpuc8)


As per Techgig's site:

> Code Gladiators is an annual coding competition by TechGig, that draws the best and the brightest coding talent from all parts of India. With multiple contests in emerging technologies and the coveted title of Code Gladiators up for grabs, the competition sees enthusiastic participation and has grown from strength to strength with each passing year.

![Screenshot of site](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j0p6782h5xdp01nexcet.png)
Django Debug Toolbar, not showing/appearing, Fix it & Bring it Back.
Tags: django, debugtoolbar, python, webdev
Published: 2021-03-30 07:17:55

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/terxu6bd9rddgkj6jo4u.png)
---
***Are you facing the problem with Django Debug Toolbar showing up?***
I faced too…
Here I will show you how I fixed it….

Install Debug Toolbar…
For virtual env: `pip install django-debug-toolbar`
For Pipenv: `pipenv install django-debug-toolbar`

######Link: https://pypi.org/project/django-debug-toolbar/
######Docs: https://django-debug-toolbar.readthedocs.io/en/latest/

Go to `settings.py` and add to `INSTALLED_APPS`
```python
INSTALLED_APPS = [
 # …
 'django.contrib.staticfiles',
 # … not for debug mode
 'debug_toolbar',
]
STATIC_URL = '/static/'
```
---
The Debug Toolbar should have appeared only in Debug mode. So, the rest of the settings will be for `DEBUG` mode only.
```python
# debug_toolbar moved here. 
if DEBUG:
    MIDDLEWARE += [
        'debug_toolbar.middleware.DebugToolbarMiddleware',
    ]
    INSTALLED_APPS += [
        'debug_toolbar',
    ]
    INTERNAL_IPS = ['127.0.0.1', ]

    # this is the main reason for not showing up the toolbar
    import mimetypes
    mimetypes.add_type("application/javascript", ".js", True)

    DEBUG_TOOLBAR_CONFIG = {
        'INTERCEPT_REDIRECTS': False,
    }
```
---
Update your `{project}/urls.py` file.
```python
from django.conf import settings
from django.urls import path, include
urlpatterns = [
  path("admin/", admin.site.urls),
]
# add debug toolbar in urlpatterns
if settings.DEBUG:
    import debug_toolbar
    urlpatterns += [
        path('__debug__/', include(debug_toolbar.urls)),
    ]
```
---
The main reason for not showing up the toolbar is because of the javascript mime-types error when you connect the `debug_toolbar`
If the already added to your application then just add two lines of code in your `settings.py` file.
```python
import mimetypes
mimetypes.add_type("application/javascript", ".js", True)
```
---
Now the debug toolbar should be visible in Debug mode.
#### Medium Link: [Django Debug Toolbar Fix](https://imtipu.medium.com/django-debug-toolbar-loaded-but-not-showing-appearing-fix-it-and-bring-it-back-7dba91ccecec)
---
If you need any help with Full-Stack Development with Django and Shopify, feel free to contact me anytime.
Visit: [imtipu.me](https://imtipu.me)
Contact if you need any help with Django and Shopify
Thanks!
Day 16 of 100 Days of Swift UI
Tags: swift, swiftui, 100daysofcode
Published: 2021-03-30 06:58:35

I just completed day 15 of 100 days of SwiftUi. Today I started learning SwiftUI. I learnt more about the @State property and two bindings. 

State in computer programming is a set of values that describes an application at a particular point in time.
In SwiftUI `@State` is used to describe the state of our app. The `@State` property also allows us to modify the value of our state. Anytime a `@state` property is modified, the views are destroyed and created again to match the current state of the app. 
For instance, the `@state` property can be used like so.
```
struct ContentView: View {
   @State private var tapCount = 0
    
    var body: some View {
        Button("Tap count \(tapCount)") {
            tapCount += 1
        }
    }
}
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/naymhd4neayz5y7i6ty7.png)
The code creates a simple button. The button view takes a closure that increases the tap count state property anytime the button is tapped. Anytime the `tapCount` property changes the button is redrawn on the screen to reflect the new state of the `tapCount` property.

Two-way binding is used when we want to bind our state properties to views. It's called a two binding because the views can read the value from the state and also update the value of the state.
For instance, the two way binding in SwiftUI can be done like this.
```
struct ContentView: View {
   @State private var name = ""
    
    var body: some View {
        Form {
            TextField("Enter your name", text: $name )
            Text("\(name)")
        }
    }
}
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/elr410j7ac3tihn8qinp.png)

The code above creates a simple form with one state `name`. The form contains one `TextField` and one `Text`. We bind the `name` state property to the `TextField`. That means anytime a user types into the `Textfield` the `name` state will be updated and the `Text` will also be redrawn to reflect those changes.

If you are interested in taking the challenge, you can find it at https://www.hackingwithswift.com/100/swiftui
See you tomorrow ;)