teleren/devto huggingface dataset:
Suggestions on building an AI?
Tags: programming, beginners, tutorial, typescript
Published: 2022-10-04 02:16:39

I'm an experienced programmer, but new to AI. I'm trying to learn ML techniques by building a bot to play a video game. I'm documenting my process as I go.

The game I'm focusing on 1st is TFT (TeamFightTactics) which is in the AutoBattler genre - Essentially, you try to build the strongest army, but there are millions of choices & pros/cons to each.

My current plan is to use a NeuralNetwork (TensorFlow.Net) to learn the complexities of which armies are strong/weak against each other. I'm planning to hard-code the obvious rules/strategies to the game to make it easier on the NN.

One of my big fears is the difficulty in gathering a large dataset of training data, so any advice on workarounds for that would be great. I'm thinking maybe split the game up into different types of decisions & use a different ML technique specifically targeted for each one. Hopefully that creates smaller NNs that can learn patterns easier with less data.

Any advice on topics I should research?

Thanks!

https://www.youtube.com/watch?v=1gSMtfPpJC0

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tetocyxplauamupmleej.jpg)
will_save_change_to_attribute?(attribute) in Rails
Tags: rails, ruby
Published: 2022-10-04 02:16:23

Everyday I learn about new methods in rails and it absolutely floors me how awesome this framework is. 

## Context
Imagine you have 2 models, User and InGameTrophies. The InGameTrophies holds a lot of data about the trophy type, date of acquisition etc etc. A user can have multiple trophies. Now whenever a trophy item gets updated, we want to run a background job only if one field, say trophy type gets changed. In comes the `saved_change_to_#{field_name}?` and `will_save_change_to_#{field_name}?`

```
...
#if the trophy has already been saved then
SomeBackgroundJob.call() if @trophy.saved_change_to_trophy_type? 
...

#if the trophy type has not yet been saved then
SomeBackgroundJob.call() if @trophy.will_save_change_to_trophy_type? 
...
```

Pretty neat, right? I think it is. [more reading](https://apidock.com/rails/v6.0.0/ActiveRecord/AttributeMethods/Dirty/will_save_change_to_attribute%3F)
Hacktoberfest - Get Gifts By Contributing To Open Source Repos
Tags: opensource, beginners, github, hacktoberfest
Published: 2022-10-04 01:06:55

##What is Hacktoberfest
Open Source is changing the world, one contribution at a time.
**Hacktoberfest** is a month-long celebration of open source development run by **Digital Ocean**. It is open to everyone, from firs-time contributors to seasoned open source developers.
Your journey starts with a pull request. After submitting four pull requests, you get the chance to win a `T-Shirt` or `Plant a tree`
This year's hacktoberfest is presented by **DigitalOcean**, **AppWrite**, and **Docker**.

##Contribute
Anyone around the globe who desires to help drive the growth of open source and make positive contributions to an ever-growing community. All backgrounds and skill levels are encouraged to participate and learn more.
>To contribute, Always look for repositories on GitHub with the #hacktoberfest-2021 or #hactoberfest tag
>[Hacktoberfest Link](https://www.hacktoberfest.digitalocean.com)

###Ways To Contribute To Repositories:
* Bug Fixes
* Writing tests for projects
* Writing of Documentations/Technical Writing
* and many more

##Some Projects To Contribute:
1. **Quotes-Generator**:
Quotes-Generator is an open source Website that generates random 
quotes. [Link To Quotes-Generator](https://github.com/seths10/Quotes-Generator)

>Search for repositories with the `hacktoberfest` label on GitHub

Thanks for your time and don’t forget to be friends with me on:
* [Twitter](https://www.twitter.com/set_addo)
* [GitHub](https://www.github.com/seths10)
Program I wrote to let my kids decide..
Published: 2022-10-04 00:52:44

Here is a program I wrote in python for my two kids when they can't agree on whose turn it is. It's called "Whose turn is it anyways?". Uses RNG to pick a child and has the chosen kid pick a game from "Flip the Coin", "Rock, Paper, Scissors", or "Closest to the Number". The winner of the game gets to choose if they want to do the chore or have the other child do it, typically something like feeding the dog or doing a chore. I made this as an assignment for Codecademy, however it has become frequently used in my household. Here is a link to the code: {% embed https://github.com/austinharry777/whose-turn-is-it-anyways.git %}
Junk drawer
Tags: codeorganization
Published: 2022-10-23 20:49:56

---
title: Junk drawer
published: true
cover_image: https://jhall.io/images/bn-junk.jpg
date: 2022-10-04 00:00:00 UTC
tags: codeorganization
canonical_url: https://jhall.io/archive/2022/10/04/junk-drawer/
---

Every house has a junk drawer.

It’s where we put random small or unique items that don’t really belong anywhere else.

Many code bases have junk drawers, too. They’re usually classes or packages with names like “helpers”, “utils” or “common”.

Does the fact that your house has a junk drawer justify a code junk drawers? I don’t think so.

If physical drawers were free, and took up no space, we probably wouldn’t have junk drawers in our homes, either.

If it was economical and space-efficient to create a drawer just for rubber bands, why not? And why not a drawer just for the stapler? And a separate drawer just for the battery door that fell off of a random toy your kid got for Christmas last year.

Obviously, that’s not practical in the physical world.

But in code, those “drawers” are free. So there’s never a good reason to start throwing your code “junk” into a junk package. Give each package/class its own meaningful name. Even if it only contains a 2-line helper function. Classes are free. Use them!

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._
Algorithms: Breadth First Search
Tags: algorithms, computerscience, javascript, beginners
Published: 2022-10-03 23:57:33

Tree and Graph traversal is a popular topic in coding interviews. There are many approaches to graph traversal but one of the most common and important to be familiar with is Breadth First Search (BFS). We'll explore the basic ideas of the algorithm and a few example implementations.

## The Basics
Breadth First Search is an algorithm used to traverse graph data structures. It is the order in which the nodes will be visited. As the name implies the traversal is conducted in a breadth first manner, meaning that starting from a certain node we will traverse every node of the current level before exploring additional nodes at deeper levels. 

### Tree Order Traversal

![BFS - Tree Traversal](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5w25v34del95muh70dfc.png)

Starting from the root node (6), each level is explored from left to right before moving to the next level.

## Implementations
BFS algorithms are usually implemented iteratively using a [queue](https://dev.to/seantansey/data-structures-stacks-and-queues-90n) data structure. We start by adding the root node to the queue. Then we iterate through the queue, removing the node and adding its children to the queue. This allows us to explore the graph level by level. 

## Problem
Given a binary tree, return an array of sub-arrays that represents its level by level traversal. 


![Example problem](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cv8zeuz3sqvej6crrcv6.png)

```javascript
class Node {
  constructor(val) {
    this.val = val
    this.left = null
    this.right = null
  }
}
```

### Solution

```javascript
const bfs = (root) => {
 const result = []
 const queue = [ root ]

 while (queue.length) {
   const level = []
   const qLength = queue.length
   for (let x = 0; x < qLength; x++) {
      const node = queue.shift()
      level.push(node.val)
      if (node.left !== null) queue.push(node.left)
      if (node.right !== null) queue.push(node.right)
   }
  result.push(level)
 }
 return result
}
```
GraphQL queries with Okta Workflows
Tags: graphql, okta, nocode, workflows
Published: 2022-10-03 23:43:52

Okta Workflows is a stellar tool for orchestrating automations and has built-in integrations with a wide variety of services. Workflows also makes it easy to communicate with APIs via the API Connector functionality.

A customer recently asked, _"What if I need to talk to a GraphQL service? Can Okta Workflows do that?"_

**Yes!** In essence, GraphQL is just a text format used in HTTP payloads, so we can leverage Workflows to generate the queries and the HTTP Functions in the API Connector to make the calls. 


![Screenshot of attached Okta Workflow that you can import to your environment and test](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fqki9g4b2sa14m61e54n.png)

I found this helpful list of [free GraphQL APIs for projects and demos](https://www.apollographql.com/blog/community/backend/8-free-to-use-graphql-apis-for-your-projects-and-demos/) and decided to test out the Star Wars API.

---

Feel free to check it out : {% gist https://gist.github.com/bbarrows89/c57143fca50f561231a7355764889109 %} **_Download steps:_** 
* _right click "view raw" in the panel above on the right_ 
* _click "Save Link As"_
* _be sure the filename ends in `.flow`_

or check out my other guides and Workflows content _(more coming soon!)_ here: {% github bbarrows89/oktaworkflows  %}

---

Hope this helps! Find me on [LinkedIn](https://www.linkedin.com/in/bbarrows89/) or shoot me an [email](mailto:bryan.barrows@okta.com) if you have any questions. 

You can also join us at a [Community Office Hours](https://calendly.com/oktaworkflows) session to work through problems and ask questions - I'd love to see you there.
Day 628 : Time Goes
Tags: hiphop, code, coding, lifelongdev
Published: 2022-10-03 23:38:00

_liner notes_:
- Saturday : Due to Hurricane Ian, the school and thus the station were closed. Makes sense, don't want people running around campus until you know it's safe. So I did the show from the back of my van. Had some technical difficulties, like my laptop shutting down on me (I think it got too hot) and my recorder messing up. Had to do some editing, but I got the show posted. The recording of this week's show is at https://kNOwBETTERHIPHOP.com

![Radio show episode image of a land where a large body of water has formed due to Hurricane Ian and heavy rainfall with the words Oct 1st 2022 R.I.P. Coolio](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hd6y4jjmmyrtk0elh938.jpg)

- Sunday : I decided to do my https://untilit.works cyphers since it has been a month since the last one because of travel. It was good to see that everything still worked (for the most part. I needed to add some money to an account, because it ran out and a service stopped. haha). Got a good amount of stuff done.

- Professional : Today was all about getting my expense reports turned in for all my recent travels. It's a lot, but it helps that I have pictures of receipts that I took at the time I got them and uploaded them to folders so I can just pull them when it comes time to add them to the reports. Also had a couple of meetings to talk about some stuff coming up. Not a bad way to start the week.

- Personal : So I ordered a bunch of stuff. Re-upped on a bunch of supplies that I used up before leaving for my trips. My audio recorder I use for the radio show has been malfunctioning so I ordered another one of the same model. Luckily for me it was on sale for almost $100 cheaper than when I bought it earlier. I also bought a hard case for it, so hopefully that will help keep it working for longer. There's a bluetooth adapter that I can use to record people on the phone. Currently, I use a cable, but I can't charge the phone at the same time. We'll see how it works out.

![A wooden dock on a lake in Pragser Wildsee, Italy with stairs leading to boats with a forest and mountains in the distance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dg4fpckyyxnmcowyc3jn.png)

Going to do some more planning for my new side project. Got some news on a library I want to use that will change plans that I had. I'll need to figure out an alternate way of getting it done. Also, want to watch the latest "Atlanta" episode. Also, I can't believe it's October already. It's funny how time goes by so quickly.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube wrqAAgFJf-A %}
How to Use VS Code Spell Checker - Detailed walkthrough to setup and use multiple languages
Tags: vscode, productivity, beginners
Published: 2022-10-03 23:30:25

Never make another spelling mistake in your code using the free VS Code spell checker extension from Street Side Software.

In this video you will learn: 
1. How to install the spell checker extension.
2. How to identify spelling errors.
3. Fix spelling errors.
4. Add dictionaries for additional languages for example Spanish and French.
5. Add new or made up words to the dictionary.
6. The difference between user and workspace settings.
7. Store settings in a file called cspell.json instead of the .vscode settings.json file. 

{% embed  https://youtu.be/Ix5bMd0kZeY %}
I quit!...Or should I?
Tags: beginners, programming, devjournal, management
Published: 2022-10-03 23:09:06

> _to future readers(incase anyone even finds this): this is obviously my first post and I'm clearly venting/planning out my next line of action so get what you can and/or just enjoy this piece_

=====================================================================================

It's few minutes past 11pm and the day hasn't been so good. I was glued to my screens both phone and laptop, switching between apps LinkedIn, Twitter, Facebook, Gmail hoping to come across or receive a news that'll make me feel very happy. Either a job or some sort of invitation to build something really cool.

I work on a daily basis sometimes from home, sometimes from the office but it has become quite stale. Same old process, same project, same technologies. I saw this as a problem but how do I fix this? I have to leave. How then do I make money to live? Get a job. How? I could either freelance or work for a more fun organization outside the country of course 'cause we got to factor in gaining completely new experience while earning the big bucks (that's why most of us are in this field, right? Not me though! Y'all be safe).

Well it's not been a smooth ride either way. I was told with my number of years of experience, it'd be difficult (not impossible though). Really, I feel the No. of years of experience shouldn't really count because what if someone started as a Junior/Intern in a startup and had a shit ton load of work and experience throughout the person's 1-year there and another person got a job to only maintain or build minor features for an already existing product. Crazy Right?!...Well, I've gotten in at least more than 5 Tests and interviews altogether. Not good numbers honestly but I'm staying hopeful.

   Since I have identified this as a primary problem, I need to get to working on solving it. How?

- **Start writing** : I have a very interesting mind but I don't interact much with people. It'd be nice to build a community  of some sort of people with likewise controversial thoughts especially about tech.

- **Reach out to more people** : This pains me to write cause it's almost just too hard for me to randomly reach out to people(Strangers!! Especially when our parent has told us not to talk to them😪)

- **Build more useful real-life projects** : This is probably the most easiest on this list cause I do this practically everyday. Turns out Coding is only but a small fraction of the actual work.

- **Building a social presence(LinkedIn, Twitter)** : Probably not that important but it'll  create awareness on what I do and keep my DMs flowing with Jobs and opportunities(Or so they say).

- **GOD FIRST** : The most important to me, I guess. I may not be too spiritual but I damn well believe God is real and he works wonders so it'd be foolish to depend solely on my works and not bring him in.

This is my plan to turn a new leaf and not quit until I get a new and interesting offer. Hopefully, it works.

STAY CURIOUS!!!
Dance to the beat: ThreeJS Drum Set
Tags: threejs, drumset, music
Published: 2022-10-03 22:15:48

Just wanted to share with you my latest toy: [ThreeJS Drum Set](https://johnboncalos.me/drumset/)

Made with: [ThreeJS Editor](https://threejs.org/editor/)

Drum model from Vaclav Marena [sketchfab](https://sketchfab.com/3d-models/drum-kit-for-your-band-afd79a4ba8fc4cd18971e125c772a565)

Drum Sounds from various Sound repos:
[soundcamp.org](https://soundcamp.org/)
[bigsoundbank.com](https://bigsoundbank.com/)
[fesliyanstudios.com](https://www.fesliyanstudios.com/)
[freewavesamples.com](https://freewavesamples.com)
Thanks muchos!

x
Linear Search
Tags: algorithms, python
Published: 2022-10-03 22:05:40

Linear search algorithm.

Given an array of items.
You want to find the given index of an element.
The linear search algorithm returns the index of the element, or -1 if the element is not found.

Linear search works by going through the array from index 0,....n-1 
comparing array[index] to element.
If they match you return the index.

if the array elements are compared from index 0 to n-1 and no element matches the element.
you return -1.

Hence the pseudo code
Loop through  array from index =  0, to n-1.
if array[index] = element
return index 

return - 1


Time Complexity is O(n).
because we are looping through the array n times.
Space Complexity is O(1).
We are not creating any new variable and hence using constant space complexity
Ng-News: Episode 22/39
Tags: javascript, angular, webdev, programming
Published: 2022-10-03 21:20:52


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/85y9xdyjob6ml9y800zj.png){% embed https://youtu.be/b_fq7nv53z0 %}

## Enea Jahollari: It's ok to use function calls in Angular templates

Calling functions within a template is a known code smell. We shouldn't do that. The function will unnecessarily run multiple times because the change detection triggers it.

As always, there are exceptions to the rule. One of them is the pipe. By default, it is a normal function with a built-in cache.

Enea Jahollari explains in his article how the pipe works and how we can apply the same principles to our own functions. 

As a bonus, he explains the raw source code, the Angular compiler produces out of his example.

{% embed https://dev.to/eneajaho/its-ok-to-use-function-calls-in-angular-templates-4029 %}

## Tim Deschryver: Watch out what you expose with Angular Interceptors

In his latest article, Tim Deschryver points out potential security risks and how to deal with them when we use HTTP interceptors. especially when an interceptor adds authentication tokens to the HTTP headers.

By default, every endpoint receives this token which is surely not the best way.

https://timdeschryver.dev/blog/watch-out-what-you-expose-with-angular-interceptors

## Dany Paredes: How to build Compound Components in Angular

Another interesting article comes from Dany Parades. He discusses the compound component pattern. 

Whenever a component should be flexible in terms of its usage or visualisation, you can split it up into multiple pieces, all working together using techniques like content projection or @ContentChild, etc. 

https://www.danywalls.com/how-to-build-compound-components-in-angular

## TypeScript 10th year anniversary

As they say, time flies. TypeScript has already its 10-year anniversary. If you are in for history or nostalgia, you can read the anniversary blog post from Daniel Rosenwasser or watch Anders Hejlsberg at the GOTO conference where he presented TypeScript to the world for the first time.

Other than that, we have new minor versions. Jest, a testing framework, to 29.1 with improved support for types. Cypress, also a testing framework, to 10.9 with new features in the area of multi-domain switching. And nx, an alternative to the Angular CLI, to 14.8.

{% embed https://youtu.be/3dqZW_DqHIQ %}

{% embed https://devblogs.microsoft.com/typescript/ten-years-of-typescript/ %}

## Minor Version Releases

Jest was released in 29.1 with improved support for type inference.

[Release Notes](https://github.com/facebook/jest/blob/main/CHANGELOG.md#2910)

---

Cypress in 10.9 with new features for multi domain switching.

[Release Notes](https://docs.cypress.io/guides/references/changelog#10-9-0)

---

Nx 14.8: [Release Notes](https://github.com/nrwl/nx/releases/tag/14.8.0)
CSS-Only Type Grinding: Casting Tokens (sm|md|etc) into Useful CSS Values
Tags: css, programming, webdev, api
Published: 2022-10-03 21:19:29

Ready for brand new CSS magic?

![Gif of a person wiggling their fingers, looking right at the camera, and saying the word "magic"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nqgfe4oj3fqube2vqrtq.gif)

If you're writing a sharable component or library and want to provide your dev users an API that has CSS options like:

`--size: sm;` | `--size: md;` | `--size: lg;`

it's actually possible to do in CSS, without involving JS, a build system, or Style/Container Queries thanks to a new technique I've named "Type Grinding."

Type Grinding allows your design tokens (keywords, or “[&lt;custom-ident&gt;](https://www.w3.org/TR/css-values-4/#custom-idents)” values) written in your CSS to be transformed into any other values - like width, padding, color, etc - without relying on anything outside of CSS.

![gif of css token values changing other properties without js](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n6uiu25s1zos33c0rt2x.gif)

The current global user support is 72.77% [according to caniuse](https://caniuse.com/mdn-css_at-rules_property_syntax) - specifically chromium based browsers.

---

## How does it work?!

The company I work for, Bitovi, is super supportive and allowed me to drop what I was working on to write an article about this instead! So over [on the company blog](https://www.bitovi.com/blog/css-only-type-grinding-casting-tokens-into-useful-values), I'll be destructuring the CSS involved here to teach how it works, bring awareness to what's possible, and hopefully empower you to do it yourself!

Please take a look - I would LOVE to see what you do with it!

[![Screenshot of the Bitovi Article's Header](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l5dzo34kv8r89qa03ru9.png)](https://www.bitovi.com/blog/css-only-type-grinding-casting-tokens-into-useful-values)

Happy to answer questions below, [on Twitter](https://twitter.com/Jane0ri), or in the comments at the full blog post!

Thank you! 👽💜
Finger Swipe JS
Published: 2022-10-03 21:18:32

Hi guys 🙋‍♂️

I've created a **JavaScript library** which you can trigger any function **on swipe** with your finger!

It is very easy to use. And **open-source**. 

You can install it as an **NPM package**.

### Try live demo:
https://finger-swipe-js.vercel.app/

### Documentation and source code:
https://github.com/inancakduvan/finger-swipe-js

> #### _I WOULD BE GLAD IF YOU CONTRIBUTE IT_ 🎮

Still improving it, so it would be great if you:

- Check repo out,
- Contribute it,
- Open issues and requests.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jah7q0a29h4sgovvfb0t.gif)

---

## Follow me on:

**Github:** https://github.com/inancakduvan/
**Twitter:** https://twitter.com/InancAkduvan

###

Thank you everybody! 🙂