teleren/devto huggingface dataset:
Asset download, upload and metadata update all in one
Tags: actionshackathon, github, opensource
Published: 2020-09-12 01:00:56

---
title: Asset download, upload and metadata update all in one
published: true
description: Yet another submission to the GitHub Actions x DEV Hackathon!
tags: actionshackathon, github, opensource
---

### My Workflow
This actions is designed to, with the help of a GitHub bot:

* Accept clip and metadata input from a comment in issues
* Clip the asset according to the comment
* Download the asset and put it in the correct location (here begin the action part)
* Fill in the metadata
* Make a commit and push as a PR

### Submission Category: 

Maintainer Must-Haves

### Yaml File or Link to Code

``` yaml
name: "Auto PR for new sound"

on:
  issue_comment:
    types: [created, edited]

jobs:
  push_to_branch_and_create_pr:
    name: Create a PR with the sound
    if: "(contains(github.event.comment.body, ' pr ')) && ((contains(github.event.comment.author_association, 'OWNER') || contains(github.event.comment.user.login, 'librehsbot')) && (github.event.issue.number == 1))"
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
        name: Check out current commit
          
      - uses: suisei-cn/actions-download-file@v1
        id: downloadfile
        name: Download the file
        with:
          url: ${{ github.event.comment.body }}
          target: assets
          auto-match: true

      - uses: suisei-cn/actions-update-metadata@v2
        id: updatemeta
        name: Update sounds.yml
        with:
          comment: ${{ github.event.comment.body }}
          target: sounds.yml
          default-username: librehsbot
          format: yaml
          
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v2.8.0
        with:
          committer: Suisei Bot <noreply@suisei.moe>
          author: ${{ steps.updatemeta.outputs.username }} <${{ steps.updatemeta.outputs.username }}@users.noreply.github.com>
          commit-message: "feat(sound): Add ${{ steps.downloadfile.outputs.filename }}"
          title: "feat(sound): Add ${{ steps.downloadfile.outputs.filename }}"
          body: |
            This is an automated sound addition PR. Netlify preview should be available soon, and a preview link should be shown.

            <sub>Having problems? Check your [workflow](https://github.com/suisei-cn/sbtn-assets/blob/master/.github/workflows/auto_pr.yml).</sub>
          branch: sound/new
          branch-suffix: "random"
          labels: new-sound
```

[auto_pr.yml](https://github.com/suisei-cn/sbtn-assets/blob/master/.github/workflows/auto_pr.yml)

{% github suisei-cn/sbtn-assets %}

### Additional Resources / Info

* Two written actions with this action:
  * [actions-download-file](https://github.com/suisei-cn/actions-download-file)
  * [actions-update-metadata](https://github.com/suisei-cn/actions-update-metadata)
* The GitHub bot: [pvp-clipbot](https://github.com/suisei-cn/pvp-clipbot)
Sorts one list based on another list containing the desired indexes.

Tags: python, javascript, java, kotlin
Published: 2020-09-12 01:58:54


Use zip() and sorted() to combine and sort the two lists, based on the values of indexes. Use a list comprehension to get the first element of each pair from the result.

Code:

def sort_by_indexes(lst, indexes):
  return [val for _, val in sorted(zip(indexes, lst), key = lambda x: x[0])]

EXAMPLES

a = ['eggs', 'bread', 'oranges', 'jam', 'apples', 'milk']
b = [3, 2, 6, 4, 1, 5]
sort_by_indexes(a, b) # ['apples', 'bread', 'eggs', 'jam', 'milk', 'oranges']


Share and Support  t.me/python_codes
Better handle common imports across Python modules in an application
Tags: python, discuss, help
Published: 2020-09-12 01:38:55

I am reaching out to get help on some best practices to handle common imports which is making import section ugly with lot of lines of code. 

For instance, I have a python application suite with lot of modules with different directories (like utility, connectionprovider, configuration, datascience, etc). 
I would use logging, os, json, dateutil, shutil and few other common standard libraries which are necessary in many modules. How can I avoid importing them in every single module, and rather have it in some place where its applicable for the entire directory or group of files. 

Please help me with that!
¿Donde estudiar programación en GBA Zona Sur?
Tags: terciario, analistadesistemas, programacion, zonasur
Published: 2020-09-12 00:53:47

**<h3>Acerca de mí</h3>**

Hola a tod@s! , me presento mi nombre es Fabian. Actualmente, soy estudiante del 2do año de una carrera terciaria para Analista Programador en Desarrollo de Aplicaciones. Anteriormente, estuve estudiando la carrera de Ingeniería Civil en la Universidad de Buenos Aires, el cual pude avanzar hasta el 3er año. 

**<h3>¿Donde estudiar sistemas?</h3>**

Hoy en día, el ambiente de sistemas está muy demandado, en cuanto a ofertas laborales y muchas personas quieren vincularse al área buscando su primera experiencia laboral. En este tiempo, estuve en búsqueda de lo mencionado, y gracias al instituto del cual soy parte (por los conocimientos adquiridos), pude tener mi primera entrevista laboral y conseguir un trabajo como desarrollador .NET Jr. 
Mi vínculo laboral no pude haberlo conseguido sin la ayuda del [**Instituto San Agustín Nivel-Superior**](https://sites.google.com/view/sanagustinsuperior/), un instituto donde la formación en el área es excepcional. Donde los directivos y profesores guían en todo momento al estudiante en el proceso de aprendizaje. Donde se obtienen conocimientos que son transmitidos por parte de gente altamente capacitada que ya trabajó o está trabajando en el área de sistemas y nos aportan todas sus experiencias. El instituto, está ubicado en Av. Rosales 1036, Remedios de Escalada, Lanús.

**<h3>¿Qué título otorga el instituto terciario?</h3>**

El plan tiene una duración de tres años y otorga el título de Analista Programador en Desarrollo de Aplicaciones, con validez nacional. Se puede  continuar con los estudios universitarios mediante las posibilidades que te brinda el convenio de equivalencias con la Universidad Kennedy (Lic. en Sistemas), o gestionando personalmente ante otras universidades, como UNLZ, UC Salta,  UADE, U. Palermo, UAI. 

**<h3>¿Qué tecnologías se aprenden?</h3>**

Se estudian diferentes entornos de trabajo entre ellas Visual Studio y Eclipse. Se ven los lenguajes de programación como C++ , C# ,Java ,PHP ,R ,Python ,MySQL ,SQL Server , por mencionar las principales. Además te enseñan una introducción en desarrollo de aplicaciones mobile con Xamarin, Programación orientada a objetos, aplicaciones de escritorio, aplicaciones Web con ASP.NET, una introducción a Arduino y muchas otras tecnologías más. Por otro lado, se estudian conceptos de documentación en UML, que resultan fundamentales para un puesto en Análisis Funcional.

>Es una carrera súper recomendable, que sientan las bases de un profesional de sistemas el cual dispone de una posibilidad de seguir creciendo en diversas carreras de otras facultades.
How to automatically connecting Arduino  using serial-port in NodeJS
Tags: serailport, arduino, node, javascript
Published: 2020-09-12 00:49:46

[serial-port package](https://serialport.io) in NodeJS is an awesome tool. You can communicate with hardware like Arduino only with JavaScript. Here, i will show you how to automatically connected with plugged Arduino without specify the port that used. All you need is node installed application with serial-port package.

```
const SerialPort = require('serialport')

let path = ''
let ArduinoPort = ''

// Promise approach
SerialPort.list().then(ports => {
  let done = false
  let count = 0
  let allports = ports.length
  ports.forEach(function(port) {
    count = count+1
    pm  = port.manufacturer

    if (typeof pm !== 'undefined' && pm.includes('arduino')) {
      path = port.path
      ArduinoPort = new SerialPort(path, { baudRate: 115200 })
      ArduinoPort.on('open', function(){
        console.log(`connected! arduino is now connected at port ${path}`)
      })
      done = true
    }

    if(count === allports && done === false){
      console.log(`can't find any arduino`)
    }
  })
})
```

i wrote the code in portList.js file in enose-desktop-application node application directory. So, if i want to run it i typed commad

```
node portList.js
```
### Here the result
![Results](https://dev-to-uploads.s3.amazonaws.com/i/8wtcw3d5rstfbk0ezwv0.png)

That's all. I hope it will help you to solve the problem. any suggestion are welcome :)
React is a subsidy
Tags: javascript, react, openweb, diversity
Published: 2020-09-13 05:18:29

---
title: React is a subsidy
published: true
date: 2020-09-12 00:00:00 UTC
tags: 
  - javascript
  - react
  - openweb
  - diversity
canonical_url: https://emmas.site/blog/2020/09/12/react-is-a-subsidy
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/pqaonnnt9mznzmtf16dn.png
---

After a week of job interviews over video, [while the sky was the color of Landry Violence](https://blaseball.fandom.com/wiki/Landry_Violence#Incineration "Yes, it's a William Gibson and Blaseball reference."), I decided to watch [Stuart Langridge’s GOTO; 2020 talk (YouTube) on JavaScript](https://youtu.be/e1L2WgXu2JY?t=30).

Thirty seconds in, Langridge relates [Zack Leatherman’s example of 8.5MB of tweets in static HTML rendering 1/5 of a second faster than a React site rendering a single tweet (Hellsite)](https://twitter.com/zachleat/status/1169998370041208832).

Reader, I howled, despite that being a bad idea after a week of dangerous air quality and six hours a day on video calls. Then [I summoned The Infinite Scream (Hellsite)](https://twitter.com/infinite_scream/status/1304905286164058122) to do the howling for me while I wrote a blog post.

I’ve been thinking of the costs of the Javascript-first, particularly the React-first, state of web development:

1. Users have to buy and use high-end devices (phones, tablets, and laptops) to access content
2. Developers abandon the web for native applications    
  - Which in turn demand rents (transaction fees)
  - And concessions (non-political content, what content can be sold)
3. Orgs sticking with the with web use tool chains with high overhead and requirements (every dev needs a high end laptop and training in the React tool chain)
4. Development jobs go to people who have the time and skills to use React and native frameworks instead of the open web
5. JavaScript-first and native apps encourage privacy intrusive practices that siphon behavioral data, and reward getting a user “Hooked”

JavaScript in general, and React in particular, is a tax on the Open Web which subsidizes:

1. Device manufacturers
2. App stores
3. Surveillance capitalism
4. Elite developers

at the expense of:

1. Users stuck on a device upgrade treadmill
2. Projects which don’t fit the JavaScript-first economic model    
  - Especially anti-racist, anti-policing, and anti-colonialist projects
3. Creators who have to work under the precarity of large Social Media platforms
4. Developers without access to tools and training for elite jobs

This subsidy will continue to harm all of us who were told that the Web was a boon for everyone.
How to check if the current context of a webpage is secure using JavaScript?
Tags: javascript
Published: 2020-09-12 00:00:00

---
  title: How to check if the current context of a webpage is secure using JavaScript?
  published: true
  tags: JavaScript
  date: Sat Sep 12 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/check-if-https-enabled-javascript
  cover_image: https://melvingeorge.me/_next/static/images/main-70b2db9105bf015146dc907afc7cfdcd.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/check-if-https-enabled-javascript)
  
Often time we may want to do some processes like handling payments, accessing private information, working with service workers, etc. on our web app or web page. These activities should only be done when the current web page context is secure or if the context is `HTTPS` enabled

The easy way to check if the current context of a web page is `HTTPS` enabled is to check using the `isSecureContext` property in the window object.

```javascript
// check if the current context is HTTPS enabled
const isItHTTPS = window.isSecureContext;

console.log(isItHTTPS); // true
```

- The property returns a boolean `true` if the current context is `HTTPS` enabled and `false` if not.

See this snippet live in [JSBin](https://jsbin.com/hakaxosuye/3/edit?js,console).

### Feel free to share if you found this useful 😃.

---
Tailwind CSS and Fonts
Tags: googlefonts, tailwindcss, montserrat
Published: 2020-09-11 23:58:32

As a developer, there are situations that we run into and for some reason, our brain doesn't function the way we want it to and we have a really difficult time figuring out something so simple, or am I the only one? Today I was trying to import Google Montserrat Font into Tailwind.

After a handful of Google searches and trying out what other people did, I couldn't get it to work. So it basically came down to trial and error and this is what I came up with.

First, you have to import the link that Google Fonts provides:
```html
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500;600;700;800;900&family=Roboto&display=swap" rel="stylesheet">
```
Then, you have to extend the font in your Tailwind.js file:
```js
module.exports = {
    theme: {
        extend: {
            fontFamily: {
                'montserrat': ['Montserrat'],
                'lato': ['Lato'],
                'garamond': ['Garamond']
            }
        }
    },
    variants: {},
    plugins: [
        require('@tailwindcss/ui'),
    ]
}
```
Make sure you compile your assets and now you can use the following:
```html
<div class="font-montserrat"></div>
```
The cool thing when you do it this way is Tailwind automatically adds the different weights as long as you include them in the Google Fonts Link. So we can do something like this:
```html
<div class="font-montserrat font-light"></div>
```
I wanted to write this short article to hopefully save someone else from wasting valuable time. I hope this article helps you out and if you know of a better way or another way please leave the details in the comments.
How to add and use Subdomains in your rails app
Tags: ruby, rails, beginners
Published: 2020-09-11 21:17:39

---
title: How to add and use Subdomains in your rails app
published: true
description: 
tags: #ruby #rails #beginners
//cover_image: https://direct_url_to_image.jpg
---

Hello everyone,

This week, I will be showing you how to write subdomains in your routes.rb file.

I was working on an app recently and was thinking of the best way to use the same server to serve different type of users and I discovered how some apps do this. 

They use subdomains. 

The main domain will be for marketing purposes or for the landing page and other necessary information while subdomains will be created for the different categories of users or products you might want to use. 

Let's use google as an example. `google.com` points you to the search engine.
* For the mail, you need to use the `mail.google.com`
* For docs, slides, sheets or form, you have `docs.google.com`
* For drive, you have `drive.google.com` etc

For this post, we will build a simple route file with 2 subdomain: admin and platform. `Admin` subdomain will serve admin users while `platform` subdomain will be used by the apps main users. 

To define a subdomain, you use constraints.

```ruby
# routes.rb

root "home#index"

constraints subdomain: "admin" do
 get "/" => "dashboard#index"
end

constraints subdomain: "platform" do
 get "/" => "platform#index"
end
```

From the above, we define a root path on the domain and defined two root paths for our different subdomain.

To reference this new path for a `redirect` or `link_to`, you just simple need to pass the subdomain to `root_url` and rails takes it up from there. Using `root_path` won't work here because it returns a relative path and not an actually path where the subdomain can be included.

```ruby
# redirects
redirect_to root_url(subdomain: "admin")

redirect_to root_url(subdomain: "platform")

# link_to
link_to 'Dashboard', root_url(subdomain: "admin")

link_to 'Home', root_url(subdomain: "platform")
```

That's it for this week. Leave questions and comments below.

Until next week.
Why 3 > 2 > 1 gives false
Tags: javascript, beginners
Published: 2020-09-11 23:36:53

Recently, I saw this question about how does Javascript evaluate an expression:
{% twitter 1303981215461105670 %}

So, why does `1 < 2 < 3` give `true`, but `3 > 2 > 1` give `false`? According to [operator precedence and associativity](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table), they are evaluated from left to right. So...
1. `1 < 2 < 3` is evaluated as `(1 < 2) < 3`.
2. `1 < 2` is `true`, making the expression `true < 3`.
3. How does it compare a `true` against a number? It does this by first converting the boolean to a number. `true` is converted to `1` and `false` is converted to `0` (see [7.1.14 of the ECMAScript specififcation](https://www.ecma-international.org/ecma-262/11.0/index.html#sec-tonumber)). Thus, the expression is evaluated as `1 < 3` which gives `true`.

Now for `3 > 2 > 1`:
1. Going left to right, `3 > 2` is evaluated first which is `true`. The expression becomes `true > 1`.
2. To evaluate, `true` is converted to `1`. This gives `1 > 1`, which is `false`!

For bonus points, try figuring out `1 < 3 > 2` and `1 > 3 < 2` gives.
{% details Answers: %} 
For `1 < 3 > 2`:
1. `1 < 3` is `true`, so it becomes `true > 2`.
2. `true` is converted to `1`, so it becomes `1 > 2`, which is `false`.

For `1 > 3 < 2`:
1. `1 > 3` is `false`, so it becomes `false < 2`.
2. `false` is converted to `0`, so it becomes `0 < 2`, which is `true`.

{% enddetails %}
What do you know about Kaizen?
Tags: discuss, productivity, career
Published: 2020-09-11 23:18:37

It turns out that the processes we sometimes accept or create unconsciously are not always the best or most efficient and we can fall into the cycle of this process countless times until we realize it. That's why I think that incorporating a kaizen culture in the work teams can be the key factor to achieve being Agile since it implies generating proposals, agreements and activating them.

Start with what you have, make small changes and achieve great impacts!

### If it's not easy, it's not Kaizen.

## What do you think?
Laminar – Smooth UI Development with Scala.js
Tags: scala, javascript, react, showdev
Published: 2020-09-11 23:09:29

I have previously shared my path to building [Laminar](https://laminar.dev), a library for building reactive user interfaces with Scala.js:

{% post https://dev.to/raquo/my-four-year-quest-for-perfect-scala-js-ui-development-b9a %}

I've now recorded a comprehensive video introduction to Laminar. I tried my best to make the core ideas accessible to a broad audience including both Scala and Javascript developers while keeping the video at a reasonable...ish length.

{% youtube L_AHCkl6L-Q %}

The video covers:
* Basic structure and examples of Laminar components
* Core ideas and principles behind Laminar
* Benefits and challenges of FRP / observables
* Comparison with React and virtual DOM
* Integration with React and Web Components

Check it out if you're interested in typesafe UI development, are looking for something better or simpler (for a certain definition of the word) than React, or if you're just curious about non-traditional UI architectures.
Demystifying 1:1 meetings - part 1
Tags: agile, productivity, career, leadership
Published: 2020-09-11 21:44:21

---
[Click here for a BR-Portuguese version of the article](https://medium.com/@vanessagl2/desmistificando-o-famoso-1-1-ca056cf75d6d) 
<br>
During my conversations with colleagues who also work in Tech companies I noticed that "1:1" meetings have been a practice that teams are pursuing more and more. I have been played a Tech Lead role for the past three years and I talk about this topic because this has been a consistent practice on the teams I've been.
<br>
1:1s can be used as a tool in many different situations and because of that many people ask:
* What's a 1:1?
* Who should schedule this type of meeting?
* What should I talk about there?
* At which frequency I should be scheduling those?


Traditionally. 1:1s are meetings between two people and are a space where they will share performance evaluation, improvement feedback or salary review. 

I'll bring some insights based on my experience as both a Software Developer as well as being a Technical Lead who had a ton of 1:1 meetings. I believe these tips can help not only people who are on a team where this practice is encouraged but also those who want to begin having 1:1s but don't know how to start.
<br>

## I'm going to schedule a 1:1 but I don't know what to talk about. Is there a specific format?

Essentially you can talk about anything. There isn't an ideal model as it all depends on how people will feel more comfortable to start sharing with each other. 

Some common topics to have a conversation about it can be performance, feedback space, expectations setting and alignment and any personal development topics.

Always try to bring feedback to the other person: acknowledge and reinforce what they do well, good behaviours and practices and also bring improvement opportunities about each other. 

It's important to notice that your 1:1 meeting format may vary depending on how long you and the other person have been on the same team.
<br>

> Insight: _let people know about the areas you want to grow on, where are you heading on your career and which areas you would appreciate receiving feedback about_


### Suggestions for when you are both on the team for a while now
If you and the other person have been working together and are familiar with each other, consider some topics that include: 
* Current an upcoming challenges
* Mutual vision on what's going well on the team
* What's not going well, boring situations, bad practices
* Give each other Feedback
* Interesting opportunities on the project

> Tech lead insight: _schedule recurring 1:1s with the people from your team. Talk about people performance and also share challenges and opportunities that might be interesting to the teammate._ 


## To be continued...
I hope this small guideline already helps you kicking-off some interesting conversations on your team.

In the next texts I will share some more insights for other types of 1:1s, for example when you have new members on the team. 

See you there!
Exploring Pyright
Tags: python, vscode
Published: 2020-09-11 22:18:48

Are you using Python type annotations? Having fun with `mypy`? Microsoft created some years ago yet another static type checker called Pyright.

{% github microsoft/pyright %}

Some devs said it has a very great speed compared to mypy. I haven't used for any of my project's CI pipeline yet but I have this [VSCode extension](https://marketplace.visualstudio.com/items?itemName=ms-pyright.pyright) which, if you use this editor for your Python projects, you will be grateful on how it catches bugs caused by typing issues. So far it catches more issues than `mypy` and its messages are somehow clearer.

Being both VSCode and Pyright built with JavaScript (yes, Pyright was written in JS), their integration is pretty sweet. Although you can integrate to your favorite editor (vim, emacs, etc...).

The CLI is pretty similar to `mypy`. I'd suggest to give it a try and let me know how was your experience using it.

Wanna know how to start using type annotations in Python? Check out [my tutorial](https://www.stackbuilders.com/tutorials/python/using-types-in-python-with-mypy/) published by Stack Builders.