teleren/devto huggingface dataset:
Run Google's Lighthouse under authenticated websites
Tags: javascript, webperf, webdev, lighthouse
Published: 2020-09-17 13:34:56

### Have you ever run into a situation where your website demands some performance tweaks so you think of Google's Lighthouse and faces this problem:

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

### Fear not, my friend, for there are multiple solutions for this. See the links below for more info:

- [Lighthouse CLI Docs](https://github.com/GoogleChrome/lighthouse#using-the-node-cli)
- [Lighthouse CLI Auth Docs](https://github.com/GoogleChrome/lighthouse/blob/master/docs/authenticated-pages.md)

### In this article I am covering the **Option 4** from the Auth Docs: _Open a debug instance of Chrome and manually log in_ 

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

### Personal Notes

- The application must be served either on a server or locally e.g.: http://mysite.com or http://localhost:port (seems obvious, doesn't it?)
- Run `chrome-debug` so that the debugging browser is opened and the debugging port is shown
- If the opened window closes before being able to login, use the `--max-wait-for-load 15000` for 15 seconds or so (time in milliseconds)
- Say the application is behind SSL certificates, auto-signed ones, and there is a need to accept the risk everytime one runs it, bypass it by using the `--chrome-flags="--ignore-certificate-errors"` flag
- There are a bunch of other flags listed here [Lighthouse CLI Flags](https://github.com/GoogleChrome/lighthouse#cli-options)

- Final command with the beforementioned flags:

```sh
lighthouse http://localhost:3000 --disable-storage-reset --chrome-flags="--ignore-certificate-errors" --max-wait-for-load 15000 --port 45457
```

### Thats it, a short and direct approach. There are multiple ways described in their docs but this is the most straighforward I could find.
So that’s why you don’t do coding at 3 AM…
Tags: talesofabeginner
Published: 2020-09-17 13:28:26

As it turns out, I was trying to learn Docker at 3 AM today (as foolish as it sounds), and no amount of silent cursing would make the example app work.

Tried everything my already non-existing mind could come up to, which, at this point, wasn’t much. The best I could do was quitting and restarting the process all over again to the same results, like a bad gamer trying to get through a hard part of a game while doing the exact same thing over and over again. Almost went hollow there.

Finally, beaten by the need of sleep, I wrap myself up in the rags of my pride, grab my suitcase of self-derision and go to the land of the beaten and the damned – a.k.a my bed.

Anyways, turns out the thing (the example app) had an error at the end of one of the .js files – a missing “));”, and also I had probably typed some thing wrong on another part of the code. Yep, you definitely shouldn’t code at 3 AM.
Maintain Javascript Project Efficiently with GitHub Actions
Tags: actionshackathon, javascript, github
Published: 2020-09-17 13:21:20

### My Workflow
GitHub Actions to analyze the packages used in a JavaScript project. Helps maintainers have control over the packages used in the project.

What it does:
 - Lists the unused packages
 - Lists the expected size of the node modules after deployment


### Submission Category: 
Maintainer Must-Haves

### Usage
Adding the following to your workflow will create a new job using the js-package-info Action.
``` 
on: [pull_request]

jobs:
  js-package-info:
    runs-on: ubuntu-latest
    name: An Action to analyze javascript packages
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@v1
      with:
        node-version: '12'
    - run: npm install -g bundle-phobia-cli
    - run: npm install -g depcheck
    - name: Get Package Info
      uses: DesignrKnight/js-package-info@v2
      with:
        node_dir: './'
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

### Link to Code
{% github DesignrKnight/js-package-info %}


### Input Parameters

#### node_dir
The default is ``` ./ ```. Change it to point to the relative location of the package.json file in the git repo. If the location is ``` ./server/package.json ```, then the environment variable will be ``` ./server/ ```

#### GITHUB_TOKEN
The GitHub token from context is used to run this Action. Leaving this unchanged should work for almost all use cases.

### Additional Resources / Info
The Actions uses the following for its working
 - [actions/checkout@v2](https://github.com/actions/checkout)
 - [actions/setup-node@v1](https://github.com/actions/setup-node)
 - [bundle-phobia-cli](https://www.npmjs.com/package/bundle-phobia-cli)
 - [depcheck](https://www.npmjs.com/package/depcheck)

<span>Cover Photo by <a href="https://unsplash.com/@stanleydai?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Stanley Dai</a> on <a href="https://unsplash.com/s/photos/project?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></span>
Leetcode September Day 17
Published: 2020-09-17 13:16:51

Problem
>On an infinite plane, a robot initially stands at (0, 0) and faces north.  The robot can receive one of three instructions:

"G": go straight 1 unit;
"L": turn 90 degrees to the left;
"R": turn 90 degress to the right.
The robot performs the instructions given in order, and repeats them forever.

Return true if and only if there exists a circle in the plane such that the robot never leaves the circle.

Example = 
"""
Input: "GGLLGG"
Output: true
Explanation: 
The robot moves from (0,0) to (0,2), turns 180 degrees, and then returns to (0,0).
When repeating these instructions, the robot remains in the circle of radius 2 centered at the origin.
"""

Solution - 
```
class Solution:
    def isRobotBounded(self, instructions: str) -> bool:
        state_transitions = {
            'jl': '-i',
            '-jl': 'i',
            'il': 'j',
            '-il': '-j',
            'jr': 'i',
            '-jr': '-i',
            'ir': '-j',
            '-ir': 'j'
        }
        curr_dir = 'j'
        start = (0, 0)
        for ins in instructions:
            if ins == 'G':
                if curr_dir == 'j':
                    start = (start[0], start[1] + 1 )
                if curr_dir == '-j':
                    start = (start[0], start[1] - 1 )
                if curr_dir == 'i':
                    start = (start[0] + 1, start[1] )
                if curr_dir == '-i':
                    start = (start[0] - 1, start[1] )
            if ins == 'L':
                curr_dir = state_transitions[curr_dir+'l']
            if ins == 'R':
                curr_dir = state_transitions[curr_dir+'r']
        if start == (0, 0):
            return True
        else:
            if curr_dir != 'j':
                return True
        return False
```
I'm Daniel Newell, and I support women devs.
Published: 2020-09-17 13:16:35

<!-- ✨This template is only meant to get your ideas going, so please feel free to write your own title & narrative! ✨ -->

## What is equality?

Equality is not a complicated issue. It is definitely not up for debate. We all have to support devs regardless of age, gender, sexual orientation, disability, race, etc. We all share the same love for creating websites, applications, and more. Equality is the equal treatment of all people regardless of characteristics. 

## How I ensure equality (and how you should too)

I ensure that I work with people regardless of any characteristic. Sme of the best developers I knore are female or non-binary. Being part of it, I also work with the LGBTQ+ community. This isn't something you should brag about, it's human decency.

## To my female and enby developer friends:

You rock! You are wonderful beings who shouldn't be belittled because of your gender identity. You can do anything anybody else can do, I know it. Keep coding. :)

<!-- Once your post is published, it will not appear on the /t/shecodedally page until an admin approves it. This is an extra step to ensure there is no abuse on this important tag. -->
New PHP package for implementing authorization via social media
Tags: php, mezon, framework, oauth
Published: 2020-09-17 13:09:47

# Installation

Just type

```
composer require mezon/social-network
```

# All supported social networks
- Facebook
- VKontakte
- Odnoklassniki

If you need support of the social media wich is not in the list please use [issue creation form](https://github.com/alexdodonov/mezon-social-network/issues)

# Facebook auth code

First of all we need to create [Facebook application](https://developers.facebook.com/apps/)

After that you will be able to use this application for sign in page on your site.

And somewhere in your code you need to create object:

```php
$facebook = new \Mezon\SocialNetwork\Auth\Facebook([
	'client_id' => 'client id from the Facebook application',
	'client_secret' => 'client secret from the Facebook application',
	'redirect_uri' => 'URI of your web application on wih user will be redirected after authorization on Facebook'
]);
```

Then output a button on your page wich will let users to go on the Facebook and use ther facebook account for signing in on your site:

```php
print('<a href="'.$facebook->getLink().'"Sign In</a>a>');
```

After clicking on that link you users will be redirected on the Facebook. There they will confirm that they want to use your application for signing in and grant access to their account's data. And then they will be redurected on the 'redirect_uri' wich you have specified when you created your application on Facebook and the same URL must be used wile $facebook object setup.

```php
// your redirect_uri must process code

if($facebook->auth($_GET['code'])) {
	// authorization was successfull
}
else {
	// an error have occured
}
```

If the method $facebook->auth() have returned `true` then everithing is OK and you can fetch user's data:

```php
var_dump($facebook->userInfo);
// here:
// [
//	'id' => 'user id',
//	'first_name' => 'user first name',
//	'last_name' => 'user last name',
//	'email' => 'user email, but looks like Facebook has forbidden to fetch this info, so dont rely on this field',
//	'picture' => 'user avatar'
// ]
```

# Learn more

More information can be found here:

[Twitter](https://twitter.com/mezonphp)
[Mezon Framework](https://github.com/alexdodonov/mezon)

## It will be great if you will [contribute](https://github.com/alexdodonov/mezon-router) something to this project. Documentation, sharing the project in your social media, bug fixing, refactoring, or even [submitting issue](https://github.com/alexdodonov/mezon-router/issues) with question or feature request. Thanks anyway )
What is Container Operating System: Immutable, Auto-Updating, Security Minded Fedora CoreOS Intro
Tags: linux, kubernetes, containers, docker
Published: 2020-09-17 13:04:16

---
title: What is Container Operating System: Immutable, Auto-Updating, Security Minded Fedora CoreOS Intro
published: true
description: Container Operating Systems & Fedora CoreOS
tags: linux, kubernetes, containers, docker
cover_image: https://assets.mkdev.me/posts/covers/000/000/012/original/mkdev_article.png
---
What do you need to run containers in production? Linux kernel? Container manager? Some security features built-in? Is there anything else?

One of the trends in cloud native world is to run specialized Container Operating Systems that are purpose-built to run containerized workloads. Started with CoreOS, continued with RancherOS and others, we now have plenty of better options to choose from.

In this video, we will look at what Container Operating Systems are and we will see one of them, Fedora CoreOS, in action. We will see what is OStree and rpm-ostree, Ignition configuration and how to run Fedora CoreOS on AWS with ECR:

{% youtube ddTHK6Oed_Q %}

***

*You can always hire [our mentors](https://mkdev.me/en/specializations) and learn directly from them!*
Show and tell: Show off your VS Code setup :)
Tags: discuss, beginners, vscode, productivity
Published: 2020-09-17 12:56:15

Hey DEV community 👋

I primarily use VS Code for working with React/TypeScript and Python.
I could use some help and inspiration for really getting the most out of my VS Code experience!

I'd love to see your setups :)
From pretty themes and icon sets to your favorite plugins for productivity and ease of use.
Can somebody help me with React?
Tags: help, react, javascript
Published: 2020-09-17 12:36:26

How could it be possible to access const-variable before it was initialized in REACT app (It does NOT in Chrome Console tho!)

// MDN
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cant_access_lexical_declaration_before_init

1. React App
```jsx
import React from "react";
import "./styles.css";

try {
  console.log(test); // undefined
  const test = "THIS IS FOR TEST";
} catch (error) {
  // I don't understand why it doesn't throw the reference error.. 😫
  console.log(error);
}

export default function App() {
  return (
    <div className="App">
      <h1>Hello CodeSandbox</h1>
      <h2>Start editing to see some magic happen!</h2>
    </div>
  );
}
```

2. Chrome Console
```javascript
try {
  console.log(test);
  const test = "THIS IS FOR TEST";
} catch (error) {
  console.log(error);
  // ReferenceError: Cannot access 'test' before initialization
    at <anonymous>:2:15
}
```
The Magic of JavaScript Function Arguments Object
Tags: javascript, tutorial
Published: 2020-09-17 12:33:22

---
title: The Magic of JavaScript Function Arguments Object
published: true
date: 2022-12-08 09:29:23 UTC
tags: JavaScript, tutorial
canonical_url: https://www.90-10.dev/js-function-arguments-object/
---

**TLDR;** A special `arguments` object holds a list of all arguments passed to a JavaScript function even if none are specified in its definition. And can be used in creative ways! 😉

# Defining a "regular" function

A function is usually defined via the `function` keyword with arguments, if required, specified in following parenthesis. In the example below we've defined a `sayHello` function with 2 parameters:

```js
function sayHello(name, business) {
  console.log(`Hello ${name} from ${business}!`);
}
sayHello("Paul", "90-10.dev"); // "Hello Paul from 90-10.dev!"
```

Inside the function, parameters are accessed via their names given in the function definition, `name` & `business` in our case.

# `arguments` object

There is however another way to access any data passed onto the function, via the special `arguments` object where any passed on data is stored:

```js
function sayHello() {
  console.log(arguments);
}
sayHello("Paul", "90-10.dev");
```

The console will show:

```
Arguments { 0: "Paul", 1: "90-10.dev", ... }
```

And we can check if indeed `arguments` is an object:

```js
console.log(typeof arguments); // object
```

... and we can check how many were passed and even list all arguments:

```js
function sayHello() {
  console.log(arguments.length);
  for(let arg of arguments) {
    console.log(arg);
  }
}
```


# Using `arguments`

Arguments can be accessed in an array-like fashion using indices:

```js
function sayHello() {
  console.log(`Hello ${arguments[0]} from ${arguments[1]}!`);
}
sayHello("Paul", "90-10.dev"); // "Hello Paul from 90-10.dev!"
```


# Modifying `arguments`

Arguments can also be modified on the fly:

```js
function sayHello() {
  arguments[0] = "World";
  console.log(`Hello ${arguments[0]} from ${arguments[1]}!`);
}
sayHello("Paul", "90-10.dev"); // "Hello World from 90-10.dev!"
```

# Next Steps

* [What are JavaScript functions and how to use them](https://www.90-10.dev/a/javascript/functions)
* [Using Anonymous functions](https://www.90-10.dev/a/javascript/anonymous-functions)
* [Arrow functions](https://www.90-10.dev/a/javascript/arrow-functions)
* [MDN Function docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function)
* [Other 90-10.dev JavaScript articles](https://www.90-10.dev/a/javascript)
DevTools tips: Logpoints
Tags: javascript, devtools, debugging, tips
Published: 2020-09-17 12:28:15

When it comes to debugging javascript, there is one single tool that consinstently pops out, no matter how sophisticated the browser debugger is: **console.log()**


🤨

Ok, it's not really elegant but sometimes is an effective way to monitor what's happening in our code without recurring to breakpoints and watch expressions and without the need to pause the execution of our script.

The drawback is that `console.log()` statements tend to clutter the code and are really there for testing purposes only: we should remove them once we are done but there's always the risk that they slip in some production code 😫.

Luckily, any Chromium based browser has a nice feature that takes the best of the two approaches: **Logpoints**.

These are quite similar to brakpoints in the way they are set, but they allow us to define a message in the same way we would do for a `console.log()` statement, even passing variable or executing functions visible in the current scope.
Plus, script execution won't stop on a logpoint but rather will print the defined message in console.

Logpoints only live in the browser, so no risk of forgetting them in the code, and we can enable, disable or remove them as if they were breakpoints.

Check it out!

 ![Logpoint](https://dev-to-uploads.s3.amazonaws.com/i/2fmqhy7aqcpi8cfjmvhk.gif)

Simple and effective!
Registration Open: AI Edge Event
Tags: machinelearning, azure
Published: 2020-09-17 12:27:19

>###*This LIVE online event will take place on Thursday 1st October - register now at [aka.ms/aiedge-register](https://aka.ms/aiedge-register)*###

***

We're only just starting to understand the true potential of technology at the intersection of Artificial Intelligence, MLOps (Machine Learning & DevOps), Cloud Computing and Edge Computing - but the possibilities are endless. 

For the past few years, our AI Engineers, Data Scientists and Cloud Advocates at Microsoft have been working with the University of Oxford to further the development of these technologies **and** further the practical application of these in the world. 

The collaboration has resulted in the University of Oxford offering specific courses on AI and Cloud/Edge computing - and on the development of the [**AI Edge Engineer** Learning Path](https://aka.ms/learn-aiedge) on Microsoft Learn.

Now, we're bringing together the team at Microsoft and the academics at University of Oxford that worked to build this learning path - and you can meet them and find out more about this free Learning Path, as well as some of the amazing applications of these technologies, at our event on 1st October. 

Our event will take place LIVE at the times below and there is no cost to attend. Registration is now open at [aka.ms/aiedge-register](https://aka.ms/aiedge-register), and we can't wait to see you there. 

>###Thursday 1st October###
|Mumbai|Tel Aviv|Berlin|London|NYC|Seattle|
|:-------------:| -----:| -----:| -----:| -----:| -----:|
|10.30pm|8pm|7pm|6pm|1pm|10am|
Tech Industry Reshaped in the Covid-19 Pandemic by Mobile App Developers
Tags: mobileappdevelopment
Published: 2020-09-17 12:13:17

After all the chaos around the world because of the Covid-19 Corona Virus, the world is facing huge economical crises in the entire internity we as humans have lived, and due to all these major industries has faced their business fails and a lot on their finances.

Furthermore, many individual professionals laid off because of this pandemic only, and that's where only one sector was on high pick in this hard time for probably each professional world around the corner of the world, "TECH INDUSTRY." 

Especially, the mobile industry went to the next level in this period because of the usage rise to 100%, as mobile phones are accessible anytime and anywhere.
That's where businesses understood the potential of an application that aligned with their business plan, and what vulnerability can mobile app bring in growing any business if the marketing strategy does its job perfectly.

In a matter of fact, 50% major or minor businesses moved to the digitalized version of their businesses, and similarly, rest are planning or their mobile, web, website, or software application are in the development phase, and ready to get launched in the market ASAP.

But the difficult part comes when a business thinks to hire a tech partner for their IDEA or mobile/web and software application design and development process, also according to my experience of being in the IT sector for 10+ years, I would be suggesting any company, individual or tech entrepreneur if they are willing to hire an app developer for their business, [app developers India](https://morioh.com/p/0c36a72b1ccb) could be the possible and one-stop solutions.

Not just app developers from India are talented enough to handle any overcoming in their way to build a comprehensive mobile application, these professionals are even cost-effective which plays a vital role in the overall expenditure of an application development cost for any business.

Furthermore, they can develop an application according to your thoughts and latest technologies needs of any app, and the market demands compile with the consumer's perspective.
Daily Developer Jokes - Thursday, Sep 17, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-09-17 12:00:10

---
title: "Daily Developer Jokes - Thursday, Sep 17, 2020"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Thursday%2C%20Sep%2017%2C%202020"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12593d119ae.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
There are 10 types of people in this world, those who understand binary and those who don't.
 -->