teleren/devto huggingface dataset:
Tutorial: How to Run Python via URL
Tags: python, tutorial
Published: 2020-04-09 13:48:39

##Introduction

We're building a rapid platform *for developers* called WayScript. We'd love your feedback. 

WayScript makes it easy to run python code whenever you access a url. By allowing access to an http trigger, we can activate entire workflows at the visit of a specific url. Whether you're building a system that pulls the most current information from a database, or something simple like a randomized password generator, I hope you see the power in this functionality.

##Running a Script when Visiting a URL

We're able to activate a lot more than just an HTTP response whenever we visit a url. We can activate entire workflows! The possibilities are limitless due to our large number of modules you can integrate, but let's keep it simple in this tutorial and look at how we can automate running python whenever you visit a URL.

To get started, we'll need to place in a HTTP trigger and activate it. This will provide a URL for us to run our script.

![Alt text of image](https://cdn.wayscript.com/blog_img/71/1.png)

The endpoint will be provided in the settings and we can choose to password protect this if we want to.

##Working with Python

Next, we can drag in the modules and create the workflow that we want to execute whenever someone visits this url. We'll place a python module below the http trigger

![Alt text of image](https://cdn.wayscript.com/blog_img/71/2.png)

Once we place the python module, we have access to the built in platform editor. Let's create something like a password generator, that we'll return the result of to a webpage. Our code might look something like this:
<pre class=highlight python>
import string
from random import *

characters = string.ascii_letters + string.digits + string.punctuation

password = "".join(choice(characters) for x in range(randint(8,16)))

print(password)

variables['password'] = password
</pre>

We're just creating a randomized string here to pass to a webpage, but this could be anything. We could pull from databases, the internet, or anywhere else and process it all with this one python module.

##Creating a Webpage & Response

Once we pass the output using the variables dictionary in the last line of python code above, we can access it all throughout our script. We'll drag this variable into our html code and then pass this html as a response with a configuration like this:

![Alt text of image](https://cdn.wayscript.com/blog_img/71/3.png)

Hope you enjoyed this a video can also be found on our website. Also, WayScript is in Beta and Signup is currently free for all of our friends at DEV.to.
I think Dev.to needs a Pastel theme
Tags: design, watercooler, discuss
Published: 2020-04-09 13:45:01

Hello,
I am just writing because as a girl passionate about all that is cute and that doesn't love bright pink, I think Dev.to should have a pastel theme.

Random? yes
Superficial? Of course! 
But it would make me happy and other people I am sure lol
let vs const in JavaScript
Tags: javascript, programming, computerscience
Published: 2020-04-09 10:29:59

**Let**
A block is a chunk of code bounded by {}. A block lives in curly braces. Anything within curly braces is a block.
A variable declared with let can be updated within its scope. Unlikevar, a let variable cannot be re-declared within its scope. 
    let text= "say Hi";
    text= "say Hello instead";

this will return an error.

  let text= "say Hi";
    let text= "say Hello instead";//error: Identifier 'text' has already been declared

However, if the same variable is defined in different scopes, there will be no error.

**Hoisting of let**
Just like var, let declarations are hoisted to the top. Unlike var which is initialised as undefined, the let keyword is not initialised. So if you try to use a let variable before declaration, you'll get a Reference Error.

**You can redefine variables created with let but without using let key word**

**Const**

Variables declared with the const maintain constant values. const declarations share some similarities with let declarations

**const declarations are block scoped**
const declarations can only be accessed within the block they were declared.

**const cannot be updated or re-declared**
This means that the value of a variable declared with const remains the same within its scope. It cannot be updated or re-declared. So if we declare a variable with const, We can neither do this

const text= "say Hi";
text= "say Hello instead";//error : Assignment to constant variable.

                        **nor** 
const text= "say Hi";
const text= "say Hello instead";//error : Identifier 'text' has already been declared

**Every const declaration, therefore, must be initialised at the time of declaration.**


**Hoisting of const**

Just like let, const declarations are hoisted to the top but are not initialised.

-var declarations are globally scoped or function scoped while let and const are block scoped.

-They are all hoisted to the top of their scope. But while var variables are initialised with undefined, let and const variables are not initialised.

-While var and let can be declared without being initialised, const must be initialised during declaration.

-var variables can be updated and re-declared within its scope; let variables can be updated but not re-declared; const variables can neither be updated nor re-declared.
Takeaways from the State of Serverless Report
Tags: serverless, aws, dynamodb, lambda
Published: 2020-04-14 12:32:31

---
title: Takeaways from the State of Serverless Report
published: true
date: 2020-04-09 13:35:30 UTC
tags: serverless,aws,dynamodb,lambda
canonical_url: https://www.jeremydaly.com/takeaways-state-of-serverless-report/
---

On a recent episode of Serverless Chats, I spoke with Stephen Pinkerton and Darcy Rayner of Datadog to dig into The State of Serverless report, which was released at the end of February 2020. After frequently fielding customer questions about the topic, Datadog looked at its data and customer use cases, and examined how they were using serverless. … [Continue reading "Takeaways from the State of Serverless Report"](https://www.jeremydaly.com/takeaways-state-of-serverless-report/)

The post [Takeaways from the State of Serverless Report](https://www.jeremydaly.com/takeaways-state-of-serverless-report/) appeared first on [Jeremy Daly](https://www.jeremydaly.com).
How to Make a Icon + Text Navbar in Bootstrap
Tags: bootstrap, html, webdev, css
Published: 2020-04-09 13:33:19

---
title: How to Make a Icon + Text Navbar in Bootstrap
published: true
description: Create a responsive Navbar with text below icons that shows only icons on mobile
tags: bootstrap, html, webdev, css
---

Just when I thought I had the answer for [*every* possible Navbar scenario](https://www.codeply.com/p/yE87h7irNi) in Bootstrap 4, up pops another StackOverflow question, on "How can I make a Navbar that... ?"

In this case I want to make a Navbar that has icons &amp; text. The text will be centered below each icon, and on mobile *only* the icons will display.

Mobile view
===
![mobile navbar](https://dev-to-uploads.s3.amazonaws.com/i/ugyz8u44qxwhzvoxetyy.png)


***


Large view
===
![navbar](https://dev-to-uploads.s3.amazonaws.com/i/nzzsjuakz7y260tupz3f.png)


For the icons I used **Font Awesome**, but of course there are many other alternatives including the [new icons from Bootstrap](https://icons.getbootstrap.com/)😏. The Navbar structure is standard, with the exception of using the `nav-justified` and `w-100` classes to on the `navbar-nav` to make items space evenly on the page:

```
<nav class="navbar navbar-dark navbar-expand justify-content-center">
    <div class="container">
        <ul class="navbar-nav nav-justified w-100 text-center">
            ... (repeat nav items here)
        </ul>
    </div>
</nav>
```

For each `nav-item`, I used flexbox (`d-flex flex-column`) to make the icon & text stack vertically. Using Bootstrap's [responsive display classes](https://getbootstrap.com/docs/4.4/utilities/display/#how-it-works), the text is hidden on mobile (`d-none d-sm-inline`).

Take a closer look at each `nav-item`🧐...

```
<li class="nav-item">
     <a href="#" class="nav-link d-flex flex-column">
         <i class="fab fa-bootstrap"></i>
         <span class="d-none d-sm-inline">home</span>
     </a>
</li>
```

**And that's all there is to it ¯\_(ツ)_/¯**

[Demo😎] (https://codeply.com/v/yE87h7irNi/icons-text)
[Full source🤓](https://codeply.com/p/yE87h7irNi/icons-text)
30-Day LeetCoding Challenge: Middle of the Linked List
Tags: python, leetcode, coding, algorithms
Published: 2020-04-09 13:08:37

---
title: 30-Day LeetCoding Challenge: Middle of the Linked List
published: true
description: the 8th-day problem of 30-Day LeetCoding Challenge
tags: python,leetcode,coding,algorithms
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/25t5avx3gskybr7y10lt.jpg
---
### [The Problem](https://leetcode.com/explore/challenge/card/30-day-leetcoding-challenge/529/week-2/3290/)
****
## Solution:

The problem is so straightforward and so clear it asks us to return the middle node, with one condition if there is two middle numbers return the second one.

If we think about it for a minute the two middle numbers only happen when the length of the array is **even**, but the fact is if we do integer division for `len(arr) // 2` to get the middle number it will always give you the correct middle number, let's see it:

If we have `arr = [1,2,3,4,5]` then the middle number will be at `len(arr) // 2 = 5 // 2 = 2` so it will be **`arr[2] = 3`** which is the correct middle number.

What if it is even `arr = [1,2,3,4,5,6]` so it will be `len(arr) // 2 = 6 // 2 = 3` so ... **`arr[3] == 4`** which is the second middle number.

This should make the problem now easier so what we will do now based on the above we just want to put all our **linked-list nodes** in an **array** then return the middle node in that array (`return nodes[len(nodes) // 2]`).


* **Example:**

`lked_list = 1 --> 2 --> 3 --> 4 --> 5`
`head -> 1`

 * First we will have `nodes = []` array to store our nodes there.

 * We need to start from the `head` and keep looping until the end and keep pushing to the array the elements

 * So, at end our nodes array will be like this: <br>
 `nodes = [{val: 1, next: ->}, {val: 2, next: ->}, {val: 3, next: ->}, {val: 4, next: ->}, {val: 5, next: None}]`

 * No our answer will be `ans = nodes[len(nodes) // 2] = nodes[5 // 2] = ndes[2] = {val: 3, next: ->}`.

 * **Pseudocode:**

 ```
 1. define nodes = []
 2. loop as long as head != None
 3.   nodes.append(head)
 4.   head = head.next
 5. return nodes[len(nodes) // 2]
 ```

 * **Complexity:**

 * Time Complexity: It is so clear we only do one loop to build our `nodes` array so it will be **O(n)** where **n** is the number of nodes in the list.

 * Space Complexity: it is clear that we use extra space to store all our list nodes in an array and this will cost us **O(n)** where **n** is the number of nodes in the list.

 * **[Solution in python](https://github.com/AhmedRaafat14/Leetcode-problems/blob/master/30-Day-LeetCoding-Challenge/middle-of-linked-list/Solution.py)**

> There is an optimal space solution try to find it out yourself :).
Daily Challenge #222 - Parse Bank Account Numbers
Tags: challenge
Published: 2020-04-09 12:56:18

---
title: Daily Challenge #222 - Parse Bank Account Numbers
published: true
series: Daily Challenge
description: Turn these weird strings into numbers!
tags: challenge
---
You work for a bank, which has recently purchased an ingenious machine to assist in reading letters and faxes sent in by branch offices.

The machine scans the paper documents, and produces a string with a bank account that looks like this:
<pre>
    _  _     _  _  _  _  _
  | _| _||_||_ |_   ||_||_|
  ||_  _|  | _||_|  ||_| _|
</pre>
... why did we buy this machine?

Anyway, your task is to write a function that can take bank account string and parse it into actual account numbers.

**Example**
<pre>
 _  _  _  _  _  _  _  _  _ 
| | _| _|| ||_ |_   ||_||_|     => 23056789
|_||_  _||_| _||_|  ||_| _|
</pre>

**Tests**
<pre>
 _  _  _  _  _  _  _  _  _ 
|_| _| _||_||_ |_ |_||_||_| 
|_||_  _||_| _||_| _||_| _|

  _  _     _  _  _  _  _
| _| _||_||_ |_   ||_||_|
||_  _|  | _||_|  ||_| _|
</pre>

Good luck!
***
_This [challenge](https://www.codewars.com/kata/597eeb0136f4ae84f9000001) comes from arhigod on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
Mid Meet Py - Ep.2
Tags: python, news, community, opensource
Published: 2020-04-09 12:52:28

---
title: Mid Meet Py - Ep.2
published: true
description: We meet in the middle of the data in the middle of the week to chat about Python
tags: Python, news, community, open-source
---
[PyCon US go online](https://python.us19.list-manage.com/track/click?u=5697f493c3a48994f504d4deb&id=e8f98ba7ce&e=01fe521e01)! Subscribe to their [YouTube channel to catch all the talks](https://python.us19.list-manage.com/track/click?u=5697f493c3a48994f504d4deb&id=8535f39b4c&e=01fe521e01)

PyLadies also has [YouTube Channel](https://www.youtube.com/c/PyLadies), [Sign up for membership](https://t.co/L7Dsrmx7Xs?amp=1)

Python Ireland's 1st meetUp is tonight talking about [App Performance Monitoring in Python](https://www.meetup.com/pythonireland/events/fnzvknybcgblb/
    ).

PyCon Australia and PyCon Africa are also going online, details to be announced.

Scikit-image join NUMFocus!](https://numfocus.salsalabs.org/numfocusnewsletter_december2019_copy1_copy1_copy1?wvpId=1f958e36-9e22-4880-9ed6-8ce75d6596f9)

PyPI Highlight:

Foxdot  - Make music with Python - <https://foxdot.org/>

FastAPI - a high-performance framework, easy to learn, and fast to code - <https://fastapi.tiangolo.com>
# Windows ortamında NodeJS Javascript Out of Memory Problemi
Tags: javascript, outofmemory, windows, node
Published: 2020-04-09 12:38:58


ReactJS ile yazmaya devam ettiğimiz bir UI kütüphanesi projesi için, dökümantasyon yazma gereği hissedik ve bunun için [https://www.docz.site/](https://www.docz.site/) kullanmaya karar verdik. 

Harika bir kütüphane,  [https://www.gatsbyjs.org/](https://www.gatsbyjs.org/) alt yapısını kullarak, hızlı bir şekilde bir websitesi hazırlayabiliyorsunuz.

Gelelim problemimize, yaklaşık 65 sayfa döküman oluşturduk. GatsbyJS SSR ile siteyi oluşturduğu için bir süre sonra Javascript Out Of Memory ( Heap Memory ) almaya başladık.  İnternetdeki aramalarımızda,  developerların sıkça aldığını gördük. Biz geliştirmeyi **windows** ortamında yaptığımız için, hali ile internetteki verilen çözümlerde OS belirtilmiyor genelde. 

Bu problemi aşağıdaki şekilde çözebilirsiniz.  
**node_modules/bin** klasörü içinde yer alan `docz.cmd` ve `gatsby.cmd` dosyalarını açın  ve `"%_prog%"` ifadesinin yanına `"--max_old_space_size=8192"` aşağıda olduğu gibi.  

```bash
@ECHO  off
SETLOCAL

CALL :find_dp0
IF  EXIST  "%dp0%\node.exe"  (
  SET  "_prog=%dp0%\node.exe"
)  ELSE  (
  SET  "_prog=node"
  SET  PATHEXT=%PATHEXT:;.JS;=;%
)

"%_prog%"  "--max_old_space_size=8192" "%dp0%\..\docz\bin\index.js" %*

ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET  dp0=%~dp0
EXIT /b
```

Eğer direk `node index.js` gibi bir ifade ile nodejs modulunüzü çalıştırıyorsanız `node index.js --max_old_space_size=8192` şeklinde değiştirmeniz yeterli olacaktır

<!--stackedit_data:
eyJoaXN0b3J5IjpbLTExMjczNzIzNDgsLTQwMTkxMDA5OV19
-->
GitHub Actions - Automate your Workflows
Tags: podcast, github, devops
Published: 2020-04-23 06:55:23

---
title: GitHub Actions - Automate your Workflows
published: true
date: 2020-04-09 12:00:00 UTC
tags: podcast, Github, DevOps
canonical_url: https://share.transistor.fm/s/626ab803
---
{% spotify spotify:episode:3fXmqFBmIR1kX3ECzqAOyi %}

GitHub Actions - [https://github.com/features/actions](https://github.com/features/actions)  
GitHub Actions Documentation - [https://help.github.com/en/actions](https://help.github.com/en/actions)  
GitHub Actions Usage Limits - [https://help.github.com/en/actions/getting-started-with-github-actions/about-github-actions#usage-limits](https://help.github.com/en/actions/getting-started-with-github-actions/about-github-actions#usage-limits)  
  
GitHub Actions Marketplace  
Greetings Action Example - [https://github.com/vegasbrianc/prometheus/blob/master/.github/workflows/greetings.yml](https://github.com/vegasbrianc/prometheus/blob/master/.github/workflows/greetings.yml)  
Action Netlify Example - [https://github.com/marketplace/actions/deploy-to-netlfiy](https://github.com/marketplace/actions/deploy-to-netlfiy)  
Docker Action Build & Push - [https://github.com/marketplace/actions/build-and-push-docker-images](https://github.com/marketplace/actions/build-and-push-docker-images)
Some Software engineering Concepts 
Published: 2020-04-09 11:57:13

Lately, I have been taking some software engineering classes to combine  the knowledge with my data science skills

These are some of the concepts I have picked up so far
- **Refactoring**: This means restructuring your code to improve the internal structure without changing external functionality. In other words, rearranging your code to improve efficiency and readability without change the purpose or the original functions of the code. This includes cleaning your code by using descriptive but concise variable names and decluttering the lines of codes in a function as well as using appropriate white spaces. It also includes proper documentation, be it an inline-level, function/module level or project level

- **Modularization**: This means converting your codes into modules based on their functionalities. Someone once told me that "similar functions should be grouped together". This helps for each module to be independent in function, improve readability and reusability for future references

- **Test-Driven Development**: This is the process of writing tests for tasks before developing or writing the code to implement those tasks. **This is such an abstract technique in data science and it would be nice to practice this.**

One thing to keep in mind is: _Classes, inheritance, object, attributes, and methods are common to all object-oriented programming language_

If one were to think about python concepts ( like packages, modules, functions, etc) in a hierarchical method, I would say it would look like this below (from small to big)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/sy7bo54jsl8oer1nsihe.png)
Infographics: 12 Web development Side Project ideas
Tags: webdev, beginners, programming, sideprojects
Published: 2020-04-09 11:53:19

I created two posts on best web development side project ideas and got an amazing response.

-   [Web development Side Project Ideas Part 1](https://holycoders.com/full-stack-web-development-coding-project-ideas/)
-   [Web development Side Project ideas Part 2 on dev.](https://dev.to/digvijaysingh/best-side-project-ideas-for-web-developers-1ghe)

Texts are boring and anyone can easily forget them so I decided to create a visual list of web development project ideas.

## Web development Side Projects Infographics

![Best web development side project ideas infographics](https://user-images.githubusercontent.com/35258289/78891310-f00ee080-7a84-11ea-9205-76c6ec06930f.png)



This post first appeared on [HolyCoders](https://holycoders.com/infographics-web-development-side-projects/).
Spring Afternoons and Completed To-Do's
Tags: codenewbie, womenintech, devjournal
Published: 2020-04-09 11:47:08

Happy Thursday afternoon! We just finished up a wonderful lunch out on our balcony. Sunny, breezy, peaceful - everything good about a spring afternoon. I'm grateful.

Yesterday, I finally buckled up and crossed off two of this week's items from the list. First, I added the 'Previous Editions' section to my [Letters from Nelson](https://lettersfromnelson.com/) landing page.

This'll give prospective subscribers a chance to see what the newsletter has to offer - always a good thing when considering signing up for any newsletter, I think.

The second thing I did was to add the entire [Letters from Nelson](https://lettersfromnelson.com/) project to my portfolio itself (hint: just click on the Projects tab above to check that out).

On days when you're just not feelin' it, *the* most important thing you can do is to make the decision to show up.

If you're wanting to go for a run, make the decision and then squeeze yourself into your sports bra.

If you're wanting to code something, make the decision and then open your text editor and code one thing.

If you're wanting to blog everyday, make the decision and then sit down day after day and write literally whatever's on your mind.

The last couple of days, I was so putting off my to-do list items, and then I just *made the decision* to show up, sat down and got to work. A couple of focused hours later and voilà! Mission(s) accomplished!

_This post was originally published on April 9, 2020 on [my blog](https://alexlsalt.github.io/blog)._
6 Awesome JavaScript Snippets to read and learn from!
Tags: javascript, codenewbie
Published: 2020-04-09 11:35:19

When I was a JavaScript newbie, I used to read a lot of code snippets.

**Reading other people's code teaches us a lot.** So, I make sure I read and understand a code snippet every day and I also share them on Twitter!

So, here are a few code-snippets I have read in the past few days!

## 1. Convert RGB colors to Hex Codes

{% twitter 1243524685041565696 %}

**Here's the gist** 🚀 https://github.com/30-seconds/30-seconds-of-code/blob/master/snippets/RGBToHex.md

## 2. Find the length of a string in bytes

{% twitter 1244879084733128705 %}

**Here's the gist** 🚀 https://github.com/30-seconds/30-seconds-of-code/blob/master/snippets/byteSize.md

## 3. Detect all kinds of Apple Devices

{% twitter 1245198695991132160 %}

## 4. Find factorial of any number

{% twitter 1247021981842595843 %}

**Here's the gist** 🚀 https://github.com/30-seconds/30-seconds-of-code/blob/master/snippets/factorial.md

## 5. Function to deep clone an object

{% twitter 1245585507674812421 %}

**Here's the gist** 🚀 http://bit.ly/deepclone

## 6. Convert any string into Camel Case

{% twitter 1246672081296576512 %}

**Here's the gist** 🚀 https://github.com/30-seconds/30-seconds-of-code/blob/master/snippets/toCamelCase.md

---

# 🔥 There are many more online!

[30 Seconds Of Code](https://github.com/30-seconds/30-seconds-of-code/) is a very awesome nifty project that has tons of JavaScript Snippets to look at! They have CSS Snippets as well. 🤩

---

## 🏆 About me

I am **Kumar Abhirup, a 16-year-old JavaScript React developer** from India who keeps learning a new thing every single day.

[Connect with me on Twitter 🐦](https://twitter.com/kumar_abhirup)
[My personal website and portfolio 🖥️](https://kumar.now.sh)

_Comment below your better ways, and suggestions to improve this post. :)_