teleren/devto huggingface dataset:
What Motivates You?
Tags: codenewbie, javascript, motivation, wecoded
Published: 2020-08-17 19:13:33

Week three of learning code! I am almost finished all the JavaScript tutorials on freeCodeCamp, but I have to admit there was a point where I felt like I lost focus. 

There was a hiccup in my personal life which took up space in my mind and I just couldn't get myself to concentrate for hours at a time. But don't you worry! Life happens and I pulled myself together by taking breaks when I found my mind not thinking about code. During these breaks, I used the time to get myself inspired and remind myself why I'm doing this. After starting good read, a couple of TED talks, and meditating to get myself in the right headspace, I was ready to get back to it!

JavaScript is definitely something that I have to practice on. I'm still struggling a little with deeply understanding some JavaScript concepts, but I'm trusting the method of repetition. Learning by repetition has worked for me in the past. So here's to hoping that when I start building code using JavaScript over and over again, the code will be easier to understand. If there's anything that I've learned as an instructor is that there are many types of learners. But no matter the type of learner, when material is practiced repetitively, it brings us one step closer to mastering it. 

**Last Week's Accomplishments:**
- JavaScript Algorithms and Data Structure Certification:
  - Debugging
  - Basic Data Structures
  - Basic Algorithm Scripting
  - Object Oriented Programming
  - Functional Programming

**Check it out:**
- Videos I watched:
  - [How to Get Your Brain to Focus](https://www.youtube.com/watch?v=Hu4Yvq-g7_Y) by Chris Bailey
  - [How to Achieve Your Most Ambitious Goals](https://www.youtube.com/watch?v=TQMbvJNRpLE) by Stephen Duneier
  - [The Magic of Not Giving a F***](https://www.youtube.com/watch?v=GwRzjFQa_Og) by Sarah Knight
- Books I've stared
  - *"Girl, Wash Your Face"* by Rachel Hollis

**On my mind:**
- I would love to know how you stay motivated and what inspires you. What are some techniques you use to keep on going?

Until next week!
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/hy766eec73wcxr8jgnsn.png)
Learning to code: What have you achieved so far?
Tags: codenewbie, beginners, webdev, discuss
Published: 2020-08-17 19:09:58



So your learning Web Development huh?..
what are your current achievements to date? 
Share them in the comments below & I will pick some to share  on my Twitter (@miss_lorsx)!
I love seeing others succeed, this is what spurs me on..


##<u> My victory.. <u>##

...Is continuing to code now for just over 4 months, and not giving up, it has been an amazing journey that I can't wait to continue, I have watched tutorials, challenges and created some simple, beginner's CSS creations via Codepen, all through recommendations from the wonderful DEV community!

<b>We all love achievements, wether they are big or small - so lets share them & spread some positivity!<b>
4 Ways to Get All Characters in a String in JavaScript
Tags: javascript, webdev, beginners, programming
Published: 2020-08-17 19:01:26

*How to get all characters in a string?*

This question might sound simple at first, but in JavaScript nothing is ever what it seems.

If you google _"How to get all characters in a string"_ or _"How to get an array of characters from string"_, you will most likely find something like:

```js
var chars = "Some string".split("")

// or...

var str = "Some string"
for (var i = 0; i < str.length; i++) {
  console.log(str.charAt(i))
}
```

...and people arguing if you should use `str.charAt()` or the bracket notation.

However, these answers are usually pretty old and don't take into account one important issue...

## Emoji 🔥☠️

Or more generally: surrogate pairs. Most characters in javascript are encoded using 2 bytes, but that’s not enough to encode every symbol. To deal with this problem, emoji and some other rare symbols are encoded with a pair of 2-byte characters — a surrogate pair.

Surrogate pairs didn’t exist when JavaScript was created, so some parts of the language still treat these symbols like 2 separate characters. You can copy this snippet into your browser console to see for yourself:

```js
"💩".length
// returns 2
```

This can make the above methods sometimes return incorrect results, like this:

```js
"💩".split("") // returns ["�", "�"]
```

## ES6 to the rescue!

ES6 introduced the concept of iterators and along with it, a solution to the surrogate pairs problem.

### Array.from()

The simplest way to create an array from any iterable, including strings.

```js
const str = "✨𝄞💩"
const chars = Array.from(str)
// chars is now: ["✨","𝄞","💩"]
```

### Spread operator

The shortest way to do it, but sacrificing readability.

```js
const str = "✨𝄞💩"
const chars = [...str]
// chars is now: ["✨","𝄞","💩"]
```

### For...of loop

The most versatile and performant of the bunch.

```js
const str = "✨𝄞💩"
for (let char of str) {
  console.log(char)
}
// Logs to the console:
// "✨"
// "𝄞"
// "💩"
```

### RegExp unicode flag

If you're feeling fancy you can also use a regular expression with the unicode flag.

```js
const str = "✨𝄞💩"
const chars = str.match(/./gu)
// chars is now: ["✨","𝄞","💩"]
```

---

## Browser support

All of the above are ES6 features, which at this point, is supported pretty much everywhere, with the exception of internet explorer. If you need to support internet explorer you should transpile your code with a tool like Babel. Or just use one of the old methods, but be aware of their limitations.

---

*Thanks for reading.*

*If you know other clever ways to turn strings into character arrays, let me know in the comments, I always like learning new things.*

### Other articles you might enjoy

{% link https://dev.to/hadrysmateusz/ultimate-guide-to-file-handling-in-client-side-javascript-4ki3 %}

{% link https://dev.to/hadrysmateusz/learn-all-8-background-css-properties-in-5-minutes-2lk4 %}
13 Ways to Simplify Your DevOps Workflows
Tags: devops, kubernetes, docker, architecture
Published: 2020-08-17 18:46:18

When we interviewed Chuka Ofili — Google Developer Expert, Certified Cloud Architect, and Full Stack Gigster Engineer — for The Ops Show recently, I was more than impressed. It wasn’t just his incredible video call setup (see it here) and animated, positive outlook on life, but the way he designed his DevOps workflows into their purest forms.

Chuka takes steps to make sure his developer workflows were simple yet robust, powerful yet cloud-centric, and easily automated. “If I do something one, two, or three times, I will automate,” Chuka explained on The Ops Show.

He found the right Lean DevOps tools and tricks to do just that out of the broad landscape of possibilities. And it is big. The Cloud Native Foundation tracks around 1,425 technologies alone and the microservices landscape is even larger.

So, in order to bring some simplicity and clarity to the DevOps world, here are a few of Chuka’s DevOps workflow hacks ranging from Slack to Kubernetes to GitOps to open source cloud configurations.

His DevOps workflows stack and his fully cloud-integrated pipeline:

<b>1. Skaffold</b> — helps developers do everything locally even if your laptop doesn’t have the processing power. “Skaffold is powerful. It’s the only thing I build with on my CI server,” Chuka says, “It’s the only thing I run and you can literally use a Chromebook with low computing power for your Ops.”

<b>2. Kustomize</b> — Maintaining multiple environments and configurations becomes so much easier: Write your Kubernetes YAML files once for development, and reuse for staging, production without using template substitution!

<b>3. Docker</b> — Using Docker as his containerization tool, packaging applications with all the parts that it needs to run makes it easy to build once and run anywhere.

<b>4. CircleCI</b> — Chuka uses CircleCI combined with Skaffold to build and push his Docker images to the Google Container Registry.

<b>5. Flux</b> — Chuka used to use CircleCI Orbs but now uses Flux for as his GitOps operator for Kubernetes clusters.

<b>6. Kubernetes</b> — The final orchestrator! Automating deployment, scaling, and management of his containerized applications.

<i>Read the rest of his workflow hacks and tricks on the [CTO.ai blog](https://cto.ai/blog/13-ways-to-simplify-your-devops-workflows/)</i>
CREATE AN INSTANT HTTP SERVER for localhost development or create a public URL for clients
Tags: node, javascript
Published: 2020-08-17 18:40:16

---
title: CREATE AN INSTANT HTTP SERVER for localhost development or create a public URL for clients
published: true
description: 
tags: node, javascript
---

Learn to use the tools `http-server` and `serve` to create an instant HTTP server for static content.

Use `ngrok` to create a public URL accessible on the internet for mobile web development or for clients to view.

[![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/xb6e84yj8yc2gqelz4op.png)](https://www.youtube.com/c/JoelCodes?sub_confirmation=1)
Spell Check Commits & PRs
Tags: actionshackathon, ruby, github, showdev
Published: 2020-08-17 18:30:03

I hate having spelling mistakes in my code. I want to make sure the next person to sees my work has as few barriers to understanding it as possible. Plus as a bonus benefit, I like to discourage people from making weird abbreviations.

The GitHub Action I'm working on will expand on a GitHub Application I wrote, which can spell check commits when code is pushed to GitHub or a Pull Request is made.

### My Workflow

I'm leveraging the Hunspell library via Ruby to check against language specific dictionaries along with a few custom dictionaries I'd previous built for my GitHub Application which does the same thing.

The aspects I'm mainly focusing on are:

1. Making it work as a GitHub Action
2. Use Docker, but make sure it's super fast
3. Come up with a way people can contribute to the dictionaries easily
4. I want to add a license aspect, so I can earn some cash from people using my GitHub Action while still staying Open Source.

```yml
# Add to: .github/workflows/spellcheck.yml
name: Typo CI

on:
  push:
    branches:
      - master
  pull_request:
jobs:
  spellcheck:
    name: Typo CI (GitHub Action)
    runs-on: ubuntu-latest
    timeout-minutes: 4
    if: "!contains(github.event.head_commit.message, '[ci skip]')"
    steps:
    - name: TypoCheck
      uses: typoci/spellcheck-action@master
      # with:
        # A license can be purchased via:
        # https://gumroad.com/l/MvvBE
        # typo_ci_license_key: ${{ secrets.TYPO_CI_LICENSE_KEY }}
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

### Submission Category: 

Maintainer Must-Haves


### Link to Code

{% github https://github.com/TypoCI/spellcheck-action %}


### Additional Resources / Info

My GitHub: https://github.com/MikeRogers0
The Original Marketplace App: https://github.com/marketplace/typo-ci
Basics of Genetic Algorithms
Tags: ai, algorithms, programming, tutorial
Published: 2020-08-17 18:28:27

Learn more in [Grokking Artificial Intelligence Algorithms](https://bit.ly/gaia-manning) by Rishal Hurbans and Manning Publications

Charles Darwin proposed a theory of evolution that centers on natural selection. Natural selection is the concept that stronger members of a population are more likely to survive due to being more fit for their environment, which means they reproduce more and, thus, carry traits that are beneficial to survival to future generations—that could potentially perform better than their ancestors. This theory also applies to evolutionary algorithms; learnings from biological evolution are harnessed for finding optimal solutions to practical problems by generating diverse solutions and converging on better-performing ones over many generations.

Evolutionary algorithms aren’t applicable to solving all problems, but they are powerful for solving optimization problems in which the solution consists of a large number of permutations or choices. These problems typically consist of many valid solutions, with some being more optimal than others.

Let's have a look at a brief step-by-step process of the genetic algorithm.

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

A summary extract from [Grokking Artificial Intelligence Algorithms](https://bit.ly/gaia-manning):

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

Keep in touch ✌️I’m active on Twitter: [@RishalHurbans](https://twitter.com/RishalHurbans).

This article was originally posted on [rhurbans.com](https://rhurbans.com/).
Twitter program and cloud integration
Tags: python, aws, twitter
Published: 2020-08-17 18:27:24


Program which will read tweets from profile timeline and extract them , manipulate the text and url in string and store them on AWS Dynamo DB. 

**Stack:**
Hashicorp Vault 
AWS Dynamo DB
Twitter app (Oauth)

**OS**
Linux centos

**Python modules:**
tweepy
Boto3
hvac

Created a twitter app on https://developer.twitter.com/en by which i was able to use and integrate twitter api. Next thing i did was installed Hashicorp vault on my linux box and configure Vault service making sure it is unsealed , later i enabled kv engine v1 and added my twitter app keys & tokens to it so that my program can retrieve it when needed.I had my AWS account where i configured and created Dynamo DB table where my program will upload the tweets. 


**Project link:**
On below link inside twitter_bot/v0 folder
https://github.com/v2ishal/devlab
My Journey as a Software Developer
Tags: productivity, codenewbie
Published: 2020-08-17 17:41:55

---
title: My Journey as a Software Developer
published: true
date: 
tags: productivity, codenewbie
canonical_url: http://billyokeyo.codes/articles/my-journey-software-developer/
---

It all started with that one post i saw in twitter back in 2017. There was some workshop about something to do with Fringe Tech, I can't even recall what was being discussed there because i never understood a thing.  
Fringe Tech Ict Consultancy, is a modern Tech Company designed to increase productivity by use of innovative technology. A tech firm that aims at changing the world through solving worldly problems by using technology and giving back to the community, you can reach them through - [https://r3klaw.github.io](https://r3klaw.github.io)  
The requirements were carry your laptop and lucky me, I had a laptop and I decided to tag it along. The workshop was being held at JKUAT-Eldoret Campus.   
On the D-Day, i took my laptop and went to the gig. A lot was discussed that day and honestly I never understood a thing but at least I got out of that place a motivated me. I was so surprised that all the speakers were young guys, others who were still students and i got challenged.   
Having not been in a position to even write a simple html code really challenged me.  
I went back home opened Atom editor(I knew it for the first time in the workshop) looked at it for like 30 minutes and challenged myself to be better soon  
I started watching tutorials online on a daily basis as I taught myself how to code.  
It was a hard journey, having no one to walk me through but I was determined to be good at coding some day.   
Hard work pays as the wise men said and it surely did.   
3 years down the line, here I am having my own blog site coded from scratch, I have done other projects, collaborated with other developers. I am also a mentor to other students in my campus and the Chairman of Mount Kenya University Hackathon and Coding Community.  
I had a hard time learning and I never wanted to see someone go through that and that keeps me going for I want to help all those I can be better at coding.   
at times I do get some questions;

**What does it take to be a developer?**

1. Commitment   
2. Passion  
3. Time  
4. Practice 

**How long do you need to code so that you can know you are ready?**

There is no time span for that, we have developers who are like 1 year into coding and are good at it, others take upto 5 years. So it all depends on how consistent you are and whenever you feel you are ready go for it, most developers learn more from doing projects.

**Do I need to have an IT background to be a developer?**

Nope, we have so many guys who are self-taught programmers, all it takes is passion 

Keep coding, keep doing that one thing you want to be good at and you'll make it at the end of the day.  
And that's a brief summary on how I got into software development
Will iOS 14 support service workers in WKWebView?
Tags: ios, webdev, help
Published: 2020-08-17 18:19:07

Service worker support is currently available in Safari, but not in Apple's webview component available to developers called `WKWebView`.

But is _kind of_ changing, and I believe the answer is "apps web browsers" may now enable the Service Worker entitlement, but other apps using `WKWebView` are still not allowed to.

This is not plainly stated anywhere, here are a bunch of tweets I am using as my basis for understanding, but I'm curious if anybody understands this better than I do.

{% tweet 1275682098570027008 %}

{% tweet 1275685454852116481 %}

{% tweet 1290924232281591809 %}

{% tweet 1290924547609264128 %}

{% tweet 1290924934718459905 %}

{% tweet 1290775984065609728 %}

{% tweet 1290788391085207553 %}
Using Psychology and iOS 14's Library to Cut Down on Screentime
Tags: ios, productivity, programming
Published: 2020-08-17 18:16:38

---
title: Using Psychology and iOS 14's Library to Cut Down on Screentime
published: true
description: Cut down on screentime by implementing a single screen policy on your home screen.
tags: iOS, productivity, programming
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/9w5jir59t7luusmvju7d.png
---

I read an [article on Vox](https://www.vox.com/2018/8/8/17664580/persuasive-technology-psychology) a few years ago that talked about how social media companies use "persuasive design" to get us to use their apps longer. This got me thinking of how I can take that same concept of "persuasive design" and turn it on it's head to get you to use your phone less, rather than more.

The idea is simple and works on Android and now iOS with iOS 14: **Only one "screen" on your phone and no folder**. Basically your home screen will look like this:

![Home Screen Example](https://dev-to-uploads.s3.amazonaws.com/i/hnvubcq2aio16t5ijy79.jpeg)


I found that when I used my phone with this setup, if I put an app on the home screen, I was much more likely to use it over an app that was in my library. With that I was able to influence my own subconscious decisions for the better. I found that my social media consumption went down when I put Instagram in the Library and that I was much more likely to listen to an Audiobook over Spotify during the day if I had the Audible app where Spotify normally lives in my dock. These are just some of examples, but you get the idea.

What do you think about setting up your home screen like this. Do you agree? Let me know down in the comments.
Getting Rails ApplicationController.renderer to render images and know about the Rack session
Tags: rails, rack, components
Published: 2020-08-17 18:15:59

This is going to be a really short one. It took me several hours to figure both of the following tricks out, so I figured I'd share for the next dev who gets stumped like I was. 

Let's say you're rendering a chunk of HTML somewhere other than in a view, using Rails `ApplicationController.renderer` approach. As you might have figured out, this sets up a renderer with a **default** request environment, which is probably fine for your average partial or whatever. 

### But I need images!

Right, so, you've noticed that your `img` tags aren't rendering properly because the default request environment sets up as "example.com" instead of localhost or whatever your actual deployed host might be. So we need to get in there and override some things in our fancy-pants custom renderer:

```ruby
renderer = ApplicationController.renderer.new(
  http_host: request.host_with_port,
  https: (request.protocol == "https://")
)

renderer.render(
  partial: "widgets/something",
  layout: false
)
```

This ensures your renderer knows about your current _actual_ request environment's host, port, and protocol, which will enable the `img` tags to be rendered correctly with proper URLs.

### What about the session stuff?

Yeah, so in some weird circumstances, you might have a partial, or a [component](https://github.com/github/view_component), and you need it to render in some out-of-band way, maybe using web socket-driven [DOM mutations](https://github.com/hopsoft/cable_ready), say, and you need access to all the normal stuff from the Rack session. Here ya go:

```ruby
renderer = ApplicationController.renderer.new(
  http_host: request.host_with_port,
  https: (request.protocol == "https://"),
  "rack.session": request.session
)

renderer.render(
  partial: "widgets/something",
  layout: false
)
```

n.b. Depending on your circumstance, you _might_ actually have access to an instantiated legit controller; in this case, you might also get away with this:

```ruby
controller.render_to_string(
  partial: "widgets/something",
  layout: false
)
```

...but if you don't have a controller instance, but you _do_ need images and session access, the above trick should help you out!
Tag management just became a whole lot cooler
Tags: tagmanagement, analytics, gtm, googletagmanager
Published: 2020-08-17 17:55:59

You may have come across tag management during the recent years, as a new way of adding marketing tags to a website.

It's main use-case is to easily and flexibly implement analytics tags or marketing snippets in a scalable way. Technically, it is just a JavaScript library with which you can generate other tags in the source code.

Though the [advantages of tag management](https://bluerivermountains.com/en/tag-management#advantages) with GTM (Google Tag Manager) are based on enabling marketers to do analytics and advertising, this is not (anymore) the main thing to do with it:

Google has just released **back-end tagging with GTM**, which is currently in Beta.

You host a back-end tagging container on a Google Cloud instance and run it from App Engine. Then you assign a custom subdomain to it.

## Advantages of back-end tagging
You can proxy all Google Analytics or add requests through your custom subdomain and thereby have all cookies in a first-party context. Why is that important? - Well, in the past Safari and other browsers took many steps against third-party cookies that would either block or purge them after a short period of time.

The result is that the same users are not recognized anymore and tracking data is artificially inflated. - Well not anymore!

Running a back-end container also allows you to [host common scripts like analytics.js or gtag.js yourself] (https://youtu.be/6OGbOh216mU) and not rely on third-party servers.

## Limitations
The code you can run on the backend is either a pre-defined template, or a custom template you create yourself. To create a template yourself, you will have to use [GTMs serverside APIs](https://developers.google.com/tag-manager/serverside/api), but there are plenty.

You can read out and modify request headers, bodies and the same with responses. You can also send get requests to other servers and so chaining APIs together may be a new interesting possibility. Previously it was possible from the frontend too, but that imposed security issues, which are solved when handling the data in the server.

What will or will not be possible is largely dependent on the provided APIs. But no matter what, tag management is definitely moving in an interesting direction, making it possible to run code serverside and hence making room for a lot a never before seen implementation flexibility.

## Conclusion
Though serverside tagging is still in Beta, the available APIs already give us a good hint of what will be possible. We are still at an early stage, but I think it is save to say that tag management systems became a whole lot more attractive for backend developers now too, given this paradigm shift.