teleren/devto huggingface dataset:
Announcing GraphQL Application Security Testing
Tags: graphql, security, devops
Published: 2020-06-10 21:17:52

In 5 short years, [GraphQL](https://graphql.org/) has solidified its footprint as the API backing of many applications, and it shows no sign of slowing. More and more companies are choosing GraphQL for its simplicity, ability to fetch the right amount of data, and the way it can traverse a graph of relational data.

Securing GraphQL applications, however, has been a challenge. Sure, there are common best practices and rules in place. But reliance on training or the rudimentary automated checks that currently exist only gets you so far. Eventually security bugs will be deployed and your app will be at risk. 

…until now. 

# GraphQL Security from StackHawk
We’re excited to announce that HawkScan, StackHawk’s scanning engine, now supports GraphQL applications. StackHawk is the only product on the market that can scan a running GraphQL application, simulating an attack by fuzzing the various query parameters, and surfacing potential security bugs to engineering teams. 

With [StackHawk](https://www.stackhawk.com), teams using GraphQL for their API layer can now confidently catch potential vulnerabilities before security bugs hit production. With CI/CD automation, you can ensure that potential bugs are caught early in the development lifecycle and fixed by the developers who have the context and expertise of the code base they just merged to. 

# How it Works
StackHawk is a dynamic application security testing tool. That means it runs security testing against your running application, whether that be on your local machine, in CI environments, or against your application in production. 

GraphQL testing is done by exposing the introspection endpoint to the scanner via the StackHawk.yml file. The scanner runs introspection and identifies all of the potential query and mutation operations of the endpoint, and then gets to work finding potential security bugs. As a dynamic security test, the scanner sends requests to all endpoints, effectively fuzzing the whole GraphQL tree, simulating the ways the application could be attacked. The scanner logs all tested endpoints and any security bugs found, with the associated request and response payload. From there, developers can triage bugs, fixing high priority issues and using Findings Management to quiet noise for accepted risk or assigned items. Then, GraphQL scanning can be automated in the pipeline to ensure that no build hits production with unaccepted security risk. 

# Getting Started
Getting started with GraphQL security in StackHawk is incredibly easy, simply requiring the addition of the schema path to the stackhawk.yml file. 

```
App:
  ...
  graphQL: true
  graphQLSchemaPath: /graphql
```

Visit [our docs](https://docs.stackhawk.com) for more information on configuration for GraphQL, as well as other configuration options such as authenticated scanning. As always, our team is available to assist as you begin using StackHawk. Reach out to support@stackhawk.com and we will be happy to help.
100 Days of SwiftUI — Day 20
Tags: 100daysofswiftui, swift
Published: 2020-06-10 20:38:53

---
title: 100 Days of SwiftUI — Day 20
published: true
date: 2020-06-10 20:38:28 UTC
tags: 100daysofswiftui,swift
canonical_url: https://zeitschlag.net/100-days-of-swiftui-day-20/
---

I just finished [Day 20](https://www.hackingwithswift.com/100/swiftui/20) — and it unexpectedly totally brightened my day! Today was the introduction day for the second project. Paul talked about the different stack types in SwiftUI, button, alert — and colors and gradients. And suddenly, I couldn't resist anymore, I had to play with them! So I — more or less — proudly present the result:

![Simulator-Screen-Shot---iPhone-SE--2nd-generation----2020-06-10-at-22.32.44](https://zeitschlag.net/content/images/2020/06/Simulator-Screen-Shot---iPhone-SE--2nd-generation----2020-06-10-at-22.32.44.png)

Creating this view using the built-in Canvas felt like magic, like painting — thankfully, I'm neither an artist, nor a magician, nor a UI designer. I'd propably suck. But seriously, it was _sooooo much_ fun! And changing things is so fast, it's amazing.

What still feels a bit unusual is that I have to put `Text("string")` like everywhere instead of just a `"string"`, although it makes sense.

<!--kg-card-end: markdown-->
Understanding the DeFi. Introduction
Published: 2020-06-10 20:26:43

Defi typically known as Decentralized Finance or Open Finance aims to take all financial services and putting them in a Blockchain. It provides services like lending, trading, insurance, and more.

# BUT WHY?

Taking example of the current situation of the centralized banking system, suppose you deposite some amount of money to receive interest. The Bank will take your money and will lend it to someone else and will receive a higher amount of interest.

It breaks the transparency as you don't know what is happening to your money. You trust banks as a third party which increases privacy concerns.

Now, Think of a way by which you can use all the services provided by a bank without a bank as an intermediary. You always know how your money is used. The solution is Defi which does the same but in a more sophisticated manner and build even more complex financial system.

#Understanding the Ecosystem 🧐🧐

Defi can be better understood by features.

### Permissionless

This means it is open to everyone and anybody can participate with any specific permission.

### Decentralized

The Code of entire Dapps built using principles of Defi is open-source and accessible to everyone. It is distributed and creates the proper peer to peer environment for everyone to use.

### Transparent

As soon as you lend some crypto to anyone. You will be able to keep an eye for what your money is used for. It may invade privacy but all the transactions are pseudonymous. Hence, no personal details are broadcasted to Blockchain.

### Programmable

It is one of the fundamental things by which Defi is even made possible to us. Dapps are programmed on Ethereum Blockchain as it is flexible and scalable.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6unli94wtn3i1ehmqwfk.png)
Taking a look at the dashboard of DeFi Pulse.

We can observe the amount of money locked in Defi Dapps. Also observe the different types of Applications like based on a particular purpose like lending, derivatives, assets, and more.

# What are these categories?🤔🤔

### NOTE:

> This will be a series for understanding everything about Defi. So, follow along to see what
revolutionary impact it can bring to current Digital Banking services.
Inspector joins Nana Bianca, the Italian startup accelerator
Tags: startup, webdev, motivation
Published: 2020-06-10 20:23:31

Hi, I'm Valerio, software engineer and CTO at Inspector.

I'm so proud to announce today that Inspector is now backed from [Nana Bianca](https://nanabianca.it/?lang=en), a startup accelerator in Florence, Italy.

The market reaction to Inspector has been positive from day one, so find the best way to grow our product and the technical support for our customers was a natural next step for us.

We have identified a clear pain for software developers around the world:

> Be the first to know if your application is in trouble before your users stumble onto the problem, automatically, without wasting time on manual checks.

As developers ourself we know that software development is a time consuming job, so just like us you are probably always looking for clever tools to intelligent automate some parts of your work to spend your time on more valuable activities, like design and release new features and grow your business instead of time consuming, repetitive manual checks.

With this new partnership we aim to develop the most easy and effective monitoring tool on the market to help developers around the world to avoid losing customers due to technical problems in their applications.

## Why Nana Bianca?

Nana Bianca was founded in 2013 from Paolo Barberis, Jacopo Marello and Alessandro Sordi, three of Dada founders who spent the last 20 years collaborating to finance and support dozens of Italian and foreign companies in growth.

Nana Bianca is focused on SaaS business acceleration, so it should be the best environment in Italy where to grow our company and also Florence is one of the most beautiful cities in the world 😄.

## What does this mean to you?

The company has now more resources to make a better product and to create the best customers support that developers can find out there!
In a nutshell, support your team to achieve better results in less time and with less effort.

Furthermore your direct feeback steel the most important resource for us, to better understand your needs and solve your real pains.

## Conclusion

I just want to say thank you to all our customers from Singapore to New York, from Amsterdam to Hong Kong, who believed in Inspector since the beginning that helped us to do better and better with their feebacks and advices.

Thank you so much for reading it, if you want know more about Inspector come on our website [https://www.inspector.dev](https://www.inspector.dev). Don't hesitate to share your thoughts on the comment below or drop in live chat! Let's make it together.

- Homepage: [https://www.inspector.dev](https://www.inspector.dev)
- Facebook: [https://www.facebook.com/inspector.realtime/](https://www.facebook.com/inspector.realtime/)
- Twitter: [@inspector_rt](https://twitter.com/Inspector_rt)
- Contact me: [valerio@inspector.dev](https://www.inspector.dev)
How to find a count of specific character in a string and take out dynamic value out of a repeating {{}} character in JavaScript
Tags: javascript, regularexpressions, coding
Published: 2020-06-10 20:10:18

I was working in JavaScript since last year,I have taken in a great experiences from various situations,As a developer we are facing new scenarios everyday and learning new things with every rising sun, Like yesterday i was supposed to solve a problem to find a count of specific character {% raw %} {{}} {% endraw %}repeating in my string and to catch a value in it which will always be different depends on user input.

##Problem 1: Finding the count {% raw %} {{}} {% endraw %} this in my string
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/vojk8ii4lu6437r51sle.PNG)

It will first finds that either two curly brackets  opening at the same time then it will return an array contains all the possible matches .The g in it is the parameter of Regular Expression it  will search globally.


##Problem 2 : Taking the dynamic values out of {% raw %} {{}} {% endraw %}  from a string based on user input 

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

In this case i have applied this function on my input box if its value changes, the function checks that if curly brackets occur then it will return an array.
If there will be one match found then it will return the value in array with an index[0] but if there may be more than one match found it was returning an array with first match at index 0 and then two empty strings on index 1 and index 2 and then second match on index 3,it repeats this behavior after every match , So that's why i applied a loop with i+=3 at every iteration it will take a step of 2.

May be it was an expensive method  but it solved my problem,As I have not worked much with Regular Expressions so that's why may be it was scrambled and time taken process but it worked for me.

Hope you find this article useful. Please share your thoughts or if there is any method by which this can be done easily in the comment section.

Thanks
Get the Current Directory in node.js
Tags: javascript, node
Published: 2020-06-10 19:52:42

> These quick tips are small snippets that come up again and again in my work, for which I want a permantent and central place to retrieve them.

Here's the situation: You want your node script to interact with a file that is relative to its location. To do that, you need a way to determine that location.

To get the absolute path to a module, you can use the global `__dirname` variable.

For the follwing snippets, suppose you run the module `/home/urname/code/script/main.js`

```javacript
// this will print '/home/urname/code/script'
console.log(__dirname)
```

If you want the filename included as well, `__filename` will do the trick.

```javacript
// this will print '/home/urname/code/script/main.js'
console.log(__filename)
```

#Get the current working directory

Since it fits the topic somewhat, here's a small bonus: If you want to get the directory from which you *called* the script, you can use `process.cwd()` to do that.

Suppose you call `/home/urname/code/script/main.js` from the command line while you are inside `/home/urname/code/temp`:

```javacript
// this will print '/home/urname/code/temp'
console.log(process.cwd())
```

#Get the directory of the main script

Finally, if you write a plug-in and need to know the path of the main script, you can use `require('path').dirname(require.main.filename)`.

#Sources
https://attacomsian.com/blog/nodejs-get-current-directory
https://stackoverflow.com/questions/9080085/node-js-find-home-directory-in-platform-agnostic-way
https://stackoverflow.com/questions/3133243/how-do-i-get-the-path-to-the-current-script-with-node-js
Understanding my privilege.
Tags: a11y, books, html, webdev
Published: 2020-06-10 19:39:24

Whilst I'm currently in the process of reading the book [Accessibility for Everyone](https://abookapart.com/products/accessibility-for-everyone) by [Laura Kalbag](https://laurakalbag.com/). I have noticed that my knowledge of accessibility is near zero.

My own experience with accessibility features amounts to using mouse and keyboard in combination with <kbd>TAB</kbd> for quickly accessing links on a page, so reading this book has certainly given me new perspective on how users navigate their way across the internet.

## Looking back the years.

During my years as web developer I've installed countless plugins to test for accessibility, visual impairments, valid structure and most anything else that can be tested using bots - as long as my pages got green I thought I was golden.

**I was wrong.**

Thinking back on when I first learned about accessibility and <abbr title="Web Content Accessibility Guideline">WCAG</abbr> I must admit I was to immature in my understanding off standards and guidelines that I only ever skimmed through it thinking I understood them.

What I had learned throughout the years on blog posts and forums about HTML structure has been wrong. Most of what I've read focuses on SEO - that has been a hot-topic for years. I cannot remember when or where I learned this tricks, or if I simply misunderstood what I read, but for years I have been using <abbr title="Alternative text">alt text</abbr> on images to add keywords for better search.

```html
<img src="example.com/image.png" alt="example, search, keywords" />
```

Not using it for it's intended purpose which is to describe what is on the image in the event the image cannot be loaded.

> the value of the alt attribute provides equivalent content for those who cannot process images or who have image loading disabled

Quote taken from a snippet of [the img element](https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-alt) section of [HTML Living Standard](https://html.spec.whatwg.org/multipage/).

### Doing better.

Going forward in my career I plan to-do better, to learn more, to be more understanding, and to above all else widen my understanding that the way I navigate the web isn't the end all be all, I still have a lot more learn about accessibility and how to implement a better standard in my work.

So to end off this jumbled post of scattered thoughts I ask you - yes you, you who is more knowledgeable then me.

Where do I go now? What should I read or listen to too further my knowledge?
GitHub Bash API
Tags: github, bash, api
Published: 2020-06-10 19:32:47

I'm writing [Bash scripts](https://github.com/MarounMaroun/github-bash-api) for the [GitHub API](https://developer.github.com/v3/) in Bash.

This repo aims to expose basic functions for using the GitHub API in Bash, without any dependency on GitHub CLI tools.

You can copy any of the functions and use it wherever you want. For example, in your own GitHub action script.

## Usage

Each file aggregates functions that are relevant for the specific API.

For example, the `pull_request.sh` script have functions that expose the [Pull Requests API](https://developer.github.com/v3/pulls/).

You can test each function by simply calling it inside the file. For example, to get the PRs count in some repository, you can call the `prs_count` function in the `pull_requests.sh` file, and then execute:

```bash
./pull_request.sh <token> <owner> <repo>
```

Which yields the number of PRs for the given repository.

I hope you find it useful! Your input is highly welcomed and appreciated.

Link to the repository: https://github.com/MarounMaroun/github-bash-api
Rails 6 - using images with webpacker and asset pipeline
Tags: rails, webpack, assetpipeline
Published: 2020-06-10 19:25:07

## Introduction:

Rails 6 by default now bundled with webpacker. Developers have choice to go for webpacker alone to use the images, css and js.

But there are cases where developers have to use both asset pipeline and webpacker.

The post is about how to deal these two things together, especially for the images.

#### Step: 1 - update application layout to include stylesheet_pack_tag

```ruby
   <head>
     <%= stylesheet_link_tag 'application', media: 'all' %>
     <%= stylesheet_pack_tag 'application', media: 'all' %>
   </head>
```
#### Step: 2 - create folder structure as follows in `app/javascript`
  
```shell
app/javascript/
├── channels
│   ├── consumer.js
│   └── index.js
├── images
│   ├── 1.jpeg
│   ├── 2.jpeg
│   └── 3.jpeg
├── packs
│   └── application.js
└── src
    ├── custom.js
    └── stylesheets
        ├── _custom.scss
        └── application.scss
```

> *Assume we have few images 1.jpeg, 2.jpeg, 3.jpeg in `images`
  folder.*

#### Step: 3 - update `src/stylesheets/application.scss` as follows
```css
@import '_custom';
```
#### Step: 4 - update `packs/application.js` as follows
```javascript
require("@rails/ujs").start()
require("@rails/activestorage").start()
require("channels")

// add these 2 lines
import 'src/stylesheets/application'
const images = require.context('../images', true)
```

#### Step: 5 - update `config/webpacker.yml` as follows
```javascript
default: &default
...
...
// update: resolved_paths: [] as follows
resolved_paths: ['app/javascript/images', 'app/assets/images']
...
```

Now we are good to use images from both folders `app/assets/images` and `app/javascript/src/images`. 

#### 1. Using images in webpack css file (here: app/javascript/src/stylesheets/_custom.scss)

```css
/* assume 1.jpeg present in app/javascript/src/images folder */
body{
  background-color: green;
  background-image: url("~1.jpeg");
}

/* assume lake.jpeg present in app/assets/images folder */
div{
  background-color: red;
  background-image: url("~lake.jpeg");
}
```
> That's all. Now we can use both asset pipeline images and 
webpack images together in our css.


#### 2. Using images in rails views
```ruby
# This is how we need to call image from app/javascript/src/images/2.jpeg path
<%= image_pack_tag "media/images/2.jpeg" %>
```
```ruby
# This is normal way to call image present in app/assets/images folder.
<%= image_tag "lake.jpeg" %>
```

> Note: In case if we need to share a same image between asset pipeline and webpack, then it is good to place the image in app/assets/images folder itself. It makes our life easy to call them in both asset pipeline css, views and webpacker js or css easily.
Detect Faces in Video using OpenCV
Tags: 100daysofcode, opencv, python, learning
Published: 2020-06-10 19:22:49

---
title: Detect Faces in Video using OpenCV
published: true
description: A Python script to detect faces in video using opencv
tags: #100daysofcode,#opencv,#python,#learning
cover_image: https://github.com/ganeshraja10/100daysofCode/raw/master/day_2_open_cv_face_dectection/sample_face.png
---

So, Today I wanted to experiment with Simple OpenCV. So that the following script does is, 
it loads the video from the disk, checks for face shape in every frame using the loaded cascade. if it finds an image, it draws a rectangle around it and displays the image. Unfortunately, it only detects frontal faces. 

You can find the code to do this below

You can find my Repo Link here
https://github.com/ganeshraja10/Latest-Tech-Learnings

```python
import cv2
# loading haarcascade to detect frontal face
cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')

video = cv2.VideoCapture('data/avengers.mp4')  # Load video

while True:
    rect, img = video.read()  # Read the video
    if not rect:
        break
    # Convert RGB to Gray to detect edges
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    faces = cascade.detectMultiScale(gray, 1.35, 7)  # Detect possible faces
    if faces is not ():  # List is not empty
        for x, y, w, h in faces:  # Draw Rect in all faces
            cv2.rectangle(img, (x, y), (x+w, y+h), (127, 0, 255), 2)
    cv2.imshow('img', img)  # Display the image
    k = cv2.waitKey(30)
    if k == 27:  # if key pressed is escape quit
        break

video.release()  # release the video

```
How to encourage interaction on dev.to posts?
Tags: discuss, writing, beginners, question
Published: 2020-06-10 19:19:35

---
title: How to encourage interaction on dev.to posts?
published: true
description: 
tags: discuss, writing, beginners, question
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/w14l9yddz1nqrnvo3xfe.jpg
---

After a few years of being inactive on dev.to, I've started actively posting about a month ago.

I see quite a few visits to some of my posts (up to nearly 400 views for some), but I get absolutely no comments (unless it's a small post with the `#discuss` tag).

Is that normal? Is there a way on dev.to to drive more reactions/interactions? Is it the subject (mainly DevOps/SRE-related) that is not core to this platform?

Am I missing something?
Road to Genius: beginner #7
Tags: javascript, computerscience, beginners
Published: 2020-06-10 19:03:45

Each day I solve several challenges and puzzles from Codr's ranked mode. The goal is to reach genius rank, along the way I explain how I solve them. You do not need any programming background to get started, but you will learn a ton of new and interesting things as you go.

In this post I'll cover two challenges because the first one is a quick one:

![programming challenge 1](https://dev-to-uploads.s3.amazonaws.com/i/yjv2wx0pe9r3naocraa4.png)

The first challenge requires us to figure out `R`'s initial value (☃️). But because this value gets overwritten later in the code, so the initial value doesn't matter. But it must be a boolean to pass our validation criteria, so either `true` or `false` are correct.

![programming challenge 1 answer](https://dev-to-uploads.s3.amazonaws.com/i/lm8xvzhg7hsamr6ee5gu.png)

Let's proceed to the next challenge:
![programming challenge 2](https://dev-to-uploads.s3.amazonaws.com/i/bb5y8fvjtv8d23fl1zm4.png)

This one is a bit more exciting. We need to figure out 😈 and ☃️, both identifiers, such that `R=11`. To find 😈 you need to analyze the for-loop, it contains a variable `N` which hasn't been declared yet, so 😈 is most likely going to be `N`. The identifier for ☃️ doesn't matter much, because if you look at the last line of code `R=arr.length`, the challenge is only interested in the number of items in the array, not what those values actually are. So ☃️ should ideally be `N` or `i`.

![programming challenge 2 answer](https://dev-to-uploads.s3.amazonaws.com/i/lyrd0abix8kh3nfg08m2.png)

---

If you feel inspired and motivated to upgrade your coding + debugging skills, join me on the Road to Genius at https://nevolin.be/codr/