teleren/devto huggingface dataset:
What babel-polyfill doesn't include
Tags: babel, polyfill, shim, ecmascript
Published: 2019-02-17 12:21:48

> Originally posted at [michaelzanggl.com](https://michaelzanggl.com/articles/what-babel-polyfill-doesnt-include). Subscribe to [my newsletter](https://michaelzanggl.com/) to never miss out on new content.

[babel polyfill](https://babeljs.io/docs/en/babel-polyfill) is commonly used to emulate a full ES2015+ environment and is extremely simple to use. You just install it via npm or yarn and import it in your app. Now you are ready to go and write next level JavaScript without having to worry about browser support, or are you...?

Turns out there is a variety of things that babel-polyfill does not include.

It's important to know that babel-polyfill is using [core-js](https://github.com/zloirock/core-js) under the hood.

List of missing polyfills:
- `JSON` is missing only in IE7
- `String#normalize` is missing due to its rare usage and large size. Alternative polyfill: [unorm](https://github.com/walling/unorm/)
- `Proxy` can't be polyfilled
- `window.fetch` is not part of ECMAScript, but a web standard. While core-js does include some web standards, `fetch` is currently not one of them. Alternative polyfill: [github fetch](https://github.com/github/fetch)
- `Intl` is missing because of its large size. Alternative polyfill: [Intl.js](https://github.com/andyearnshaw/Intl.js/)
- [DOM polyfills](https://github.com/zloirock/core-js/issues/317#issuecomment-314691446). For example `element.closest`. What is included however are [iterable DOM collections](https://github.com/zloirock/core-js#iterable-dom-collections)
- `<script type="module">`. Instead, use bundlers like `webpack` or `rollup`

Also be aware of
- [caveats when using Symbol polyfill](https://github.com/zloirock/core-js#caveats-when-using-symbol-polyfill)
- [caveats when using typed arrays polyfill](https://github.com/zloirock/core-js#caveats-when-using-symbol-polyfill)
- [caveats when using URL and URLSearchParams](https://github.com/zloirock/core-js#caveats-when-using-symbol-polyfill)

If you know of anything else that is not included please leave a comment and I will add it to the list.

For a list of supported(tested) JavaScript engines please refer to [https://github.com/zloirock/core-js#supported-engines](https://github.com/zloirock/core-js#supported-engines)
Big collection of React hooks
Tags: javascript, react, hook
Published: 2019-02-17 14:54:14

---
title: Big collection of React hooks
published: true
description: Big collection of React hooks for reference
tags: [js, react, hook]
cover_image: https://thepracticaldev.s3.amazonaws.com/i/owi4q192z3cu5c1261xe.png
---

More and more I work with hooks. Most of the time I write hooks myself and to be fair `useState`, `useEffect`, `useRef` works 80% of the time. Sometimes, when I write custom hooks and have doubts about implementation I found it to be useful to check other's implementation of similar hooks. I thought it would be useful to have a big reference of hooks, so I would not need to jump across different GitHub repositories.

[I added over 150 hooks](https://github.com/nikgraf/react-hooks/pull/58/files) to Nik Graf's collection and [revamped search functionality](https://github.com/nikgraf/react-hooks/pull/56). You can check **final result [here](https://stereobooster.github.io/react-hooks/?search=%23GraphQL)**, while PRs are not merged.

It seems to be a helpful tool for me, maybe it will be helpful for you too.

[All data is available as JSON](https://github.com/nikgraf/react-hooks/blob/b4b50ca214d0657ae570a23d7e0ddf35f59dbd32/hooks.json) in case you want to do some analytics, like track most reimplemented hooks or biggest libraries.

Tell me what else you would add to this collection? Do you have ideas about UI or metadata we can add to this tool?
I developed "Fitness" a Flutter app for implementing "Fitness App Onboarding" UI/UX design by Anastasia Ageeva
Tags: flutter, ui, ux, app
Published: 2019-02-17 14:35:40

---
title: I developed "Fitness" a Flutter app for implementing "Fitness App Onboarding" UI/UX design by Anastasia Ageeva
published: true
description: This Flutter app is part of a collection of apps that I developed with the purpose of mastering the necessary skills for implementing custom UI/UX designs in Android and iOS.
tags: #flutter #ui #ux #app
---

This app is part of a collection of apps that I developed in Flutter with the purpose of mastering the necessary skills for implementing custom UI/UX designs in Android and iOS.

You can find the entire collection of apps in [this blog post](https://dev.to/crivasgomez/flutter-uiux-design-implementations-518i) and all the source code in [this GitHub repository](https://github.com/CRivasGomez/flutter-ui-ux-designs).

## Fitness

#### [Original design](https://www.uplabs.com/posts/fitness-app-onboarding-16ea7d31-a12c-49f8-b70c-e367cf651425) by [Anastasia Ageeva](https://www.uplabs.com/aaz127):

![Original design](https://thepracticaldev.s3.amazonaws.com/i/7sse2lwgtakjxt7s1x0t.png)

#### iOS demo:

![iOS demo](https://thepracticaldev.s3.amazonaws.com/i/owmx7btcv7q12oq114s5.gif)

#### Android demo:

![Android demo](https://thepracticaldev.s3.amazonaws.com/i/wc4qj8na7yy92k4nyprv.gif)
Poll : open-source contributions and motivation factors
Tags: opensource, community, motivation, factors
Published: 2019-02-17 12:25:35

---
title: Poll : open-source contributions and motivation factors
published: true
description: We are students and we carry out a study to determine factors that incite or discourage open-source contributions.
tags: opensource,community,motivation,factors
---

![Splash](https://thepracticaldev.s3.amazonaws.com/i/syhcta6j75mrvwr96lei.png)

Hello everyone :-)

For my very first post here, I would like to discuss with you about the motivation behind open-source contributors. What can engage people contributing to an OSS (Open-Source Software) ?

Four of us in our final year of engineering school, trying to figure out : **What are the motivational factors that can attract new contributors to an OSS project ?**

## We need your help ! ;-)

We have prepared a very quick (2 min) poll. We already have defined KPIs for our study and we would like to confront them with this poll. We would like to sketch a subjective view from a developer side with the answers.

**Here is the link below:**
[![Gform](https://thepracticaldev.s3.amazonaws.com/i/8bai0oue7gisbnnfsazs.png)](https://docs.google.com/forms/d/e/1FAIpQLSfnw2A6nOwr4vai8bzSbMBoOBEatI878d4fvBMt7nIHw5Ip0g/viewform)
<center><i>Poll link (click on the image)</i></center>

Once the poll analyzed, along with a selected number of large open-source projects, we will expose you a few guidelines on how to improve and enhance your OSS community ! :-) 

Results in a future post, stay tuned !


Image by : 
opensource.com
One thing i really like about GO
Tags: go, discuss
Published: 2019-02-17 10:57:01

---
title: One thing i really like about GO
published: true
description: Small thing i find really satisfying about GO
tags: #go #discussion
---

I already enjoy so much working with GO and lately i was working improving API on [Leprechaun](https://github.com/kilgaloon/leprechaun) switching from unix sockets to HTTP and i implemented something very simple which came to my mind when i was figuring out what to improve, what to change, what can be done better. Then this idea came to my mind, adding methods to primitive types which looks like this:

    type Cmd string

    func (c Cmd) agent() string {
	    s := strings.Fields(string(c))
	    return s[0]
    }

    func (c Cmd) command() string {
	    s := strings.Fields(string(c))
	    return s[1]
    }    

    func (c Cmd) args() []string {
	    s := strings.Fields(string(c))
	    return s[2:]
    }


I would like to hear more about this from you people, ideas, implementations, etc...
Failing Fast Is Not Enough
Published: 2019-03-27 16:59:10

---
title: Failing Fast Is Not Enough
published: true
tags: 
canonical_url: https://blog.professorbeekums.com/2019/failing-fast-not-enough/
---

Failing fast has become a common trope by now. It makes a lot of sense in some contexts. Fear of failing causes many problems, the biggest of which is being afraid to try something new. Even if a new thing only has a 1% chance of teaching you something useful, not trying gives you a 0% chance of learning something useful. Fear of failing prevents long term success.Overcoming this fear isn’t easy, but it can be done.

![](https://blog.professorbeekums.com/img/2019/fail.jpg)

Overcoming this fear isn’t easy, but it can be done. Failing fast can help someone grow accustomed to failure. They start to realize that failure isn’t the end of the world and a lot can be gained by taking chances. They also minimize the cost of taking chances through the “fast” part of failing fast.

However, the key part of failing is being able to learn from that failure to increase the chances of success later. In this respect, failing fast can be taken too far. Being able to tell yourself that you’re “failing fast” can create a false sense of security. Instead of analyzing failures thoroughly, it becomes easier to just shrug off a failure without putting a serious attempt in learning from it.

A perfect example is software development processes. No process is perfect and each one needs to evolve based on the team. And yet, it could be very easy to overreact to the first problem that can come up. “Look at how we let this one bug through! This process sucks. We need to start from scratch.”

The problem in this scenario is that it skips an in depth analysis of the failure. Maybe the right choice is to start from scratch. Or maybe there’s a tweak to the existing process that could work. Gut reactions are not going to make the right decision here. The failure needs to be discussed and dissected. Otherwise the failure gains you nothing. Failing fast becomes failing for the sake of failing instead of failing for future success.

There’s also the issue that for the most part, the number of possible things you can try is near infinite. Using an analogy: let’s say I’m writing a blog post and I’m trying to find the right way to word something. There are hundreds of thousands to millions of words. When phrases/sentences with many words are in consideration, that number grows very large very quickly. Not every permutation is useful. Experience with language provides a rough filter from the vast majority of those permutations. Analysis of previous writings provides a finer filter for the remainder.

But without that analysis, I would just be trying random words blindly. That’s not a path to success. That’s simply failing.
I built the Web app to search commits on GitHub
Tags: javascript, webdev
Published: 2019-02-17 09:28:14

---
title: I built the Web app to search commits on GitHub
published: true
description: 
tags: #javascript #webdev
---

Hello Developers!

I built a simple search engine of commits on GitHub :https://9sako6.github.io/commit-stalker/

![demo](https://thepracticaldev.s3.amazonaws.com/i/946slu5cqwtlypt9r6xi.gif)

## Motivation
 I like browsing commits of a library on the GitHub. A history of commit teaches me a process of developping a library, a manner of writing a commit message and so on.
 It's possible to see a history of them on the official GitHub site, but only 30 commits are showed at onece. It makes difficult to search older commits.
I want to see a lot more commits at onece and search older commits effectively.

## Usage
It's available at :https://9sako6.github.io/commit-stalker/

 It's easy to use. Please enter a user/organization and repository name. Page number is optional. Then, 100 commits of that repo are showed. If you push the ">>" button, you can show the page that includes the oldest commit.

## Features
 We can show 100 commits log at onece. In addition, it's easy to search the oldest commit of a repository.

## Problem
There is one problem now.
It is inpossible to get a total commit count for a GitHub repo via their API. 
![total commits 1](https://thepracticaldev.s3.amazonaws.com/i/6hqunahj9c57zzuh0jz3.png)
Therefore, I calculate a total commit count from contributions of contributors. However, we can get at most 100  contributors' information via GitHub API, so I can't calculate the exact total commit count of a repo that has over 100 contributors.

![demo](https://thepracticaldev.s3.amazonaws.com/i/dbqvpa1v6pm8ffxiaajx.png)

GitHub API example:

```shell:example
curl -i https://api.github.com/repos/sass/sass/contributors?anon=true
```
## Link
If anybody is interested please check out this app. here:


<a href="https://github.com/9sako6/commit-stalker"><img src="https://thepracticaldev.s3.amazonaws.com/i/1jha85fer5drb3t8exxb.png" width="460px"></a>



Thank you!!!
Retrieve entire data from paginated API recursively.
Tags: api, paging, recursive, javascript
Published: 2019-02-17 08:52:16

---
title: Retrieve entire data from paginated API recursively.
published: true
description: Retrieve data from a paginated API using recursive method in NodeJS/Javascript
tags: api, paging, recursive,javascript
---

![](https://images.unsplash.com/photo-1536227284117-59ae8d1a69aa?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=80)

In this post i am going to show to retrieve data from a paginated API using recursive method.

To explain the functionality, I am going to use a dummy REST API which i created in the mockapi.io. Currently the dataset has 91 records. By default it returns 91 records. In realtime, the dataset may be huge of more than 10000's data items. It's not recommended to query the entire dataset in a single api as it burdens the server performance and also place a heavy load on the client side as well. The recommended approach is to paginate the results when you are showing in the client side. That's the reason most of the API's provides some additional filters in the api to return only the records which the user is interested instead of returning the entire datastore.

Here some of the common filters used by the API's.

1.offset, limit : "limit" determines how many records to retrieve starting from the "offset"
2.page, limit : "page" determines which data the server needs to return based on number of "limit" -> records per page .

Please refer the respective API developer manual for more details on how to retrieve paginated results.

Sample API End Points :

Without Pagination : 
https://5b5cb0546a725000148a67ab.mockapi.io/api/v1/users

With Pagination :
https://5b5cb0546a725000148a67ab.mockapi.io/api/v1/users?page=4&limit=2

The above API endpoints are good for a normal use case. But they are requirements in which you need to retrieve all the data from the API and the API is designed to return only 50 records per call. In this scenario, we can create a recursive paginated API call and capture the entire dataset.

Remember,If you are not handling this properly it may end up with infinite looping and your browser may hang. In this example i have limited 20 items per page.

```
const limitPerPage=20;
const apiUrl="https://5b5cb0546a725000148a67ab.mockapi.io/api/v1/users";

const getUsers = async function(pageNo = 1) {

let actualUrl=apiUrl + `?page=${pageNo}&limit=${limitPerPage}`;
var apiResults=await fetch(actualUrl)
.then(resp=>{
return resp.json();
});

return apiResults;

}

const getEntireUserList = async function(pageNo = 1) {
  const results = await getUsers(pageNo);
  console.log("Retreiving data from API for page : " + pageNo);
  if (results.length>0) {
    return results.concat(await getEntireUserList(pageNo+1));
  } else {
    return results;
  }
};


(async ()=>{

    const entireList=await getEntireUserList();
    console.log(entireList);

})();

```
I have used the browser developer console to show the output. Please see this gif http://recordit.co/p3FkQS7QpJ

Thanks for reading & happy coding..
Writing Custom Metrics to Stackdriver in Golang
Tags: go, stackdriver, metrics, gcp
Published: 2019-02-17 01:20:30

---
title: Writing Custom Metrics to Stackdriver in Golang
published: true
description: Measuring filesystem-based indicators with a custom golang daemon and writing them to golang for tracking application activity
tags: golang,go,stackdriver,metrics,gcp
---


Instrumentation is a critical part of any application.  Along with system counters like cpu, heap, free disk, etc--
it's important to create application-level metrics to make sure health is measured closer to your customer's experience.

Example metrics could be user-registration, password-change, profile-change,
etc. If you see a major spike or dip in these metrics, a wider problem could
be indicated.

For this example a custom metric was needed, and no infrastructure was in
place for harvesting it (e.g. collectd). Golang is handy for creating an
easy-to-install daemon which performs the measurement and periodically
harvests the data into stackdriver.

The overall flow for custom metrics in stackdriver goes like this:
1. Create a custom metric with the stackdriver Metric Descriptor API -- this
    assigns a data type, dimensions, name & resource category to the metric.
2. Push metric values to the metric, recording it's value, resources and additional dimensions.

In the following example, we wanted to measure the number of files being
uploaded by a backup agent. The number of files was indicated by lines in a
logfile, which we used as our indicator (see `Line Counter` and `WatchFile`).
By sending the line count to stackdriver every 5 s, we were able to create a
dashboard and alert monitoring backup activity.



## 1. Create the Metric Descriptor

For your first metric, it's easiest to use the API explorer which will auto complete the definition.  As the project matures, call `mectricDescriptors.create` via `gcloud`

1. Visit [Explorer](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors/create?apix_params=%7B%22name%22:%22projects/%5BPROJECT_ID%5D%22,%22resource%22:%7B%22name%22:%22%22,%22description%22:%22Daily%20sales%20records%20from%20all%20branch%20stores.%22,%22displayName%22:%22daily%20sales%22,%22type%22:%22custom.googleapis.com/stores/daily_sales%22,%22metricKind%22:%22GAUGE%22,%22valueType%22:%22DOUBLE%22,%22unit%22:%22%7BUSD%7D%22,%22labels%22:%5B%7B%22key%22:%22store_id%22,%22valueType%22:%22STRING%22,%22description%22:%22The%20ID%20of%20the%20store.%22%7D%5D%7D%7D)
1. name: backup-count
1. valueType: INTEGER
1. remove labels.  We will assign a relevant resource using the writeMetric call

[Read the complete article here...](https://tonym.us/writing-custom-metrics-to-stackdriver-in-golang.html#writing-custom-metrics-to-stackdriver-in-golang)
Commonly Asked Coding Problems in JavaScript Interviews
Tags: javascript, es6, codingproblems, interviewquestions
Published: 2019-02-17 08:03:51

---
title: Commonly Asked Coding Problems in JavaScript Interviews
published: true
description: This post is a collections of some JavaScript coding problems that are commonly asked in coding interviews.
tags: JavaScript, ES6, Coding Problems, Interview Questions
---

JavaScript is changing every year. There are always new libraries, new frameworks and new things around it. Every year new developers are coming to learn this language and the jobs are increasing so as the interviews.

This post contains some practical and commonly asked coding problems that can be found in any technical interviews. So be not surprised while facing them.

## Remove duplicate element from an array

Using `Array.filter` method, check each element's index is equal to the `indexOf` value of the array.

{% gist https://gist.github.com/Vigowebs/dd0bf09d94ed0c04ed1ea15a55fbba7a %}

Or in ES6 using set:
{% gist https://gist.github.com/Vigowebs/c3b3f36557bf46dcca2d2bf70663af54 %}
___

## Reverse a string without native methods

Given a string, print the reverse of the string (ex: `javascript` becomes `tpircsavaj`).

Without native methods:

{% gist https://gist.github.com/Vigowebs/6ca653dae733d4e45e8105894034bd18 %}

Using recursion:

{% gist https://gist.github.com/Vigowebs/fcc5e291845f129ef72711eab3d745a0 %}
___
## Find the missing number

Given a unsorted array of numbers 1 to 100 excluding one number, find the missing number.

The sum of a linear series of `n` numbers is equal to `n*(n+1)/2`.

{% gist https://gist.github.com/Vigowebs/eb355d909acdc1a497eca925b0901981 %}
___
## Permutations of a string
Get all permutations of a string

{% gist https://gist.github.com/Vigowebs/89ae66ef2b2ee0011240db608e7a5805 %}
___
## Check sum of two

From a unsorted array, check whether there are any two numbers that will sum up to a given number.

{% gist https://gist.github.com/Vigowebs/53e377efa9e24ea476b2050b2a17da93 %}

Another way of doing, have an object where we will store the difference of sum and element. And then when we get to a new element and if we find the difference is the object, then we have a pair that sums up to the desired sum.

{% gist https://gist.github.com/Vigowebs/9bc448f636e47bafdc92119ca0988f1e %}
___
## Brackets match

For the given string, determine if the strings of brackets in the input is valid or invalid by these criteria.

"([)]" // false
"()" // true

The solution is

{% gist https://gist.github.com/Vigowebs/20b4daeeaa4e9c399e48e61975e58a17 %}
___
This post contains only a handful of examples from our recently published app [JS Code Samples](https://play.google.com/store/apps/details?id=com.vigowebs.jscodesamples). This app contains many examples varying from variable scope to coding problems like these. You can download the app from the below link.

[Play Store link](https://play.google.com/store/apps/details?id=com.vigowebs.jscodesamples)
What is best way to start react native?
Tags: react, reactnative, nativeapps, javascript
Published: 2019-02-17 06:54:06

---
title: What is best way to start react native?
published: true
description: I want to know that in what way I should start building native apps with react native. I have fairly good knowledge of react and redux
tags: React, "React native", "native apps", "javascript"
---