teleren/devto huggingface dataset:
Peter Salzano - Great Advice about How to Accomplish Fitness Goals
Tags: health, fitness
Published: 2020-09-07 09:57:03

---
title: Peter Salzano - Great Advice about How to Accomplish Fitness Goals
published: True
tags: health, fitness
canonical_url: 
---

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

Physical fitness is an essential element of good health at every phase of life. Regardless of your age, it is essential that you have a normal fitness routine to help keep you as healthy as feasible. See what ideas are provided by Peter J Salzano here can aid you on the journey to boosting your physical fitness degree.

If you intend out and stick to a day-to-day regimen, you can raise the probability that you accomplish your health and fitness goals. By doing the exact same points at the same time, you will certainly come under a pattern that is more difficult to break than it is to maintain. By doing this your health and fitness regimen will certainly become acquired behavior.

Buy a body band. Buying a body band can be an excellent financial investment for your normal exercise routine. Body bands are easy to find in stores as well as affordable. You can utilize them in a lot of the workouts you already do. They add resistance to what you are currently doing, permitting you to obtain more out of your exercise.

As per Peter; if you're trying to enter far better shape, don't bother exercising when you have a chilly, the influenza, or one more illness your body requires to eliminate off. Why? Your body has different concerns than you do-- when you're sick, it will certainly attempt to recover your health prior to it will certainly commit any type of sources to muscle-building.

Making workout enjoyable is among the most effective methods to remain fit. Dragging on your own to the fitness center or participating in any other tasks you do not appreciate will certainly prevent you from exercising a lot more. Find something physically requiring that you take pleasure in. Signing up with a regional sporting activities team is a great method to make good friends, enjoy, and stay in shape.

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

These ideas will aid you to identify ways that you can elevate your degree of physical fitness, regardless of where you are starting from. You are particular to locate that your entire overview will transform right as you end up being extra fit. The selection is your own to really feel much better today.

No matter of your age, it is crucial that you have a normal health and fitness regimen to help maintain you as healthy and balanced as possible. See what recommendations are offered here can aid you on the trip to boosting your fitness degree.

You can increase the probability that you accomplish your health and fitness goals if you intend out as well as stick to an everyday routine. These ideas by Peter Salzano will certainly assist you to figure out ways that you can raise your level of physical fitness, regardless of where you are beginning from.
Useful Mac Commands
Tags: mac
Published: 2020-09-07 09:08:08

On finder do `shift+command+G` to type in the path of the folder that you want to go to.

On finder to show hidden files:
`Command+Shift+Dot`

To do a global search on the Mac for a file:
`sudo find / -name filename` e.g. `sudo find / -name php.ini`
The / makes it search the whole computer. You can change this to a specific directory if you know that the file is within a specific directory.

or to use Spotlight to find file:
`mdfind filename`

Create a file
`touch file` e.g. `touch .zshrc` would create a .zshrc file.

<b>To exit spaces in a URL use backslash</b>
ln -s /Users/stuardcreed/Land\ Stack\ Dropbox/LS\ Stuart/.zshrc .zshrc
Reversed Strings with JavaScript
Tags: javascript, 100daysofcode, codenewbie, beginners
Published: 2020-09-07 08:32:27

{% youtube ThqFIoEtqBo %}

To solve this problem, we’ll take 5 different approaches.
Enjoy the video 😀🙏

Also written version https://losseff.xyz/katas/011-reversed-strings/javascript/
Five Unbelievable Open-Source Object Detection Projects
Published: 2020-09-07 08:29:08

###Very interesting open-source object detection projects to learn from them.

[Five Unbelievable Open-Source Object Detection Projects](https://medium.com%2F@medium.com/@waliamrinal/five-unbelievable-open-source-object-detection-projects-e851f4c89654)

[#machinelearning #ai #datascience #deeplearning #artificialintelligence #computervision #python #programming #learning #scikitlearn]
Using JavaScript to determine whether the client is iOS or Android
Tags: javascript
Published: 2020-09-07 08:23:22

---
title: Using JavaScript to determine whether the client is iOS or Android
published: true
description: 
tags: javascript
//cover_image: https://direct_url_to_image.jpg
---

# Introduction.

Contents of this function

* Use ES2015 arrow functions.
* When a web page is displayed in a browser, the OS of the access source is determined based on the user agent.
* Reflects iOS, Android and other operating systems using regular expressions

User agents for each OS are available at [here](https://developers.whatismybrowser.com/useragents/explore/
).

The iPad is now iPadOS instead of iOS from 13, and if you're set to display a website for a PC, it won't include the iPad in the UserAgent, so you'll have to make a tricky decision.
ref: https://stackoverflow.com/a/57924983/4480860


```js
const getMobileOS = () => {
  const ua = navigator.userAgent
  if (/android/i.test(ua)) {
    return "Android"
  }
  else if (/iPad|iPhone|iPod/.test(ua))
     || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1){
    return "iOS"
  }
  return "Other"
}
```

## Usage

```js
const os = getMobileOS()
# console.log(os) => 'Android'
# console.log(os) => 'iOS'
# console.log(os) => 'Other'
```


# Explanation of supplementary regular expressions

An example of `/android/i.test(ua)` used in the described functions

* `/android/` is the body of the regular expression
* The "i" in `/android/i` is a regular expression flag and does not detect case.
  * It will be compatible with Android, ANDROID and aNdRoId.
  * The `/android/i` checks if any part of the string to be validated contains "android" regardless of the case of the string.
* The test method of `/android/i.test(ua)` returns `true/false` whether the string contained in the argument `ua` hits the regular expression of `/android/i` or not.
Mocking the system clock with Jest
Published: 2020-09-07 08:20:37

Mocking the system clock is extremely important when you are dealing with testing. It's important so you can deal with time-based tests -  say a test that deals with ensuring that a certain feature is only available during working hours for, instance.
Let's have a look at an even simpler use case. You want a function that tells you if a date is in the future.

```js
function isInTheFuture(date) {
  return new Date().getTime() - date.getTime() < 0
}
```
A very simple way to deal with this unit test would be to test it with a date long passed, or far away in the future. This way the test will be green (for the next 30 years at least).
```js
it('returns true when the date is in the future', () => {
  const date = new Date('2050-01-01')
  expect(isInTheFuture(date)).toBe(true)
})
```
Another way to do this is to extract the current date as an argument to your function so you can actually test it:
```js
function isInTheFuture(currentDate, dateToTest) {
  return currentDate.getTime() - dateToTest.getTime() < 0
}

it('compares two dates', () => {
  const currentDate = new Date('2019-01-01')
  const dateInTheFuture = new Date('2020-01-01')
  expect(isInTheFuture(currentDate, dateInTheFuture)).toBe(true)
})
```
This way, it is very easy to unit test, but it is not as easy to understand or maintain.

Another "common" way of doing this would be to manually monkey patch the date object. But that's error-prone, and it's better to leave that responsibility to someone else.
Fortunately, in version 26, Jest introduced a new and more powerful time mock. They enabled the usage of [@sinonjs/fake-timers](https://github.com/sinonjs/fake-timers), even though, for now, the feature is still a bit hidden.
To use the new mock system, you need to pass the "modern" argument to the jest.useFakeTimers function. This system will allow you not only to mock timers as you already could but also to mock the system clock.

Give the first implementation, you would be able to write tests that looks like this:
```js
describe('Time based test with mock', () => {
  beforeAll(() => {
    jest.useFakeTimers('modern')
    jest.setSystemTime(new Date('2017-01-01'))
  })
  afterAll(() => {
    jest.useRealTimers()
  })

  it('returns true when the date is in the future', () => {
    const date = new Date('2019-01-01')
    expect(isInTheFuture(date)).toBe(true)
  })
})
```
This way, the test will be green, but will also be stable in time. [This new mock system will become the default in Jest 27](https://jestjs.io/docs/en/jest-object#jestusefaketimersimplementation-modern--legacy). Until then, we'll have to add that extra parameter to the useFakeTimers call.
Using Lando with Drupal 9
Tags: drupal, lando, stalessdrupal, statelesswebsite
Published: 2020-09-07 08:01:18

[![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p1ckk8b282nuz10791yv.png)](https://www.buymeacoffee.com/Esnare)
After years of working with MAMP, I decided to move my development stack to Docker and Docker Compose. I did it mainly out of curiosity as many of my colleagues were getting very excited with it.

And there I went, I started to dive deep into Docker compose, I learnt how to create my own docker files, use Dockerhub and started to master the syntax from Docker Compose. Nevertheless, it seemed to me that I had to do so much boiler to spin up a workable Drupal site.

One day, while browsing on the web, I found Lando!

Lando, - as they put it from their website - _it's a free and open-source local development environment built on Docker container technology_. Just by running on command: **lando start**, you are able to run a fully LAMP-based infrastructure regardless of what OS you're using. 

```bash
$ lando start
```

Lando is not only for Drupal but it also gives you a pool of frameworks to choose from. Very effortless, you are able to run Drupal, Laravel, WordPress and many more. 

## Installation
Just head out to their installation page, they couldn't make it easier:
https://docs.lando.dev/basics/installation.html

## Drupal 9 Configuiration
After installing Lando locally, you can run **lando init**, that command will help you to configure your site step by step.
```bash
$ lando init
```

At the end of the process, you should end up having a **.lando.yml** file, similar to the one below:

```yml
#.lando.yml
name: my-project
recipe: drupal9
config:
  webroot: web
  php: "7.4"
```
> You can achieve the same by copying and pasting the code above into a **.lando.yml** file inside of your root directory and then just run **lando start**

## Running Drush
You can run Drush commands by prefixing lando at the beginning of the command, such as **lando drush command**
```bash
#Example
$ lando drush cr
```

You won't have to worry about the Drush configuration anymore, Lando will take care that you are using the right PHP version and the right Drush version for your Drupal site.


## More info about lando
Here are some interesting links about Lando:
[Debugging Drupal 9 with Xdebug and (VSCode || PHPStorm)](https://dev.to/esnaremaussa/debugging-drupal-9-with-xdebug-and-vscode-phpstorm-5ch6)

[Lando Overview](https://docs.lando.dev/guides/lando-101/lando-overview.html)

[Lando Drupal9 recipe](https://docs.lando.dev/config/drupal9.html)

[Tooling with Lando](https://docs.lando.dev/config/tooling.html#getting-started)
Introducing simpleQL - my simple and easy to use graphQL clone made for fun!
Tags: graphql, webdev, pokemon
Published: 2020-09-07 07:45:37

```
curl -X POST https://krgamestudios.com/pokemon
    -H "Content-Type: text/plain"
    -d "Pokemon { name }"
```

https://github.com/ratstail91/simpleql

Allow me to present, a working (though incomplete) implementation of simpleQL!

The `curl` command above will send back an array of pokemon names as demonstration. In fact, each of the following fields are possible:

```
Pokemon {
    name
    height
    weight
    stats {
        hp
        attack
        defense
        specialAttack
        specialDefense
        speed
    }
    forms {
        name
        height
        weight
        stats {
            hp
            attack
            defense
            specialAttack
            specialDefense
            speed
        }
    }
}
```

Too much for you? That's fine, just use the `match` keyword!

```
Pokemon {
    match name "charizard"
    forms {
        name
        height
        weight
    }
}
```

How about matching compound sub-types?

```
Pokemon {
    name
    match forms {
        match name "charizard-mega-x"
    }
}
```

There are a few rules: every query must start by searching for a specific type, in this case `Pokemon`. Also, when listing a sub-type, at least one field must be listed.

Finally, for anyone implementing a handler - everything must return an array of objects - this may change in the future, but I'm still working on this.

I hope you like what I've done, and find it way easier to implement server-side than graphQL. Any questions, comments or critiques are welcome, particularly through the github issues page.

P.S. Yes, I know the name is taken, I'll be replacing it eventually.
Deleting Git Branches Locally And Remotely
Tags: github, git, branches
Published: 2020-09-07 07:43:50

When working with Git, we can create branches to work on new features and keep the code separate from the rest of the project.

It is common to have a "main" master branch, and once we are happy with the changes made on the branch, we can then merge them in with the master.

If the branch code does not work out and we want to remove it, or, after merging we can delete the branch. Let's begin by removing the branch locally.

To delete a branch locally the first thing to do is to make sure we are not currently working on it. We can change branches, i.e back to the master like this:

   ```gitattributes
   git checkout master
   ```
Then to delete the branch, we have 2 options, depending if you have pushed and merged with the remote branch:

   ```gitattributes
   // -d (delete) to remove only if you have pushed and merged
   // it with your remote branch
   git branch -d branch_name

   // -D (delete/force) to remove even if you have not pushed and merged
   // it with your remote branch
   git branch -D branch_name
   ```
We have now successfully removed our local branch. We now need to remove it remotely too using the following command:

   ```gitattributes
   git push <remote> --delete <branch_name>

   // which looks something like this with your variables:
   git push origin --delete new_checkout_flow
   ```
Enter your password, and all done! You can check GitHub and the branch should now be removed.
Build a Section List with Tab Bar and Parallax Header
Tags: react, reactnative, typescript
Published: 2020-09-07 07:29:00

Hi guys,

I finally create a Github repo to show how we can create an RN Section List with Tab Bar and Parallax Header here: https://github.com/nphivu414/react-native-section-list-tab-bar
![RN Section List](https://dev-to-uploads.s3.amazonaws.com/i/osb36lpyl71lsdmjsmmt.gif)

At first, I try to use this lib: https://github.com/bogoslavskiy/react-native-tabs-section-list, unfortunately, it's not good enough for what I want to achieve and it also seems like nobody will ever work on it. So I decide to create my own thing based on it, hope it can help you guys who want to do the same thing.

I also use it for my first React Native Template published on CodeCanyon, you can give it a try here:
https://codecanyon.net/item/food-star-react-native-food-delivery-template/28398069

Hit me with any comments or feedback. It is highly appreciated.
Dracula Theme
Tags: dracula, theme, vscode, customization
Published: 2020-09-07 07:28:23

I´m really a Fan of the Dracula Theme on Visual Studio Code and other editors or coding relevant tools. Than i found this side: https://draculatheme.com/. 

You can find for most of the Tools where you use for coding the dracula theme. If you are a Fan of this theme, check it out.
Using rust jni to call an external rust library in java
Tags: java, rust
Published: 2020-09-07 07:26:11

---
title: Using rust jni to call an external rust library in java
published: true
description: In this video we setup rust jni to call a rust function from java using jni. Java native interface is a great way to enable quick calls to native code built in other languages like Rust. This approach can be used for other languages as well.
tags: java, rust
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/3az749n3kav3n6z9szyn.jpg
---

{% youtube VIZK14pnGcw %}

In this video we setup rust jni to call a rust function from java using jni. Java native interface is a great way to enable quick calls to native code built in other languages like Rust. This approach can be used for other languages as well.
Small PowerShell Absenteeism rate calculator
Tags: powershell, coding, beginners, terminal
Published: 2020-09-07 07:15:00

I wrote a small Absenteeism rate calculator in PowerShell. I guess it can be useful, if you want calculate your absenteeism rate.

https://github.com/kaeptnkrunch/fehlzeitquote/releases/tag/0.2
Shortcuts in Google Apps
Tags: tricks, tips, search
Published: 2020-09-07 07:04:04

Below are some shortcuts in Google Apps :

sheets.new, sheet.new, spreadsheet.new - Opens an Untitled Google sheet
docs.new, doc.new, document.new - Opens Untitled Document in Google Document
cal.new, meeting.new - Opens Add/Edit Event in Google Calendar
slides.new, presentation.new - Opens an Untitled Google Slides
sites.new, site.new, website.new - Opens an Untitled Google Site
Useful Bulma CSS Tip
Published: 2020-09-07 07:01:15

I've been a big fan of Bulma ever since I first discovered it a few years ago. [Bulma](https://bulma.io) is a free, open source CSS framework based on Flexbox, created by Jeremy Thomas.

## I love simplicity

I love the fact that Bulma is purely CSS and no javascript. [Here's a nice comparison with Bootstrap](https://bulma.io/alternative-to-bootstrap/). The class names and modifiers are all easy to remember and intuitive. (After using it a few times, you'll pick up the naming schemes for the modifiers quickly, and you'll refer to the docs less and less frequently). It is also very easy to customize or overwrite (without the need for `!important`).

## Tip

Here's a simple table using Bulma's table class:
```html
<table class="table is-fullwidth">
    <tr>
      <td>Hall of Fame</td>
    </tr>
    <tr>
      <td>Michael Jordan</td>
    </tr>
    <tr>
      <td>Magic Johnson</td>
    </tr>
    <tr>
      <td>Larry Bird</td>
    </tr>
    <tr>
      <td>Shaq</td>
    </tr>
  </tbody>
</table>
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/96g55dd1uq7wcf32z79r.jpg)

Like most people, I don't enjoy writing HTML tables. It's a lot of markup.

But if you use Bulma's `.panel-block` class, you can achieve the same table-like look with far less markup.

```html
<p class="panel-block">Hall of Fame</p>
<p class="panel-block">Michael Jordan</p>
<p class="panel-block">Magic Johnson</p>
<p class="panel-block">Larry Bird</p>
<p class="panel-block">Shaq</p>
```

Here's the result. (Slightly bigger padding-top and padding-bottom makes it a bit more readable as well.)

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

Thanks for reading. More Bulma "hacks" and tips to come...
The Front End: S2-E3 - Tom Hirst
Tags: career, podcast, frontend
Published: 2020-09-07 06:58:30

Fresh out the sound booth, we're back with a new episode of The Front End. 

For this episode, freelancing legend Tom Hirst shares his journey into self-employment. Tom is based in Yorkshire and he's enjoyed a successful freelancing career for the past 11 years, specialising in WordPress development.

Listen to the brand new episode here:

- Apple Podcasts > https://podcasts.apple.com/gb/podcast/the-front-end/id1499349107
- Pocket casts > https://pca.st/osul2zsa
- Spotify > https://open.spotify.com/show/4GuAxptrtY8Es5iHwp09dT
- Anchor > https://anchor.fm/the-front-end

## In this episode

Tom has been a remote web developer, specialising in WordPress development for over a decade, right from his home in the heart of Yorkshire. 

Tom also runs a mentorship program to help other aspiring freelancers to help get into the freelancing life and start their own successful self-employment careers.

Tom shares his super valuable freelancing tips, tricks and advice right here in episode 3 of season 2.

## Listening direct

Want to listen directly from here?

{% spotify spotify:episode:2mRdBK4ycgB1L7JURqYkoO %}

## Want to be a guest or sponsor the show?

We're always happy to take requests for guests to talk about a range of different development topics from careers to origin stories, learning and professional growth, frameworks and more.

Similarly, we're looking for sponsors to fill promotional slots within the show. 

You can find out more here:

- [Being a guest](https://thefrontendpodcast.site/guests)
- [Sponsorship information](https://thefrontendpodcast.site/sponsorship)

Thanks for listening!
Social Network Script development
Tags: softwaredevelopment
Published: 2020-09-07 06:56:19

Alienweb is known as a social network app development company that has popularity in the app development market. We are an IT firm, providing first-class application solutions to all kinds of business. We develop clone scripts like Facebook, Twitter that helps to connect people and find potential visitors. We offer user-friendly and customized social network scripts and software.
http://alienwebdevelopers.com
What was your biggest 'a-ha' moment in coding?
Tags: discuss
Published: 2020-09-07 06:39:07

We all love (and sometimes hate) coding, but there are times when everything seems against you; nothing's clicking, it doesn't make sense, the docs are useless, and that's sometimes when imposter syndrome hits hardest. 

But then we have those glorious, golden moments, the 'a-ha' moments where things just click and make sense. 

What's your biggest 'a-ha' moment or most recent 'eureka' moment?