teleren/devto huggingface dataset:
Eloquent Javascript 
Tags: 100daysofcode, javascript
Published: 2020-10-04 10:07:31

More on the book. What i learnt today:

#### Closure:
>  being able to reference a specific instance of a local binding in an enclosing scope. A function that references bindings from local scopes around it is called a closure.
 
#### A pure function 
>  a specific kind of value-producing function that not only has no side effects but also doesn’t rely on side effects from other code—for example, it doesn’t read global bindings whose value might change. A pure function has the pleasant property that, when called with the same arguments, it always produces the same value

#### Array Methods
`includes()`  - checks if a given value exists in the array.
`shift()` - removes the first(zero index) item from an array.
`unshift()` - adds a item at the front(zero index) of an array
`indexOf()` -  searches through the array from the start to the end and returns the index at which the requested value was found
`lastIndexOf()` - searches through the array from the end(last item)
` trim ()` -  removes whitespace (spaces, newlines, tabs, and similar characters) from the start and end of a string
`...` Spread Syntax - expands or spreads out an array, passing its elements as separate arguments.

Looping through arrays using `let` item `of` items.
```javascript
for (let item of items) { 
console.log(item); 
}
```
#### Math Object functions
`Math.floor()` -  rounds down
`Math.ceil()` - rounds up
`Math.round()` - rounds to the nearest whole number
`Math.abs()` - takes the absolute value of a number, Negates a  negative.

#### What is JSON?
A serialization format. Serialization means converting to a  a flat description. 
_Json Methods_
`JSON. parse()` Converts a JSON string to a JavaScript object
`JSON. stringify()` Converts a JavaScript object to a JSON string

_That's it for Day 80_
_I'll continue with the book tommorrow_
Puma installation issue due to missing ctype.h on Mac OS X
Tags: puma, osx
Published: 2021-05-28 17:20:55

---
title: Puma installation issue due to missing ctype.h on Mac OS X
published: true
date: 2020-10-04 10:01:39 UTC
tags: puma,osx
canonical_url: https://prathamesh.tech/2020/10/04/puma-installation-issue-due-to-missing-ctype-h/
---

```
puma_http11.c:203:22: note: include the header <ctype.h> or explicitly provide a declaration for 'isspace'
```
<!--kg-card-end: code-->

Are you facing this error recently while trying to install puma gem 4.3.5 on Mac OS X?

This issue is reported on [Puma issue tracker](https://github.com/puma/puma/issues/2304) here and fixed in version 4.3.6 and in the latest 5.0.0 release.

But if you want to fix it without updating the Puma gem version from 4.3.5, you can use run following command to update your Bundler configuration.

<!--kg-card-begin: code-->
```
bundle config build.puma --with-cflags="-Wno-error=implicit-function-declaration"

```
<!--kg-card-end: code-->

`bundle install` will run successfully after this.

Even better is to just update Puma to latest version which also fixes this issue.
WSL2 vs VM (maybe QEmu)
Tags: discuss, windows, linux, virtualization
Published: 2020-10-04 09:44:08

It appears that Windows 10 aren't very kind on the hardware.

![Win10 Usage](https://dev-to-uploads.s3.amazonaws.com/i/0p5cssybzkmh7hnf03as.png)

Also, much is proprietary, including WSL2 itself, including all distro.

I am wondering if I can run Linux inside Linux, with least toll possible? Not sure if VirtualBox is even a good solution.

And yes, I can indeed run Windows inside VirtualBox as well. I preinstall Windows on `*.vdi` making this very easy.
This information is for all developers who intend to Build DApp in Linux with Cartesi - $80k+ in prizes to the best 3 DApps
Tags: devops, css, python, productivity
Published: 2020-10-04 09:40:28

join the Cartesi DApp Incubation Program in partnership with Gitcoin!

Build your DApp in Linux and be one of the three teams to get $80K+ in awards.

What is Cartesi? 

Cartesi allows decentralized applications to run within a Linux environment. Complex processing can be executed off-chain, free from blockchain's computational limits and corresponding fees. Cartesi is the only infrastructure that allows developers to use Linux and mainstream software stacks to build powerful DApps.

Apply now at: https://gitcoin.co/hackathon/cartesi-incubator/onboard (https://gitcoin.co/hackathon/cartesi-incubator/onboard)
How to make Hacktoberfest contributions counted in not opted-in project
Tags: hacktoberfest, opensource, github, tutorial
Published: 2020-10-04 09:35:02

This year, there is a major change in how contributions are counted.

> Unlike in previous years, 2020 Hacktoberfest contributions must be made in projects that have specifically chosen to join the celebration.

> Each PR must be made on [Hacktoberfest-classified repos](https://github.com/topics/hacktoberfest). Your PRs will either need to be merged, approved, or labeled as `hacktoberfest-accepted` in order to add to the total count.

Read more about this change on [note](https://hacktoberfest.digitalocean.com/hacktoberfest-update) from DigitalOcean and [post](https://dev.to/devteam/happy-hacktoberfest-here-s-how-to-show-up-for-open-source-this-month-4cee) from The DEV Team. ❤️

This is bad for people who would like to contribute to their favorite projects which haven't opted-in. You may open random PRs to your own repos but this is still spammy.

{% twitter 1312608446492168193 %}

There is a solution better than that.

# Solution
Note: This is an example pull request. You **must** make a contribution that is **meaningful and follows [PR etiquette](https://dev.to/devteam/hacktoberfest-etiquette-for-contributors-ec6)**.

Update (2020/10/05 15:00 UTC): No longer need the first step.

1. ~~Tag your **fork** repository with `hacktoberfest`.~~
![hacktoberfest eligible fork](https://dev-to-uploads.s3.amazonaws.com/i/tbpxlthlwyiiqu20cg0p.gif)
1. Beside create a pull request back to the origin repository, create a pull request to the default branch inside the fork repository.
![create a pull request in fork](https://dev-to-uploads.s3.amazonaws.com/i/ysovvo4wojz61kqmg559.gif)
1. Label that pull request with `hacktoberfest-accepted`.
 
Now that pull request in fork will be counted toward completing the Hacktoberfest challenge! 🎉

![counted pull request](https://dev-to-uploads.s3.amazonaws.com/i/3nqnunfe44y4kfvms806.PNG) 

For more tips like this one, you can follow me on [Twitter](https://twitter.com/ThewDhanat) or [buy me a coffee](https://www.buymeacoffee.com/thew).
Animation Using Transform
Tags: codepen, html, css, webdev
Published: 2020-10-04 09:11:36

{% codepen https://codepen.io/wkazisan/pen/vYGOOga %}

Hello Folk!
See my animation made by HTML5 & CSS3.
Copy From w3schools and host on codepen.
Comment if you like!
Happy Learning web developers.
Happy web development.
Getting rid of specific git commits
Tags: git, commit, rebase
Published: 2020-10-04 09:09:29

---
title: Getting rid of specific git commits
published: true
description: Removing specific commits from a working branch
tags: git, commit, rebase
---



There are two possible reasons (that I can think of) you might want to revert a commit or specific commits:

Scenario A: When working on a feature branch and you later realize a specific change is no longer relevant and you want to remove such commit/change.

Scenario B: When you pushed a working branch to remote, just about to a create a pull request, you compared your branch and realize you have commits that are not related to your work, probably due to the local repository being out of sync.

How to fix ?

In the case of Scenario A; we can execute the following:
```python
git revert <commit-hash>
```
where `<commit-hash>` is the targeted commit hash, done.

Hint, we can list all commits together with their hash by executing

```python
git log --oneline
```

Scenario B: where we need to remove multiple commits/changes from our branch, we can rebase interactively with a target base branch by executing

```python
git rebase -i <target-branch>
```
This will result into an opened editor listing all the commits in the current working branch. 

Hint, rebase entails taking the current changes and stacking it on top of another branch, hence we can selectively pick the commits desired and reject others.

With the editor opened, we can go ahead and remove specific commits as desired by simply deleting their records in the opened editor. There are instructions as to applicable commands in the editor. 

The opened editor with commands, should look like this:

```python
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit
```

On completing the exercise and closing the editor, the rebase will work its way automatically.

That is it. Fun coding!
Looking for Feedback - Personal Portfolio
Tags: html, css, javascript, webdev
Published: 2020-10-04 09:05:08

Hey, Dev Community! 

All of you are awesome developers, and I must take advantage of that to ask, humbly, that you review my [portfolio page](https://anirudhrowjee.xyz). Please feel free to go all-out with your feedback - I want to know what you like, and especially what you don't like. 

Thank you for your time!
Ansible for Beginner - Step by Step Full Guide
Published: 2020-10-04 08:48:32

## Overview
Hello and welcome to this Course on Ansible for Beginners. My name is Hitesh Jethva and I am a technical writer, author, and Solution Architect. I have been using Ansible for Automation in my solutions and it is a great tool that is easy and can save your lot of time. This is a hands-on beginner guide to Ansible.

When I start learning with Ansible first of all I could find was the Ansible documentation which we will look through and I had to have access to a system with Ansible installed on it to do and understand various concepts.

Some of the concepts took a little bit of time for me to get around so I put together this course for the absolute beginner. You really don’t need to have access to a system with Ansible or any environment setup to learn Ansible.

Well! It is always good to have and would strongly recommend to set up a real system to put your knowledge into action.

So how exactly does this course work? This course contents lectures on various topics followed by some coding exercises where you will practice writing Ansible playbooks. You will be developing Ansible playbooks for different use cases which will give you an idea on how to start developing using Ansible and get a lot of things done in a short amount of time and make your work more productive.

## What Should I know?
This course is designed for beginners to help them understand the basics of Ansible. Basic knowledge on Linux, Networking, Command-line will be an additional help. Before you start doing practice with several examples given in this course, it is being assumed that you have hands-on experience with running commands into a Linux shell. This will help you the Ansible tasks in a better way.

## Prerequisites
* Three fresh servers with CentOS 7/ 8 operating system installed. 
* One for Ansible Controler and two for Ansible Target.
* A root password is set up on all servers.

## Course Contents
* [Introduction](https://linuxbuz.com/linuxhowto/what-is-ansible-and-how-it-works)
* [Lab Setup – Install Ansible](https://linuxbuz.com/linuxhowto/ansible-setup-and-installation)
* [Ansible Inventory](https://linuxbuz.com/linuxhowto/what-is-ansible-inventory-and-how-it-works)
* [Introduction to YAML](https://linuxbuz.com/linuxhowto/what-is-yaml-in-ansible-and-how-it-works)
* [Ansible Playbooks](https://linuxbuz.com/linuxhowto/what-is-ansible-playbook-and-how-it-works)
* [Ansible Modules](https://linuxbuz.com/linuxhowto/what-is-ansible-modules-and-how-to-use-it)
* [Ansible Variables](https://linuxbuz.com/linuxhowto/what-is-ansible-variables)
* [Ansible Conditionals and Loops](https://linuxbuz.com/linuxhowto/ansible-conditionals-and-loops)
* [Ansible Roles](https://linuxbuz.com/linuxhowto/what-is-ansible-roles)
* Project
   1. [Deploy WordPress with Ansible](https://linuxbuz.com/linuxhowto/how-to-install-wordpress-with-ansible)
   2. [Deploy Let's Encrypt SSL with Ansible](https://linuxbuz.com/linuxhowto/install-letsencrypt-ssl-ansible)
* [Ansible yum Module](https://linuxbuz.com/linuxhowto/ansible-yum-module)
* [Ansible apt Module](https://linuxbuz.com/linuxhowto/ansible-apt-module)
What are these customer care accounts(Spam)..?
Tags: discuss, meta
Published: 2020-10-04 08:43:05

Recently I came through 2 or 3 accounts 
> I don't know if I can mention their accounts.

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


> You can see in the above image that they are changing **company names** from post to post but the number they are mentioning is same in all the posts..


What they are doing is simply writing posts in fashion

> **"X company customer care xxxxxxxxx/yyyyyyyyy"**

And again they are commenting the same **n times** in those posts.

Even their **bio,work and all details** are the same..
___


> #I think they are trying to mention fake customer care numbers for reputed companies so that people who googles for customer care numbers can be trapped

 ***

Afterwards I got another question 
> Why DEV ?
> Bcoz of its good ability to appear in Google search results . Even I searched in Google and I got their account in search results 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/hf1zju740kwerobqe1vm.jpg)

It's purely my opinion after observing their account details ,posts and comments

> Please Retweet this on twitter🙏

{% twitter 1312675475219574784 %}

##Am I wrong ?
> If I am thinking wrong please let me know 

Do you guys have any idea about who are they ?

> Also let me know if I can mention their accounts
Flyleaf: Media Player & Torrent Streamer Application [Open .NET Library & Control for WinForms / WPF]
Tags: csharp, dotnet, showdev, github
Published: 2020-10-04 08:13:43

Customize and develop your own MediaPlayer with the help of the new Flyleaf UserControl which supports WinForms and WPF. Rendering of the control runs even on Visual Studio Designer so you can see live changes that have been performed.

The Media Player has been developed in C# from scratch to reach best performance and low resource consumption. It is based on FFmpeg multimedia framework (Decoding hardware acceleration & threading) and performs Direct3D / Direct2D / DirectWrite interops based on SharpDX for Video & Text Rendering and does Hardware Acceleration (VideoProcessorBlt & PixelShaders).

https://github.com/SuRGeoNix/Flyleaf
Random GitHub issue
Tags: hacktoberfest, github
Published: 2020-10-04 08:11:39

#####If you don't have issue, get one!

This small project help's you to find random issue on GitHub, get started and contribute to open source!

Find random issue and see if you can help!

[Check out tool here](https://arturssmirnovs.github.io/random-github-issue/)

[View on GitHub](https://github.com/arturssmirnovs/random-github-issue)
Setup PHP development environment width LDAP
Tags: php, ldap
Published: 2020-10-04 08:07:21

---
title: Setup PHP development environment width LDAP
published: true
description: Setup PHP development environment width LDAP
tags: php,ldap
//cover_image: https://direct_url_to_image.jpg
---

I have created a system to authenticate LDAP from PHP before.

At that time, I created a development environment with Docker, so I'll make a note of how to set it up.

The environment I used is as follows.

- macOS Catalina 10.15.5
- [Git](https://git-scm.com/)
- [Docker Desktop for Mac](https://hub.docker.com/editions/community/docker-ce-desktop-mac/)

## How to setup

open a terminal and clone [LAMP+OpenLDAP Dev Docker](https://github.com/ko31/lamp-ldap-dev-docker) repository.

```
git clone https://github.com/ko31/lamp-dev-docker.git <your-project-name>
```

Create and start containers.

```
cd <my-project-name>
docker-compose up -d
```

Then, you can access your local website at http://localhost:8000
(The document root is the `<your-project-name>/www/html` directory.)

## Try connecting to LDAP from PHP

To begin, make sure you have users connecting to your LDAP server.

Open phpLDAPadmin at http://localhost:8888 and click `login`.

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

In this container, the Login DN is `cn=admin,dc=example,dc=com` and the Password is `password` by default. Input it and click `authenticate`.

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

You can see that you were able to logged as an `admin` user.

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

Create `<your-project-name>/www/html/connect.php` and put the following:

```
<?php
// LDAP settings
const LDAP_HOST = "ldap-host";
const LDAP_PORT = 389;
const LDAP_DC = "dc=example,dc=com";
const LDAP_CN = "admin";
const LDAP_PASS = "password";

// Connect LDAP server.
$ldap_conn = ldap_connect(LDAP_HOST, LDAP_PORT);
if (!$ldap_conn) {
    exit('Could not connect to LDAP server.');
}

// Switch protocol to LDAPv3.
ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0);

// Bind to LDAP directory.
$ldap_dn = 'cn=' . LDAP_CN . ',' . LDAP_DC;
$ldap_bind = ldap_bind($ldap_conn, $ldap_dn ,LDAP_PASS);
if ($ldap_bind) {
    exit('LDAP bind successful..');
} else {
    exit('LDAP bind failed.');
}
```

You can confirm a successful connection at http://localhost:8000/connect.php

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

Have fun!👍
3 Easy Steps Before Getting Started with Laravel Jetstream
Tags: laravel, jetstream, inertiajs, step
Published: 2020-10-04 07:48:13

This is my first tries to develop applications using the Laravel framework. As for beginner, I just refer to the official [Laravel Website](https://laravel.com/). Just for general information :
- Laravel is the PHP framework, 
- a web application framework, 
- developed 2011 by *Taylor Otwell*.

The 3 Easy Steps is
- Step 1: [Install PHP for Windows 10](#step1)
- Step 2: [Install Composer (A Dependency Manager for PHP)](#step2)
- Step 3: [Install Laravel](#step3)

# Let's Get It Started
![Eat-Sleep-Code-Repeat](https://images.unsplash.com/photo-1564865878688-9a244444042a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80)
_Photo by [Roman Synkevych](https://unsplash.com/@synkevych?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText) on [Unsplash](https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText)_

### [STEP 1: Install PHP for Windows 10](/#step1)
- Download PHP from [php.net](https://www.php.net/downloads). For Windows please download PHP 7.4.11 [Current Stable](https://windows.php.net/download#php-7.4).
- After complete download, unzip the file into your computer. 
Example `c:\php\` or `c:\php-sdk\`
- Edit the System Environment Variables in your computer. Just add a new path for PHP environments. Type or browse `c:\php`
- To refreshing environment variables from the registry in cmd.exe, type `refreshenv`.
- Open cmd.exe and to test your PHP in your environments. Type `php -?`

### [STEP 2: Install Composer (A Dependency Manager for PHP)](/#step2)
- Download the Composer installation [file] (https://getcomposer.org/download/)
- Run `Composer-Setup.exe`.
- After complete. Open cmd.exe and to test your Composer in your environments. Type `composer -?`

### [STEP 3: Install Laravel] (#step3)
- Download the Laravel installer using Composer
- Open cmd.exe and type `composer global require laravel/installer` and press enter.
- After complete installed. You can use laravel new command and create a fresh Laravel installation in the directory you specify 

Example:
1. `laravel new blog`
1. `composer create-project --prefer-dist laravel/laravel blog`


## Complete & Congrat: 
[3 Easy Steps before getting started with Laravel Jetstream](https://dev.to/sheikhazrin/getting-started-laravel-jetstream-1k4e)
![Complete-and-Congrat](https://images.unsplash.com/photo-1594066521341-330a79387ec3?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1353&q=80)
_Photo by [Eilis Garvey](https://unsplash.com/@eilisgarvey?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText) on [Unsplash](https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText)_

## Next: 
Getting Started With Laravel Jetstream
Implement Stack using a List.  
Tags: challenge, python
Published: 2020-10-04 07:41:23

### Problem Statement: Implement stack with *push*, *pop*, *peek*, *isEmpty*, *size* methods using a List.

#### Test Cases

1. Push
   * Push on empty stack. 
   * Push on non-empty stack
2. Pop
   * Pop on empty stack --> None.
   * Pop on non-empty stack. --> value
3. Peek
   * Peek on empty stack --> None.
   * Peek on non empty stack. --> value
4. isEmpty
   * isEmpty on empty stack --> True
   * isEmpty on non-empty stack --> False.
5. Size
   * size on empty stack --> None.
   * size on non empty stack. --> value

### Algorithm

1. Push
   * Append new value to end of the list.
2. Pop
   * If stack is empty,
     * return None
   * Else,
     * Pop element from the end of list.
     * return the element.
3. Peek
   * If stack is empty,
     * return None
   * Else,
     * return the last element of the list.
4. isEmpty
   * If stack is empty,
     * return True
   * Else, 
     * return False
5. Size
   * Return the length of the list.

### Time and Space complexity

1. Push
   * Time complexity: O(1)
   * Space complexity: O(1)
2. Pop
   * Time complexity: O(1)
   * Space complexity: O(1)
3. Peek
   * Time complexity: O(1)
   * Space complexity: O(1)
4. isEmpty
   * Time complexity: O(1)
   * Space complexity: O(1)
5. Size
   * Time complexity: O(1)
   * Space complexity: O(1)

- - -

### Code

```python
class Stack(object):
    def __init__(self):
        self.items = []

    def isEmpty(self):
        return self.items == []

    def push(self, data):
        self.items.append(data)

    def pop(self):
        if self.isEmpty():
            return None
        return self.items.pop()

    def peek(self):
        if self.isEmpty():
            return None
        return self.items[-1]

    def size(self):
        return len(self.items)
```

### Unit Test

```python
import unittest
from stackLists import Stack


class TestStackLists(unittest.TestCase):
    def test_end_to_end(self):
        print('Test: Empty stack')
        stack = Stack()
        self.assertEqual(stack.peek(), None)
        self.assertEqual(stack.pop(), None)

        print('Test: One element')
        stack = Stack()
        stack.push(5)
        self.assertEqual(stack.size(), 1)
        self.assertEqual(stack.pop(), 5)
        self.assertEqual(stack.peek(), None)

        print('Test: More than one element')
        stack = Stack()
        stack.push(1)
        stack.push(2)
        stack.push(3)
        self.assertEqual(stack.size(), 3)
        self.assertEqual(stack.pop(), 3)
        self.assertEqual(stack.peek(), 2)
        self.assertEqual(stack.pop(), 2)
        self.assertEqual(stack.peek(), 1)
        self.assertEqual(stack.isEmpty(), False)
        self.assertEqual(stack.pop(), 1)
        self.assertEqual(stack.peek(), None)
        self.assertEqual(stack.isEmpty(), True)
        print('Success: test_end_to_end')


def main():
    test = TestStackLists()
    test.test_end_to_end()


if __name__ == '__main__':
    main()
```

[Github repo](https://github.com/Codewithml/coding-problems-solutions/tree/master/stacks-queues/stack/stack-lists)

### Happy Coding !! :smiley: