teleren/devto huggingface dataset:
CS Ed Week! Block-Based Programming?
Tags: discuss, computerscience, education
Published: 2020-12-09 18:56:25

Happy CS Ed Week!

I'm a former middle school science teacher career changer, now working in software...but I have to admit that #CSEdWeek played a large part in my transition into software. I started using [Code.org](https://code.org/) tools such as AppLab and Hour of Code activities with my kids each year, then started incorporating other block-based programming tools into the curriculum, such as [StarLogo Nova](https://www.slnova.org/).

So naturally, I was excited to see this article, [Block-based Programming in Computer Science Classrooms](https://csedresearch.org/block-based-programming-in-computer-science-classrooms/), which shares research on the experiences of kids who start out with block-based programming.

Did anyone else start out with block-based programming, for yourself, or using it with your kids or students? 

What's your take - did it help with the transfer over to learning a programming language? 

Any favorite block-based platforms to share?
Why pressing the key works only once in my React project?
Tags: beginners, help, discuss, react
Published: 2020-12-09 18:54:21

Hey there!

Could you tell me what's wrong with this code?

I have a button in my application that toggles the state. 

I would like to achieve the same with pressing the spaсebar on the keyboard. And it works only one way. The state changes to false once. And then no reaction.

```javascript
import { useState, useEffect } from 'react'

const HandleKeypress = () => {

    const [itWorks, setItWorks] = useState(true)

    useEffect(() => {
        document.addEventListener('keypress', (e) => {
            if (e.code === 'Space') setItWorks(!itWorks)
        })
    }, [])

    return (
        <div>
            <p>{itWorks ? 'It works!' : 'It does not'}</p>
            <button 
                onClick={() => setItWorks(!itWorks)}
            >Press me</button>
        </div>
    )
}

export default HandleKeypress
```

What am I missing? 😼
Java `future` library.
Tags: java, watercooler
Published: 2020-12-09 18:43:56

####I'm making a Java library called `future`, the intended purpose is just to make things easier, so you don't have to implement them yourself, or gather up a bunch of multiple libraries.
<br/>
<br/>

####The two main subpackages of future I will work on is `eval` (`future.eval.*`) and `types` (`future.types.*`).
####I've already got some things in `eval`, such as `EOLError`, and I'm currently working on `Parser` (which will convert `String`s to values).

####And also have a `Queue` type in `types`.
<br/>
####Once the project has finished its first version, the GitHub repo will be made. And, when it is released, I hope to hear your feedback on it.


<div>
##<b><center><b>Thanks for reading!<br/>Cheers!</b></center></b>
</div>
How to get the highest scrap memory price
Published: 2020-12-09 18:35:54


Scrap memory is more valuable than you may think.

Buyers purchase scrap RAM (like DIMMS or SIMMS) because they all contain precious metals like gold, silver and palladium that can be retrieved and resold.

With precious metal prices higher than they’ve been in a long time, the scrap memory price is high, too.

Scrap RAM components feature either gold fingers, RAMBUS/metal, or tin fingers. (The latter are sometimes called silver fingers even though they are made of tin.)

Whatever you do, do not remove these metal fingers. Leave it to a professional computer scrap buyer to evaluate and process your old unwanted RAM for you. Potential customers want to see where the metal originally came from, and they can’t do that if you cut off the fingers.

The three types must be weighed and sold separately because their components are valued at different amounts.

However, our company will sort your RAM for you if you don’t have time to do it. It is all part of our effort to get you the highest scrap memory price.

Not only do we pay more than any other computer and memory liquidator, we always are looking to purchase a wide variety of used, old, obsolete and unwanted computer scrap such as processors (all brands); memory (all brands including Apple, Dell, IBM and more) from all types of computers (server, desktop, laptop, printer and notebook); hard drives, cell phones, laptops, motherboards and much more.

To get a no obligation scrap memory price from us, simply contact us today. Our full details are here www.buysellram.com

Call us at 321-972-6633 and we do the rest!
Add CSS to your GitHub READMEs
Tags: github, css, html
Published: 2020-12-09 18:25:17

Today on Hacker News, [a link to a repository popped up](https://news.ycombinator.com/item?id=25349068) with the intriguing title,

**"CSS in GitHub Readmes"**

[The repository](https://github.com/sindresorhus/css-in-readme-like-wat) contains some interesting [code](https://github.com/sindresorhus/css-in-readme-like-wat/blob/master/header.svg?short_path=8ee6fdb) and [explanation](https://github.com/sindresorhus/css-in-readme-like-wat/blob/master/explanation.md).

## Setting it up

In your repository, add a new SVG file with whatever name you like, such as `header.svg`.

Then, embed the image in your README using some plain ol' HTML:

`<img src="header.svg" width="800" height="400">`

## Adding your CSS

The following template is all you need to get started. Add this code to your SVG file:

```html
<svg fill="none" viewBox="0 0 800 400" width="800" height="400" xmlns="http://www.w3.org/2000/svg">
  <foreignObject width="100%" height="100%">
    <div xmlns="http://www.w3.org/1999/xhtml">

      <style>
        /* your CSS */
      </style>

      <!-- your HTML -->

    </div>
  </foreignObject>
</svg>
```

## How does this work?

According to the repo,

> You can put HTML (actually XHTML) and CSS inside a \<foreignObject\> tag inside a SVG file inside an \<img\> tag inside your readme. 🤯

The `<foreignObject>` tag is [a valid SVG element](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/foreignObject) that can contain any form of XML data. The XML data type (*namespace*) is specified using the inner tag's `xmlns` attribute. In this case, we'll use the XHTML namespace:

`<div xmlns="http://www.w3.org/1999/xhtml">`

Now all of the code inside this `<div>` will be rendered as XHTML!

Take extra care when writing XHTML markup. The browser forces much more strict rules than regular HTML, and you might notice some issues that the browser would typically ignore for non-XHTML markup.

## What about JavaScript?

GitHub has very specific content loading policies on their servers, and when loading any type of asset the server first *sanitizes* the data to ensure no foreign JavaScript executes in the browser. Trying to embed `<script>` tags or using inline `onclick` attributes results in content policy errors in your browser.

## Why can't I interact with the SVG's contents?

When rendering the SVG, GitHub loads it inside an `<img>` tag that removes the interactivity from the SVG. However, any animations are still rendered in the image.

### **Hope you enjoyed this fun experiment!**
Check out what I did with it [here](https://github.com/Sergix/sergix/blob/main/header.svg).

<hr>
[![sergix](https://dev-to-uploads.s3.amazonaws.com/i/zumybxsrwwcl9hj8ap68.png)](https://www.sergix.dev)
**Let's develop a website that fits you. Don't settle for a template.**
[Visit my portfolio](https://www.sergix.dev) to see what I'm about.
Learning to code later in life
Tags: codenewbie, beginners, motivation, devjournal
Published: 2020-12-09 18:21:01

Hi!  My name is Holly and I am learning to code at 40 years old.  I started my coding journey at the young age of 37.  It stalled for a year while I was dealing with some life moments, but a year ago I picked back up where I left off.  

*What does learning to code at my age look like?*  I am a full time student.  I chose a path that included college because I live in a state that offers a tuition-free 2 year degree for any adult that meets the criteria for the program. 

*Why learn to code?*  I worked as a  dental assistant for over 15 years.  It was an amazing career for me for a long time.  Once I made the decision to go back to college, I did not immediately look at tech as an option.  I really had no clue what I wanted to do.  I just knew that I needed to be challenged.  I went through the programs offered and narrowed down my options.  Once programming was on my radar, I utilized several free coding sites to learn as much as I could to see if this was what I wanted.  I loved it! 

*Do I believe anyone can learn to code?*  YES! If you are passionate and dedicated to learning, you can learn to code at any age.  

*Tell me, how old were you when you started your journey?*
GitHub's Dark Theme
Tags: github, generalprogramming
Published: 2023-04-23 11:18:08

---
title: GitHub's Dark Theme
published: true
date: 2020-12-09 18:07:04 UTC
tags: GitHub,GeneralProgramming
canonical_url: https://chrisdevcode.hashnode.dev/githubs-dark-theme
---

It's about time, my favorite website has now a **Dark Theme**.

[2020's GitHub Universe](https://githubuniverse.com/) came in with a lot of new goodies and features for the developers and GitHub users.

Of all the new features, the Dark theme on GitHub and the Emoji skin tone really caught my eyes. Here's a quick guide on how to adjust your appearance settings:

Go to the Appearance tab on your [GitHub settings](https://github.com/settings):

Or quickly use this link [https://github.com/settings/appearance](https://github.com/settings/appearance) - Ensure to be logged in to your account

Default theme: Select The theme of your choice and even more! Emoji skin tone

![light.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1607536790984/dMGzskbOC.png)

Dark Theme

![dark.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1607536856252/WdvCcf6ah.png)

Now that's just a few of the new stuff from GitHub this year, be sure to go through GitHub's blog to view more cool stuff.

[https://github.blog/2020-12-08-new-from-universe-2020-dark-mode-github-sponsors-for-companies-and-more/](https://github.blog/2020-12-08-new-from-universe-2020-dark-mode-github-sponsors-for-companies-and-more/)
Top 5 Javascript Carousel Libraries
Tags: css, javascript, beginners, tutorial
Published: 2020-12-09 17:58:22

<h3><b>1. Swiper</b></h3>
<a href="https://swiperjs.com/">https://swiperjs.com/</a>
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/t19n4xxbq4epbrcdbolg.png)
<p>Swiper is the most modern free mobile touch slider with hardware accelerated transitions and amazing native behavior. It is intended to be used in mobile websites, mobile web apps, and mobile native/hybrid apps.

Swiper is not compatible with all platforms, it is a modern touch slider which is focused only on modern apps/platforms to bring the best experience and simplicity.</p>

<br>
<h3><b>2. Owl Carousel 2</b></h3>
<a href="https://owlcarousel2.github.io/OwlCarousel2/">https://owlcarousel2.github.io/OwlCarousel2/</a>
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ldevowya8n4yvi4kxurw.png)
<p>Touch enabled jQuery plugin that lets you create a beautiful responsive carousel slider.
Owl Carousel has been chosen as the number one jQuery plugin by hundreds of developers. Now its time for a new version that comes with lots of new features and an even more user-friendly API.</p>

<br>
<h3><b>3. Slick Slider</b></h3>
<a href="https://kenwheeler.github.io/slick/">https://kenwheeler.github.io/slick/</a>
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/07e8u4md8b2txpn1wrgc.png)
<p>Fully responsive. Scales with its container.
Separate settings per breakpoint
Uses CSS3 when available. Fully functional when not.
Swipe enabled. Or disabled, if you prefer.
Desktop mouse dragging
Infinite looping.
Fully accessible with arrow key navigation
Add, remove, filter & unfilter slides
Autoplay, dots, arrows, callbacks, etc...</p>

<br>
<h3><b>4. ItemSlider</b></h3>
<a href="https://github.com/codrops/ItemSlider">https://github.com/codrops/ItemSlider</a>
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/eklq2u43z6btizms1zcc.png)
<p>A tutorial on how to create a simple category slider with a minimal design using CSS animations and jQuery. The idea is to slide the items sequentially depending on the slide direction.</p>

<br>
<h3><b>5. blueimp Gallery</b></h3>
<a href="https://blueimp.github.io/Gallery/">https://blueimp.github.io/Gallery/</a>
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ea9yjo20v8z8cs5eg6hh.png)
<p>blueimp Gallery is a touch-enabled, responsive and customizable image & video gallery, carousel and lightbox, optimized for both mobile and desktop web browsers.

It features swipe, mouse and keyboard navigation, transition effects, slideshow functionality, fullscreen support, and on-demand content loading and can be extended to display additional content types.</p>

<br>
<hr>
<h3>I hope This information is help to use Silder for your website. also comment me whitch slider you use and most usefull Slider library name....<h3>
Also visit our website <a href="http://mycodemagic.com/">mycodemagic</a>
I Hate Floating Point!
Tags: floatingpoint, types, testing, perl
Published: 2020-12-09 17:50:03

---
title: I Hate Floating Point!
published: true
description: 
tags: floatingpoint, types, testing, perl
//cover_image: https://direct_url_to_image.jpg
---

In one of my projects, I need to know what is the minimum number of bytes needed to store a given integer. The Obviously Correct answer, ignoring negatives and the special case of 0,  is something like ...

```perl
1 + int(log($data) / log(256))
```

I'm lucky that my test suite included a value of `$data` that is an exact multiple of 256 (which is likely to expose floating point errors in that calculation), and doubly lucky that the particular value in the test suite had a floating point error *in the right direction* so that the test actually failed, because ...

```
$ perl-5.30.2/bin/perl -E 'say 1 + int(log(0x1000000) / log(256))'
4
$ perl-5.30.2-quadmath/bin/perl -E 'say 1 + int(log(0x1000000) / log(256))'
3
```

Ouch! The first does the calculation using a 64 bit IEEE754 float, the second uses gcc's `libquadmath`.

My thanks to the CPAN-testers for making my tests fail!
On File Switching in Rescript
Tags: tipstricks, rescript, vscode
Published: 2021-02-04 17:03:02

---
title: On File Switching in Rescript
published: true
date: 2020-12-09 17:36:28 UTC
tags: TipsTricks,rescript,vscode
canonical_url: https://mrmurphy.dev/on-file-switching-in-rescript/
---

I use Rescript at work, and find that I often want to switch between interface and implementation files. Less often, I also want to inspect the compiled source of a file. This can be a small pain to do by hand, and small pains repeated often become big pains. So here are some VS Code extensions to help out.

## For Opening Interface & Compiled Files

[Extension: Open related files](https://marketplace.visualstudio.com/items?itemName=bryanthomaschen.open-related-file)

This extension will automatically open files with the same name, but different extensions, so you'll get the .`resi` _and_ the `.bs.js` files popped up in new tabs. Better yet, if you keep running the command, it toggles between `.res`, and `.resi`.

![](https://mrmurphy.dev/wp-content/uploads/2020/12/image-1024x94.png)

This one doesn't come with a default keymap, so you'll need to add one in your settings.

Another cool thing about this extension is that it can create interface files for you as well, just throw this into your settings.json:

```
  "openRelatedFiles.createFileMap" : {
    ".res": [
        ".resi"
    ],
    ".re": [
      ".rei"
    ]
  }
```

And then you can use the "Create related files" command to make an ".resi" file for you.

# For Opening Child Files

The OCaml naming convention gives files hierarchy by their names. For example `Foo.res` would break out some complex logic "baz" into a subfile: `Foo_Baz.res` and import it. We can use an extension to easily browse these child files.

[_Quick_ Open Related Files](https://marketplace.visualstudio.com/items?itemName=schreifels.vscode-quick-open-related-files)

This pops open a picker of files that have a name with a prefix similar to our own:

![](https://mrmurphy.dev/wp-content/uploads/2020/12/image-1-1024x413.png)

[  
](https://storage.3.basecamp.com/4832895/blobs/fcedd50c-3a43-11eb-aa70-a0369f740da9/download/image.png)
Integrating Accurics IaC Scanning into Jenkins
Published: 2020-12-09 17:31:45

Just a quick post on integrating IaC scanning into Jenkins with the Accurics CLI. This example will detect security violations in your Terraform provisioning along with any drift in config from running cloud resources in build. Super cool stuff!

**Steps**

1. **Download CLI:** 
From the Accurics dashboard for your chosen environment hit Download CLI. This will download the Accurics binary and config file. The config file is needed to associate the scan results with your Accurics account and specific environment.

![cli](https://dev-to-uploads.s3.amazonaws.com/i/sjocwgbblddavym8a563.png)

2. **Add Step to your Jenkins pipeline file:** 
You can optionally set the -fail flag to stop the build if violations are detected. The CLI will produce reports in both html and json formats. For this example I have also optionally requested that Jenkins publish the HTML report as a build artifact.

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

Here is what the results look like from within Jenkins for a failed pipeline.

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

And the resulting html report:

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

Looks like I have some violations to address for the new infrastructure definition for the jeffsbooks app but currently no drift from my running application and cloud environment 👍

This was a super quick example on integrating IaC scanning for Terraform into a Jenkins pipeline. The Accurics CLI has many other options and support for other provisioning tools such as Helm, Kustomize, CFT, Ansible, ARM, CDM, etc.

If any questions come up or help is needed feel free to drop me a line.

Cheers,
Jeff
What exactly is Copyleft?
Tags: help, explainlikeimfive, watercooler
Published: 2020-12-09 17:26:58

I was just confused about the term, and wanted to know what exactly it meant. It doesn't seem to be the (exactly) the opposite of copyright, but its license serves the opposite purpose(?).

Can someone please explain this (ELIA5 would be very appreciated)?

<div>
##<b><center><b>Thanks!<br/>Cheers!</b></center></b>
</div>
Python  Data Structures For Beginners
Tags: python, codenewbie, webdev, 100daysofcode
Published: 2020-12-09 17:02:35

![alt text](https://codehance.com/media/images/python-datastructure-for-newbies.max-755x400.png "CODEHANCE | Python Data Structures For Beginners")


Ever wondered how some programmers take one look at a problem and immediately know what code to write? I will let you in on the secret. It is all about data structures. Let's explore this secret more closely.

**The data structure is simply the structure used to hold data together and so to manipulate any data ( programming ) you first need to know what structure that data is in and then use the structures methods accordingly.**

There are four built-in data structures in Python:

1. [List - ordered mutable](https://www.codehance.com/blog/python-data-structures-for-beginners/#1-list-data-structure)
2. [Tuple - ordered immutable](https://www.codehance.com/blog/python-data-structures-for-beginners/#2-tuple-data-structure)
3. [Dictionary - mutable key/value pair](https://www.codehance.com/blog/python-data-structures-for-beginners/#3-dictionary-data-structure)
4. [Set - mutable unordered unique cannot contain mutable types](https://www.codehance.com/blog/python-data-structures-for-beginners/#4-set-data-structure)

---

**LIST DATA STRUCTURE**

A list is a data structure that holds a collection of ordered/sequence mutable items.

A list in python is created with square brackets containing comma-separated-values, you cannot miss it once you see one, below is an example of a list stored within a variable called fruits.

Example:
`list = [1, 2, 3]`

**When to use List**

Below are some reasons why you might need to use the list data structure instead.

- You are dealing with sequenced data
- Order might be of importance
- Need to change the list (mutate)
- The list is homogeneous ( same type of data )

For how to create and use list, with some examples checkout:
[Python Tuple Data Structure Practical Example](https://www.codehance.com/blog/python-list-data-structure-practical-example/)

To read the post in full details:
*[Read Full Article...](https://www.codehance.com/sh/bKlF9i7)*
DAY 9 - Advent of Code 2020 w/ GoLang
Tags: go, adventofcode
Published: 2020-12-09 16:42:27

---
title: DAY 9 - Advent of Code 2020 w/ GoLang
published: true
description: AoC 2020 Day9 solutions in GoLang
tags: golang, AdventOfCode
series: Advent of Code 2020
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/gb6jnhz1didpnth3pbsw.jpeg
---

**DAY9:**

This one felt good, for me. There are many loops, as you'll see. That is mainly because I had to write some utility functions for typical slice evaluation that Go doesn't have by default like other languages (*not complaining, just pointing out.*).

I do advise you split out the logic into helper functions. It could've gotten really messy if I did all of the work in the main function.

```golang
package days

import (
	"fmt"

	inputs "../inputs"
)

// https://adventofcode.com/2020/day/9
// Nine : advent of code, day nine part1 and 2
func Nine() {
	inputSlice := inputs.Day9

	part1 := getRuleBreaker(inputSlice, 25)
	fmt.Print("(Part 1) - Value that doesn't follow preamble rule: ")
	fmt.Println(part1)

	part2 := contiguousCheckSum(inputSlice, part1)
	fmt.Print("(Part 2) - Contiguous series sum (series max+min): ")
	fmt.Println(part2)
}

func getRuleBreaker(inputSlice []int, preambleSize int) int {
	for i := preambleSize; i < len(inputSlice); i++ {
		preamble := inputSlice[i-preambleSize : i]
		if !preambleEquator(preamble, inputSlice[i]) {
			return inputSlice[i]
		}
	}

	return 0
}

func contiguousCheckSum(inputSlice []int, toSum int) int {
	maxMinSum := 0

	for i := 0; i < len(inputSlice); i++ {
		for j := i + 1; j < len(inputSlice); j++ {
			if toSum != inputSlice[i] && toSum != inputSlice[j] {
				contiguousSeries := inputSlice[i:j]

				contSum := 0
				for c := 0; c < len(contiguousSeries); c++ {
					contSum = contSum + contiguousSeries[c]
				}

				if contSum == toSum {
					maxMinSum = maxMinSumation(contiguousSeries)
				}
			}
		}
	}

	return maxMinSum
}

func maxMinSumation(contiguousSeries []int) int {
	min := contiguousSeries[0]
	for v := 0; v < len(contiguousSeries); v++ {
		if contiguousSeries[v] < min {
			min = contiguousSeries[v]
		}
	}

	max := contiguousSeries[0]
	for v := 0; v < len(contiguousSeries); v++ {
		if contiguousSeries[v] > max {
			max = contiguousSeries[v]
		}
	}

	return min + max
}

func preambleEquator(preamble []int, current int) bool {
	worked := false
	for j := 0; j < len(preamble); j++ {
		for x := j + 1; x < len(preamble); x++ {
			if preamble[j]+preamble[x] == current {
				worked = true
				break
			}
		}
	}
	return worked
}
```

[Link to Github source file](https://github.com/dizveloper/AdventOfCode/blob/main/2020/days/day09.go)
Laravel Tutorial
Published: 2020-12-09 16:38:08

As we all know that laravel is a very popular and simple php framework and is widely used, if you have to go to the programming world and built their own website, then find the finest laravel tutorial on the web. So, you visit here, with an easily understandable language we give the full tutorial on laravel programming on the internet. https://www.phptpoint.com/laravel-tutorial/