teleren/devto huggingface dataset:
May 17 — Daily CodeNewbie Check-in Thread
Tags: codenewbie, checkin, beginners, discuss
Published: 2020-05-17 16:43:32

---
title: May 17 — Daily CodeNewbie Check-in Thread
published: true
description: A daily thread to ask questions, share progress, and stay accountable!
tags: codenewbie, checkin, beginners, discuss
series: Daily Checkin
---

You are encouraged to use this daily thread to:
- Ask for help (all questions encouraged)
- Explore topics you’re curious about
- Share something you’ve written or read
- Celebrate your wins
- Stay accountable to your goals
- Support your fellow programmers

Happy Coding!

---

_Interested in joining the twice-weekly live [#CodeNewbie Twitter chats](https://twitter.com/search?q=codenewbie)?  You can find us [on Twitter](https://twitter.com/search?q=codenewbie) each Wednesday at 9pm ET (1am GMT on Thursday) and Sunday at 2pm ET (6pm GMT)!_
Animal Crossing: Isabelle's Day Off ☀️(Pure CSS)
Tags: codepen
Published: 2020-05-17 16:35:14

<p>After a hard day's work, Isabelle basks under the sun on this glorious spring day. </p>

<p>Animal Crossing is a game bringing so much merriment. Although I don't have a copy of New Horizons yet, I wanted to challenge myself by creating artwork inspired by the game! This was a fun way to practice isomorphic art with CSS. Enjoy and  stay well friends.</p>

<p>Timlapse: <a href="https://youtu.be/c0HTgIItRhc" target="_blank">https://youtu.be/c0HTgIItRhc</a></p>

{% codepen https://codepen.io/lapolinar0519/pen/Baoqeeg %}
R Programming - How to Access URL and Read Data with RcURL
Tags: rlanguage, rdatascience, tutorial, beginners
Published: 2020-05-17 16:04:01

Learn how to Access URL and [Read Data with RcURL package in R langauge](https://www.youtube.com/watch?v=_36bjAoAN-o). 

If you wish to read data from external file. And if that file happens to be on external location, then you can use rCURL package. This allows you to read the content from external location.

Below video shows how you can use rCURL package to read data from external URL.

{% youtube _36bjAoAN-o %}
handy Ruby methods #3 - Hash#fetch
Tags: ruby, heroku
Published: 2020-05-17 15:53:06

```ruby
class StripePaymentIntegration
  def self.enabled?
    ENV["ENABLE_STRIPE_PAYMENT_INTEGRATION"]
  end
end
```

This code isn't bulletproof. If it's not obvious - let me help you.

This is disabled by default. When we push to production, the app reboots.  There exists a small window where `ENABLE_STRIPE_PAYMENT_INTEGRATION` isn't set. The code *technically* isn't doing what you're expecting. 

*Why does the app reboot? Because Heroku dynos automatically restart with every new code release. [Here's a short description of Heroku dynos.](https://www.heroku.com/dynos/lifecycle)*

If only we can set a default value to avoid to ensure this is enabled when we push. It'd be even better if it was in pure Ruby.

```ruby
class StripePaymentIntegration
  def self.enabled?
    ENV.fetch("ENABLE_STRIPE_PAYMENT_INTEGRATION", "true")
  end
end
```

Voila! Understand that `ENV` serves as a *hash-like structure*. Thus, it can "fetch" a hash's value given a key. `Hash#fetch` takes a lookup key in the first parameter and an optional second as a fallback value.

You can deploy and now be sure this works correctly!

I believe you get the most out of a software language by writing it as it's meant to be written. One of the pillars writing good Ruby code is being expressive. 

`ENV.fetch("ENABLE_STRIPE_PAYMENT_INTEGRATION", "true")` comment below if that doesn't express what I'm puttin' down.
Odd Even Linked List - LeetCode
Tags: linkedlist
Published: 2020-05-17 15:42:44

---
title: Odd Even Linked List - LeetCode
published: true
description: 
tags: linked-list
---

Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.

Linked List is all about pointers/references. We need to have a visual of node and next to solve it

![Single Linked List](https://i.imgur.com/OsQRoSF.png)


If you observe above diagram, we need to create two linked list odd and even. Creating them is easy loop through the nodes and as you pass all you have to change the odd's next node to even's next node, because we want to skip even in oddHead and similarly even's next node to odd's next node

Here is the solution:

```js
/**
 * @param {ListNode} head
 * @return {ListNode}
 */
var oddEvenList = function(head) {
	// Handle edge cases
	if(head == null) return null
	let odd = head
	let even = odd.next
	let evenHead = even

	while(even != null && even.next != null) {
		// assign odd's next node to next odd node
		odd.next = even.next
		// move odd pointer to the next one
		odd = odd.next
		// assign even's next node to odd next node
		even.next = odd.next
		// move even pointer to the next node
		even = even.next
	}
	// now attach evenHead to the end of odd node
	// Why evenHead because even points to null as we loop
	odd.next = evenHead
	return head
};
```
What’s your alternative solution? Challenge #45
Tags: challenge, javascript, codenewbie, learntocode
Published: 2020-05-17 15:39:57

# About this series

This is series of daily JavaScript coding challenges... for both beginners and advanced users.

Each day I’m gone present you a very simple coding challenge, together with the solution. The solution is intentionally written in a didactic way using classic JavaScript syntax in order to be accessible to coders of all levels.

Solutions are designed with increase level of complexity.

## Today’s coding challenge

```
Implement the bubble sort algorithm for an array of numbers

```

(scroll down for solution)

## Code newbies

If you are a code newbie, try to work on the solution on your own. After you finish it, or if you need help, please consult the provided solution.

## Advanced developers

Please provide alternative solutions in the comments below. 

You can solve it using functional concepts or solve it using a different algorithm... or just solve it using the latest ES innovations.

By providing a new solution you can show code newbies different ways to solve the same problem.

## Solution

```javascript
// Solution for challenge40

var ar = [23, 1000, 1, -1, 8, 3];
println(ar);
bubbleSort(ar);
println(ar);

function bubbleSort(ar)
{
    var shouldSort = true;

    while(shouldSort)
    {
        shouldSort = false;
        
        for(var i = 0; i < ar.length - 1; i++)
        {
            var a = ar[i];
            if ( a > ar[i+1] )
            {
                ar[i] = ar[i+1];
                ar[i+1] = a;
                shouldSort = true;
            }
        }
    }
}

```


To quickly verify this solution, copy the code above in this coding [editor](https://codeguppy.com/code.html) and press "Run".

> Note: The solution was originally designed for [codeguppy.com](https://codeguppy.com) environment, and therefore is making use of `println`. This is the almost equivalent of `console.log` in other environments. Please feel free to use your preferred coding playground / environment when implementing your solution.
What's the industry standard/ best practices for converting a designers design to HTML & CSS. 
Published: 2020-05-17 15:30:11

Hey guys, so I've been writing code for a while now and pretty comfortable with most things I need to build nice looking sites and UI's, good code practice included. 

I've been chatting with a few designers and been introduced to some design agencies that are beginning to ask me to make sites for them from their designs.

Im more than comfortable translating a layout in Figma etc into HTML and CSS. But there's something thats preventing me from going for it. And that's how to handle the design between the provided (designed) breakpoints. 

Most designs I have had shared with me have two designs for each page/section. One for mobile, and one larger for say 1440px laptop. What is the best practice for handling how it scales between the two. Obviously I'm going to need media queries, but do you scale the type sizes fluidly between the two and interpret the design and layout changes through the viewport widths between? For me it feels like there is an almost infinite range of possibilities for some scenarios, and I'm sure the designers would be very particular about how it looks. But, surely there must be some kind of industry standard way or expectation at least on what should happen there? 

Just wanted some opinions on the best way to go about it. If anyone could shed some light or share an opinion I would be grateful to hear it.
Are your Secrets Safe In Python?
Published: 2020-09-21 07:39:22

---
title: Are your Secrets Safe In Python?
published: true
date: 2020-05-14 00:00:00 UTC
tags: 
canonical_url: https://bhavaniravi.com/are-your-secrets-safe-in-python/
---

# Are your Secrets Safe In Python?

On scrolling through Hackernews, I stumbled upon this article where [Jesse](https://twitter.com/__jesse_li) points out how you or your organization can have [secrets hidden in the form of `pyc` files](https://blog.jse.li/posts/pyc/).

While Jesse's code has scrolled through Github repos and intimated the code owners, there is a good chance that our private repo could have some hanging around.

I modified the code to scroll through Saama's private repositories. Gladly I didn't find any `pyc` files checked in.

You can use the same code to scroll through your private repositories.

## Dependencies

```
pip install PyGithub
pip install uncompyle6

```

### Code

If you want to jump ahead to the whole code checkout [the Github repo](https://github.com/bhavaniravi/pyc_secrets)

1. Import necessary packages

```
import base64
import io
import os
import tempfile
import uncompyle6
from github import Github

```

1. Authenticate with Github

Create a private access token and use it to authenticate yourself

```
GITHUB_KEY = <GITHUB_ACCESS_TOKEN>
g = Github(GITHUB_KEY)

```

1. Get all repos given an organization

```
repos = g.get_organization(<ORGANIZATION>).get_repos(type="private")

```

1. Find files with \*.pyc extension

```
for repo in repos:
    print (repo)
    try:
        contents = repo.get_contents("")
    except:
        continue
    for file_ in contents:
        try:
            extension = file_.name.split(".")[1]
        except IndexError:
            extension = None
        if file_.name in secrets or ( extension and extension == "pyc"):
            items.append(file_)

```

1. If there are no `pyc` files, you are good to go

```
if not items:
    print ("No files found, you are good!")

```

1. If any `pyc` files might contain secrets decompile and print them out

```
for item in items:
    print(f"DECOMPILING REPO https://github.com/{item.repository.full_name}")
    print(f"OWNER TYPE: {item.repository.owner.type}")
    try:
        contents = base64.b64decode(item.content)
        with tempfile.NamedTemporaryFile(suffix=".pyc") as f:
            f.write(contents)
            f.seek(0)

            out = io.StringIO()
            uncompyle6.decompile_file(f.name, out)
            out.seek(0)
            print(out.read())
    except Exception as e:
        print(e)
        print(f"COULD NOT DECOMPILE REPO https://github.com/{item.repository.full_name}")
        continue
    print("\n\n\n")

```
Serve your Django application over wifi (the local network)
Tags: django, linux
Published: 2020-05-17 15:16:02

In case you were wondering how to do this, here’s how.

To serve your Django application over the local network, run this command

```bash
python manage.py runserver 0.0.0.0:8000
```

Alternatively, you can use the IP address of the host machine on the local network.

####Your IP address on the local network

Open up a terminal on Linux and use the ifconfig command. [Read the description here](http://man7.org/linux/man-pages/man8/ifconfig.8.html).

```bash
ifconfig
```

Then look for the inet field in the status output under the current interface. In my case the current interface is wifi0.

![ifconfig command output](https://dev-to-uploads.s3.amazonaws.com/i/qpex67gqjvrfvownoyip.PNG)

then do

```bash
python manage.py runserver 192.168.88.14:8000
```

Enjoy!
Parallelism != Concurrency
Published: 2020-05-17 14:58:04


Parallel Programming always seems to be an esoteric topic whose complexity does not actually represent the general case of computing. Whenever we hear about parallel programming our mind is flooded with extremely difficult programming paradigms that result from deadlocks, monitors, mutual exclusion... As a consequence we tend to associate 2 concepts that are closely related but that are not the same. As the title states, parallelism and concurrency are 2 different concepts.

First of all, parallelism has nothing to do with concurrency. In fact, parallelism involves a nondeterministic composition of programs that results in a deterministic behavior. This end result can be achieved through different methods and we want to explore all of the available alternatives to our advantage. On the other hand, concurrency is all about managing the unmanageable (events start arriving for reasons beyond our control and we must react to them).

And yes, concurrency is a requirement for parallelism. However, concurrency is also a requirement for serialization and sequential programs. Indeed. the timing signal on a processor chip also acts as a synchronization mechanism that we have to coordinate with other processing units. The point is that, even if we have to deal with concurrency, it is not relevant for the implementation of a parallel computation.

In parallel programming, rather than focusing on the exact order in which tasks will be executed, we think in terms of dependencies among operations and we assign a cost to the steps of the program that we are actually writing. This means that we should not bother thinking about how to schedule the workload onto processors. Instead, we should think about the dependencies among the different stages of a large computation.

Think about it in terms of functional programming where we transform a given sequence into another sequence, but the original sequence is not being destroyed. Therefore, we need not worry about the interference between 2 different operations. All that we care about is that we can run those operations in parallel. 

To put it in a nutshell, functional programming is one oof the fundamental pillars of parallel programming. The one reason is that the fewer dependencies we have, the more opportunities for parallelism can be exploited.
[Angular] Why create local variables in templates?
Tags: angular
Published: 2020-05-17 14:45:40

I'm a newbie trying to pick up some angular when I came across this strange bit of code.

```html
<video #movieplayer ...>
    <button (click)="movieplayer.play()">
</video>
```

When / why would I create a local variable (`movieplayer`) in the .html file rather than its .ts?
Time spend on writing CI configurations
Tags: discuss, ci, pipeline, build
Published: 2020-05-17 14:25:34

---
title: Time spend on writing CI configurations
published: true
description: how much time you spent on your ci configuration
tags: discuss, ci, pipeline, build
---

How much time, at the beginning and summed up overall did you spend on writing your ci configuration? Be it for github actions or Travis CI or even Jenkins?
What do you think of X-Team jobs ads
Tags: javascript, discuss
Published: 2020-05-17 14:35:06

Hey DEVCommunity!

I think you all know this [https://x-team.com/](site) that advertises everywhere to look for remote devs. 

I have read some reviews about that company, but none of them were good. Am I wrong in my search? Do you have another opinion? Can you advise this company to your friends? 

Share with us your review of this company.
What Was the Last Application I Made?
Tags: aboutme, storytime, whoami
Published: 2020-05-17 14:33:38

I am going to finally get back into app development. Not because I have nothing to do, but quite the opposite. Now when I say "getting back into", that implies I haven't done so in a while. That's correct. See, while I work on a lot of things, I weirdly don't make applications. I write scripts using BASH and Python, but nothing that isn't simplistic or that I even interact with for the most part.

My definition of "application" versus "script" is that I don't just write it and call it a day - it has to be:
- Sharable
- Interacted with
- Not for an extra specific purpose

Even then most of the scripts I write are to deal with the pain that is known as LXQt - and I don't even do that too often unless I have to, which has been for rather rare bugs.

So what have been the apps I have written? When was the last made? Well, let me set the ground rules here!
1. It can't be an experimental program with no care put into it. AKA the SiteScript compiler that doesn't even work.
2. The program must be open-source. I can talk about the closed-source stuff I work on (very rarely) but they aren't mine and most aren't public anyhow.
3. It has to be written in anything but Python and JavaScript. This might seem harsh to the languages, but I only used the languages to create Proofs-of-Concept - so it falls into the "experimental" stuff.

With that out of the way, what was the last app I made?

Well, the last WIP project I made was called Devwork. It was supposed to be something like a bug reporter but for smaller networks. It was supposed to be a resume piece but it never finished, nor do I care to bring it back.

The last fully-produced app was called [Furry Text](https://github.com/KaiLyons/Furry-Text), and it was a GUI implementation of my friend's translator of a different name. We are both furries and it was completely made to complement his project. More of a joke application than anything else.

Now I said I would not include Python programs but I wrote this as I went - and I forgot I made a couple of Python packages. The latest of which was called [Palettes](https://pypi.org/project/palettes/), again based on my friend's code. This was more of a real application (more library but who cares)

The only other apps there were was when I started learning C++ for the first time ever. So I won't consider them. Before that, I also didn't do much.

Now I am getting back into app development using V and maybe F# if I ever need it. Anyways I wrote this for fun and to keep my brain not dying, so have a wonderful day!
Why I think everyone are actually self taught engineers.
Tags: discuss, career
Published: 2020-05-17 14:31:00

---
title: Why I think everyone are actually self taught engineers.
published: true
description: What do you guys think about CS degree?
tags: discussion, career
---

I have been working for 3 years now as a professional software engineer. From my experience working many wonderful engineers, I think everyone is self taught. Doesn't matter you have a CS degree or not.

Most of my colleague are CS degree holder, all of them told me that CS degree is not really helping them. They told me that the university(in my country) doesn't really prepare them for the real world challenges. Which made them a bit hard to secure their first job. Most of the tools and method they use for their work(coding) are learned by them self. Most of them get their way up to higher position by learning new skills by them self.

I am also telling this, because I have a colleague who are self taught. And from my experience working with them, some of them are better than those who have a CS degree.

I am not discouraging anyone from taking a degree. Go take your degree it can be helpful, and maybe you can find a good network. But my question here is, Do we really need to spend more than 3 years to learn those stuff? What do you guys think?
Diploma in Anganwadi Worker Admission & Franchise Center
Tags: anganwadiworkers
Published: 2020-05-17 14:05:56

Anganwadi centers and workers have a major contribution behind the development in the health facilities of women and infants in rural areas of India. With the constant efforts and social service of Anganwadi workers, development of schemes related to education and health has been possible in the country. Anganwadi workers and centers are not a boon for those rural women who leave their infants for some time in these centers to earn their livelihood. By doing this, their employment also remains and their children get better care of their health and education. Health and education schemes launched at the rural level in the country can be fully effective only if the Anganwadi workers are not given their information. In every Anganwadi center in the country, Anganwadi workers are required from time to time and the government appoints Anganwadi workers to fulfill it. Keeping this in mind, the Rural Urban Council of Skills and Vocational Studies has started the Aganwadi Workers Diploma Course, after which the candidate can apply for and get the job of Anganwadi Worker. If you want to run the Anganwadi Worker Diploma Course Center, then you can take the recognition of the Anganwadi Worker Diploma Course Center offered by the Rural Urban Council of Skills and start training this course in your area.
https://www.ruralurbanskills.edu.in/anganwadi-diploma.php
Furgetmenot: Adopt, Rescue, Love until the end of time!
Tags: showdev, javascript, opensource, vue
Published: 2020-05-17 13:48:51



Sometime back one of my friends was talking about how people leaving their pets on the streets and how those animals left unattended and sometimes die from accidents. It hit me with the idea for Furgetmenot. If there is a common platform where everyone can submit an entry if they are not able to take care of their pet anymore, others who are in need of a pet can adopt. And that will reduce pets ending up at streets.

This project uses VueJS and Firebase and it's open source! Feel free to help us improve!

Site Link: `https://https://furgetmenot.suvink.me/#/`
Github Repo: `https://github.com/Iconicto/furgetmenot`
How to search Google from the terminal
Tags: zsh, bash, productivity, shell
Published: 2020-05-17 13:18:12


I'm sure we all do a lot of Googling in our day to day coding. Hopefully this alias will save you some time and improve your productivity. Feel free to share your most used aliases below!


Add to  $HOME/.bashrc or $HOME/.zshrc depending on which shell you use. 

```
function google {
  open -a 'Google Chrome' https://www.google.com/search\?q\="$1"
}
```

Restart your terminal. 💵👏


Some examples:

`google "center div flexbox"`
`google "padding vs margin"`
`google "how to css"`
`google dev.to`
SEO Agentur
Published: 2020-05-17 12:59:41

<a href="https://www.optimerch.de/">Optimerch</a> ist eine Online Marketing Agentur, die Unternehmen mit professionellen Marketing-Konzepten unterstützt. Wir beraten individuell und persönlich und setzen zielgerichtete Marketingmaßnahmen um. Hierzu zählen unter anderem professionelle Suchmaschinenoptimierung und Suchmaschinenwerbung sowie digitale Transformation. Chancen und Schwächen ermitteln wir mit Datenanalysen und steigern so nachhaltig Unternehmenserfolge.
5 new challenges
Tags: javascript, computerscience, codenewbie
Published: 2020-05-17 12:47:22

I've added 4 medium and 1 hard challenge to codr's ranked mode. All of these are related to basic logic and mathematics, the perfect occupation on a sunny Sunday afternoon. Visit codr for more https://nevolin.be/codr/

Can you solve the hard one?
```JS
function POF(num) {
  if (num === 1) return true;
  if (num < 4) return false;
  if ((num & (num - 1)) !== 0) return false;
  return (num & 0x55555555) === num;
}

let A = POF(258);
// A = ?
```