teleren/devto huggingface dataset:
Brush up map, filter and reduce in 5 minutes
Tags: javascript, webdev, programming, tutorial
Published: 2022-04-12 03:28:43

Map, reduce, and filter are all array methods in JavaScript. Each one iterates over an array and performs a transformation or computation and returns a new array based on the result of the function.

<h2> Map </h2>
map method is used to create a new array from an existing one by applying a function to each element of the existing array. 

The callback function takes 3 arguments:
- current element
- index
- the actual array


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

Polyfill for map() :

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


<h2> Filter </h2>
filter method takes each element in an array and applies a conditional statement against it. If the condition is fulfilled, only then the element is pushed to the result array.
The callback function for filter takes the same 3 arguments as map();

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

Polyfill for filter() :


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

<h2> Reduce </h2>
reduce method reduces an array of elements down to a single output value. reduce() takes 2 arguments: the callback function & an initial value. If the initial value is not provided by the user, the first element of the array is taken as the initial value. The callback function takes 4 arguments:
- accumulator (result of previous computations)
- current element
- index
- the actual array

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

Polyfill for reduce() :

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

<p> Example to sum it up: </p>

![ex](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/my2zns7f9fvh3sx3kzkf.png)
Vue2 vs Vue3
Tags: vue, javascript
Published: 2022-04-12 03:10:12

For a simple table of 30k items with search, sorting and filtering, vue2 was significantly more responsive during the filtering step. Typing in the textbox was smooth whereas in vue3, it was quite janky. Very unexpected, I'll need to dig deeper at some point. The code was almost identical as I compared the two in the same project.

Even the page render was faster with vue2 which was also surprising. I think it might have to do with the way that every array object now needs to get proxied. It could be vue3 is more powerful but at a cost though I imagine it will go down over time.

It's also likely that I'm simply doing something wrong. For now vue2 works, so I'll continue using that.
If I could do it all over again
Tags: beginners, discuss, career, writing
Published: 2022-04-12 01:47:29

I'm probably the oldest person in the room. I'm 45 years old, a middle-level executive, and I wish I could go back 20 years and kick myself for not devoting more time to developing a coding career. I was fortunate to have always had a computer, but I wasted my time chasing girls and hanging out in Tijuana when I should have been learning Basic. I've always been fascinated by what you geniuses can accomplish, and when I finally decided to dive in and teach myself, I realized how far out of my league I'd gotten.

I've always been successful in the careers and jobs I've had in the past, so don't take my mood as completely depressed about it, but damn... I just wish I hadn't taken the path I did. Who knows what I could or could not have done? I suppose that's how regret works.

The issue I've always had is that I'm not a beginner, but I'm also not an expert. I can follow tutorials on the internet, and because I understand the concept at least, I can complete the majority of the projects I've attempted. The annoying thing that happens is that I will start a project with a guide, and there will be one concept that I don't understand, or the guide sharing their knowledge simply assumes that everyone knows, so they gloss over an important step, or simply omit it. At that point, I've installed dependencies, looked up everything that I thought I should, and still find myself at a loss. A good example is Solidity. Another is APIs. I know why they work and why they are important, but the retention of the information or the implementation of the process alludes me. 

I haven't given up, and I suppose that's what keeps me interested in learning as much as possible. It's not like I'm going to quit my well-paying job to work for a startup right now. I only do it for myself. So when everything comes together and I finally understand the mystery that had been veiled, I'm satisfied. It's much more than just closing a deal or persuading a company to sell to us. Those are minor victories. If I could just master markdown, I'd feel like I'd accomplished something significant.
I want to integrate twitter api
Tags: javascript
Published: 2022-04-12 03:06:58

We are trying to integrate twitter api for our page [Annapurna base camp trekking](https://www.nepaltraveladventure.com/annapurna-base-camp-trekking.php), we could not able to integrate this api

can you look at our page and give feedback, what might be the exact solution for it
I created a program that lets you create cool HTML widgets for your PC
Tags: javascript, programming, css, node
Published: 2022-04-12 02:52:12

I've created [a program](https://github.com/underpig1/widget-builder) so that you can make HTML widgets for your PC!

Be sure to check out this [spotify widget](https://github.com/underpig1/widget-builder/tree/master/widgets/spotify-listener) I've created to demonstrate the capacity of this program: [![Spotify listener widget](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t43h3799xqf9pgbggim6.png)](https://github.com/underpig1/widget-builder/tree/master/widgets/spotify-listener)
Let me know what you think!
Vercel 101
Published: 2022-04-12 02:30:30

Vercel Site Deployment

Vercel

Vercel is a tool used to deploy and test static sites. It allows developers to complete these actions in a quick manner. Users can link GitHub accounts to Vercel and import their projects. After importing, these projects can be deployed automatically. This means that Vercel will update the deployment as changes come in.

To learn more about how this happens, check out the article and documentation listed in the Sources section.

How to get Started with Vercel
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/swzih3j360levag1ihmk.png)
 
The first thing you are going to want to do is install Vercel via your command line. To do so, follow the "Vercel Installation" link.

Once you have successfully installed Vercel, you should link your GitHub account to deploy an existing project.

Importing a repository is simple: just search for the one you want to deploy and click import

For the sake of an example, I used this source to get set up with Vercel. In my terminal, I ran a cd to get into the directory where the code was housed. Then, I ran npm install and vercel dev. I pushed this code to GitHub, and was able to successfully use Vercel to generate the site.


Publishing 11ty Sites via Vercel
The process of publishing 11ty sites with Vercel is rather simple. As before, simply import the desired repos and deploy. Below are some photos of this working for me!

11ty deploy

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qbauim9c5f3yzfvmrhhj.png)
 
Vercel vs Other CI/CD Pipeline Approaches

For myself, Vercel has been the simplest tool to use so far. In my opinion, it is easier to understand and use than other approaches. Vercel has the advantage of automatically updating as code is pushed out (with the help of GitHub). In addition, the simplicity of this site allows for anyone with a basic understanding to use it for development!

In short, Vercel seems to be the most versatile tool used so far. It has presented an easy development experience and it appears to be a very powerful site.
Hoot-Blog-Site
Published: 2022-04-12 02:18:42


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fes78qk8bgcja04zpk8j.png)
## [Live Site Link](https://hoot-story-blog.netlify.app/)
## [Live API](https://hoot-story-blog.herokuapp.com/blogs)
## [GitHub Client Side / Frontend](https://github.com/mahadihassanriyadh/hoot-story-blog-site-client-side)
## [GitHub Server Side / Backend](https://github.com/mahadihassanriyadh/hoot-story-blog-site-server-side)

Here are two separate folder for the full project, one is for frontend and the other one is for backend.

## To use frontend folder
You can directly visit my live site from above or you can open the "hoot-story-blog-site-client-side" folder and open the command line there and then use the command below to see the outcome
`$ npm start`


## To use frontend folder
You can directly access my backend from above link, or you can open up the folder "hoot-story-blog-site-server-side" and open the command line there and then use the command below to run the local server
`$ npm run start-dev`


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8dalmcc413x0np9ir8th.gif)
Mastering Prototype and Inheritance in JavaScript: A Comprehensive Guide
Tags: javascript, webdev, beginners, programming
Published: 2022-04-12 02:16:25

**Blog Goals:**
1. How inheritance makes coding efficient
2. How do we achieve Inheritance in Js
3. Object.create() method
4. Everything in Js is object
5. Prototype chain
6. Prototype method available on the constructor function
7. Difference between **proto** and prototype
8. Creating your own array library

##What is a prototype?
- A blueprint
- An original object from which a new object is created.

##What is inheritance?
- In simple terms, inheritance is the concept of one thing gaining the properties or behaviors of something else.

- To say A inherits from B, is saying that A is a type of B.

-a Bird inherits from an Animal because a Bird is a type of Animal  it has characteristics of every other animal, but other features as well.

##Why Inheritance?
- It allows us to borrow properties and function methods of one object on another object. ( Inheritance )
- more reusable code
**How to use Prototypal Inheritance in Js?**

**There are two ways.**


```
1. Object.create()

2. Constructor functions
```

**additional resources:**
https://javascript.info/prototype-inheritance
[master the js](https://medium.com/javascript-scene/master-the-javascript-interview-what-s-the-difference-between-class-prototypal-inheritance-e4cd0a7562e9)

> Thank you for reading :))

>*sleeping at 12AM and wake up at 5AM can make you productive in life than any other random schedule*

If you like my blog, you can connect with me on [LinkedIn](https://www.linkedin.com/in/avinashvagh/) & can follow me on [Twitter](https://twitter.com/avinashvagh) & can checkout my [Hashnode blog](https://avinashvagh.com/)
Python sys.excepthook
Tags: python
Published: 2022-04-12 02:11:25

---
canonical_url: https://waylonwalker.com/til/python-sys-excepthook/
published: true
tags:
- python
title: Python sys.excepthook
---

Sometimes you just want python to do something else when you hit an exception, maybe that's fire a text, slack message, email, or system notification like I wanted.

I am working on a quick and dirty python script designed to take screenshots and land them on my website in a single hotkey.  With it being designed to run with a hotkey, if it were to error I would not see it.

I could have gone down a logging route, but honestly this is meant to be quick, dirty, and work on my system for me.  I just want to get it in my system notification.

## sys.excepthook

Python exposes sys.excepthook for just this case.  Here is what I ended up doing to fire a system notification as well as printing the message.  Yaya a log would be mroe appropriate, but this is designed to just get done quick and do the job I want it to do.

```python
def notify_exception(type, value, tb):
    traceback_details = "\n".join(traceback.extract_tb(tb).format())

    msg = f"caller: {' '.join(sys.argv)}\n{type}: {value}\n{traceback_details}"
    print(msg)
    Popen(
        f'notify-send "screenshot.py hit an exception" "{msg}" -a screenshot.py',
        shell=True,
    )


sys.excepthook = notify_exception
0 / 0
```

## Discuss

This was my first time ever using `sys.excepthook`  Have you used it for anything before?
My AWS Journey Has Started
Tags: aws, cloud, cloudskills, beginners
Published: 2022-04-12 01:22:02

## Prior To starting my cloud training

Being a Web Designer and delving deeper on the development side of life along with and inclusive of the graphics side to complement my end product. I've always had a deep interest in technology with a view of making improving the lives of those who is involved.

My decision to start on my cloud journey wasn’t a difficult one to make, as I’d seen it as a definite step to make either concurrently with my Dev journey or after. From looking at several videos, reading documentation relating Software Engineering and the Cloud Industry, it was clear that they both are strong within their own right, however, Cloud has pick up allot of steam, here to stay and not getting involved will be a decision I’d not want to regret not making.

## Deciding who to study with and why

The choice to join an established training organisation was never a question, and post making a few enquires, speaking with accounts manager, trainers, instructors I’ve had to put a definitive starting point on hold due to work and personal commitments.

Several months later I received a few emails from various training organisations enquiring should I have interest of undertaking their training package, to refresh all relevant information mentally that’ll confirm my decision of whom will taking me down what I considered the highway of cloud training.

Finally, after sitting in on open day sessions to have an insight of what is being offered from the training body and available support, there was no doubt of what my decision was going to be.

I chose to become an AWS Academy Student through Optima-IT, as the support offered as indicated during the open day was everything and more expected, and looked forward to setting a start date.

## Starting with the Academy

First day of the Academy was Saturday 26 Feb 22, and, although I was looking forward to completing a few planned activities then having some time to myself, that quickly shifted eagerly to start on my journey in cloud training which is more important to me , for what I want to achieve and where I wanted to be after a set period of time.

## Conclusion

I’m happy to say I think I’ve made the right decision now in preparing, taking the steps and acting upon them well ahead of time and not delaying the process any longer in working towards my goals and what I wanted to achieve.

### Future Updates

Look out for future updates on my journey covering what I’ve learnt, hurdles encountered (should there be any), and what I’ve done to get over them.
Amazon ERC Number
Published: 2022-04-12 01:05:30

[Amazon ERC number](https://www.mygeekshelp.com/what-is-amazon-erc-contact-number-exactly/) only used for issues or general quires of the employee. The team comprises a lot of employees, ranging from 2500 to 3000 that offers assistance to the amazon employees around 48+ countries and about 15 different languages.
Intuition Driven Interviews
Tags: programming, career, writing
Published: 2022-04-12 00:43:29

Tech interviews are for the most part broken. Everyone kind of knows it, many hate it, and many more accept it. 

It seems like there's a prevailing sentiment where these sort of tech interviews are a necessary evil. 

To me, the current way of spitting out algorithms and asking interviewees to solve them reminds me of the North American school system. This system rewards memorization more than it does creativity or mastery. 
It seems like that carried into the tech interview process.

My major gripe is that solving algorithms does not set me apart from a fresh graduate, or someone with no experience at all. Nor does it resemble the daily work of most developers.

When I hear that it requires months of preparation to pass interviews for some big companies, it makes me dread when it is time to prepare for the process all over again.

I think we can do better.

When I get the chance to conduct interviews, the type of interview I like best is asking to review some code.

I give them a piece of code that has many flaws. Many of the flaws are glaring and critical, while others are subtle. Sometimes refactors can can be done that end up improving not only readability, but runtime performance. While other times it can be done just for the sake of better readability.

My goal is not for them to turn the code into the perfect piece of software, but to see what their understanding of _better_ software is. It allows me to put into light something that is hard to express - intuition. 

Granted, this intuition will vary between roles and people, but in general I've found that it makes for very relaxed interviews - since it's something that most developers do quite often (as opposed to solving code challenges).

Intuition Driven Interviews. What do you think?
Understanding Object Literal Enhancement In Javascript
Published: 2023-07-09 09:52:41

---
title: Understanding Object Literal Enhancement In Javascript
published: true
date: 2022-04-12 00:13:21 UTC
tags: 
canonical_url: 
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zyw1h7rhpz8sadipvky3.png
---

## Definition

**Object literal enhancement** is the opposite of destructuring. it's the process of restructuring or putting the object back together.

Remember in my previous blog, i talked about about [Array and Object destructuring](https://smitho.hashnode.dev/array-and-object-destructuring-in-javascript), and stated that _destructuring_ is the process of unpacking a small part of something from the main part. Well, with **object literal enhancement** , we can grab variables from the global scope and add them to an object.

```
const name = "Tallac"
const elevation = 9738
const funHike = {name, elevation}
console.log(funHike); //{name: "tallac", elevation: 9738}

```

name and elevation are now keys of the _funHike_ object.

We can also create object methods with object literal enhancement or restructuring.

```
const name = "Tallac"
const elevation = 9738
const print = function(){
    console.log(`Mt. ${this.name} is ${this.elevation} feet tall`)
}
const funHike = {name, elevation, print}
funHike.print(); // Mt. Tallac is 9738 feet tall

```

Notice we use **this** keyword to access the object keys.

When defining object methods, it's no longer necessary to use the function keyword.

```
//old
var skier = {
  name: name,
  sound: sound,
  powderYell: function () {
    var yell = this.sound.toUpperCase();
    console.log(`${yell} ${yell} ${yell}!!!`);
  },
  speed: function (mph) {
    this.speed = mph;
    console.log("speed", mph);
  },
};

// New
const skier = {
  name,
  sound,
  powderYell() {
    let yell = this.sound.toUpperCase();
    console.log(`${yell} ${yell} ${yell}!!!`);
  },
  speed(mph) {
    this.speed = mph;
    console.log("speed", mph);
  },
};

```

## Conclusion

In conclusion, **Object Literal Enhancement** allows us to pull global variables into object and reduce typing by making th function keyword unnecessary.

If you find this article helpful, then click on the follow button to get more updates and helpful resources on Javascript, ReactJs and NextJs.. You can also follow me on twitter @o\_sunday15 to get useful resources and tech trends.

Don't forget to leave a comment on what you think and know also....😎😎
cmagick v.0.1.2
Tags: python, linux, devops, showdev
Published: 2022-04-12 00:04:52

**Hi guys!**

I have just built a Python package that converts, and resizes images

**Why I have build cmagick?**

Before I have used [Pillow](https://pypi.org/project/Pillow/) and I had problems importing the "convert" module in **AWS Lambda**, then I have used [Wand](https://pypi.org/project/Wand/) which was amazing because I have managed to build a [serverless image resizer on AWS Lambda](https://github.com/aissa-laribi/awsops/tree/main/S3/Resizing-Images), and then I wanted to build a serverless application that converts to **WebP** and I have struggled with Wand to link with libwebp in the Lambda runtime.

As a result, I have decided to do roughly the same thing as Wand **but instead of binding C programming language with Python, I am binding the input of the commands on the Linux CLI and Python.**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d04e4ux2y2r1rau62ccu.png)

**The main features of cmagick v.0.1.2**

- Converting images to the following formats (**bmp,eps,gif,tiff,webp,wbmp,tga,png,jpg,jpeg,hdr,exr**)
- Resizing Images
- Support path arguments 

**Simple usage**

Examples:

To convert images

```
from cmagick import cmagick

cmagick.convert('website.jpg', 'website.webp')

```
To resize images

```
from cmagick import cmagick

cmagick.resize('website.jpg','100x100','website.jpg')
```
To convert and save in a defined directory

```
from cmagick import cmagick

cmagick.convert('website.jpg', '/Desktop/newname.webp')
```


Thank you for reading this small post🙏!

Connect with me on [GitHub](https://github.com/aissa-laribi) and pls put ✨star✨ for this [package](https://github.com/aissa-laribi/cmagick)
The "Why" Conversation
Tags: userstories, agile, requirements
Published: 2022-10-25 20:30:14

---
title: The "Why" Conversation
published: true
cover_image: https://jhall.io/images/bn-man-wondering-why.jpg
date: 2022-04-12 00:00:00 UTC
tags: userstories,agile,requirements
canonical_url: https://jhall.io/archive/2022/04/12/the-why-conversation/
---

Jonathan Stark, aka “the [Ditching Hourly](https://podcast.ditchinghourly.com/) Guy” teaches independent professionals how to make more money without working more hours. One thing he advocates when working with potential clients on a custom engagement is what he calls [_The Why Conversation_](https://jonathanstark.com/daily/20160810-the-why-conversation). It’s a tool designed to help uncover the client’s desired business outcome, the urgency of the project, and to help ensure that you’re the right person to help the client achieve success. In a nutshell, this diagnostic conversation consists of three fundamental questions:

- **Why this?** Why is this project important? Why not do something else (or nothing) instead?
- **Why now?** Why is this project important _now_? Why didn’t you do it last year? Why not wait until next year?
- **Why me?** Why do you think _I_ can help you achieve success with this project? Why not hire someone in-house, or someone off Fiverr, or buy an off-the-shelf solution?

While Jonathan uses this tool for consulting engagements, I think it’s a perfect tool for software development, too. Especially when the value of a feature or epic is unclear.

- **Why this?** Why is this feature important? Why not add some other feature instead, or no feature at all?
- **Why now?** Why is this feature a priority now? Why wasn’t it important a year ago? What if we wait a year to do it?
- **Why me?** Why am I or my team uniquely positioned to help achieve success with this project? Why not an off-shore team? Why not use an off-the-shelf open source library?

If you have solid answers to each of these questions, it should be pretty unambiguous why you/your team are working on this project, why it’s important, and why it’s timeley.

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._