teleren/devto huggingface dataset:
Lesson 10 Discussion
Published: 2020-01-18 05:32:24

What processes and tasks, from real life, can fit into the various ways you can define a function? (Explain at least 5)

1.	In real life, computers obviously are a good example, press the “A” key and the computer takes all the binary info to show on the screen the letter “A”
2.	Living is also a good example, naturally you do many processes to live, like breathe in, breathe out, and have your heart pump blood, and that all leads to “living”
3.	With cars, starting it is turn ignition cylinder, which sparks, and combusts the cylinders, and turns the motor 
4.	Loading a website is a good example, your internet sends a request for information from a domain, then they accept the request, and start sending multiple packets that assemble on your end to display a website.
5.	Human vision is having light enter the cornea, but since it’s curved, it bends the light, then our brain corrects the orientation.
Why Conditionals?/ My attempt at a thermostat program
Tags: conditionals, ifstatements, else, elseif
Published: 2020-01-18 05:10:29

Conditionals a vital to coding because they are essential parts of building blocks. They are the structure that decides when and if a code will be executed. Conditionals are functions to be executed if other functions cannot be (true or false).

If I designed a thermostat program, it would populate users’ mobile devices with messages indicating the current temperature followed by a message that goes accordingly. For example;

Let freezing = 
Let cold = <50
Let gettingHot = >50
Let hot = <= 75
Let burning = <=101

Func whatsTheWeatherLike (_ number: Int) 
If gettingHot { 
Print( “It’s starting to get hot, no need to alarm yet but start looking for a pool”
} else if hot {
Print(“ Did you find that pool yet?”)
} else if burning {
Print ( “Alright! We’re cooking now!!”) 
} else if cold { 
“Whoa! Did you feel that bone shake or was it just me? Time to bundle up unless you’re Wim Hof.”
} else freezing {
Print (“Is Ice Age the 15th filming in town?”)
}
Granted, this code doesn’t work and there’s probably a simpler way of doing it. I’m currently learning Swift and look forward to seeing some suggestions to learn from.
How to call a function when a slider changes in SwiftUI
Tags: swiftui, swift
Published: 2020-01-18 05:10:13

---
title: How to call a function when a slider changes in SwiftUI
published: true
description: This article is going to explain how to call a function when a slider changes in SwiftUI.
tags: SwiftUI, Swift
cover_image: https://github.com/maeganjwilson/swiftui-examples/blob/master/changing-slider/image.png?raw=true
canonical_url: https://cctplus.xyz/blog/2020/01/18/slider-changes-swiftui
---

There are times you might want to call a function when a slider changes in SwiftUI. I did this recently to send out the slider's value to another device when the slider is moving. I couldn't wait to send out the final value since that would be a delayed response for the user.

After the code example, I'll explain the three steps.

```swift
import SwiftUI

struct SliderExample: View {
// 1. declare a state for the value of the slider
    @State private var value: Float = 0.0
    
// 2. create a slider with a new Binding variable
    var body: some View {
        Slider(value: Binding(
            get: {
                self.value
            },
            set: {(newValue) in
                  self.value = newValue
                  self.doSomething()
            }
        ))
    }
    
// 3. create the function to call when the slider changes value    
    func doSomething(){
        print("\(value)")
    }
}
```
# 1. Declare a state variable for the value of the slider

This is the variable that the slider is currently. It needs to be declared with a `State` property wrapper since the value is going to change. It also needs to have a `Float` type since a `Slider` needs a `Binding<Float>`.

# 2. Create a slider with a new binding variable

In this step, we are creating a Binding variable. A Binding variable is a computed property. By creating it as the value that the slider is using, we can utilize the `setter` to call the function every time the value is changing.

# 3. Create the function to call when the slider changes value

Make sure to make the function that you need to call when the slider changes values.

---

If you enjoy my posts, please consider sharing it or Buying me a Coffee!

<a href="https://www.buymeacoffee.com/maeganwilson_" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/arial-blue.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" ></a>
Search for last shell cmd
Published: 2020-01-18 05:03:37


Search for last shell cmd

I can explain this all... though the following links do that better... So would be just weird to try to explain general information. THe Elephant is gray the disk is warped.

# from DO documentation

For instance, you can type CTRL-r, and begin typing part of the previous command. You only have to type out part of the command. If it matches an unwanted command instead, you can press CTRL-r again to see the next result.

# Other stuff.. DO has a nice overview for simple things

Why explain that here as they explain it better

https://www.digitalocean.com/community/tutorials/how-to-use-bash-history-commands-and-expansions-on-a-linux-vps

# hashag giveachance
Using screenshots in markdown with VS Code
Tags: vscode, markdown, imgur
Published: 2020-01-18 04:50:54

---
title:  Using screenshots in markdown with VS Code
published: true
tags: vscode, markdown, imgur
---

[Original post in spanish](https://blog.rodrigojuarez.com/vscode/markdown/imgur/2020/01/17/vscode-imgur.html)

This post is about using Visual Studio Code to include screenshots in markdown files, so you can publish your files without upload the images or change the links (something sometimes you can't do at all)

For that we are going to use Imgur and a VS Code extension called [vscode-imgur](https://marketplace.visualstudio.com/items?itemName=MaxfieldWalker.vscode-imgur)

## Installing vscode-imgur

- We can install it from the *Extensions* panel in VS Code, searching for *vscode-imgur*

- We need to configure the Imgur credentials

    - Open the VS Code configuration with CTRL + , then search and replace the following keys
    
        - [Client_id](https://imgur.com/account/settings/apps)
        - [Client_secret](https://imgur.com/account/settings/apps)
        - [Album_id](https://dev.to/codingcoach/get-your-album-id-in-imgur-b6c)
        - User upload en true

- With your VS Code window active, you can paste an image in your clipboard using CTRL + ALT + V, this command will upload our image to Imgur and will add the link in our markdown file

- The first time we use it, we will be redirected to the Imgur for confirmation. Copy the provided pin and paste it in VS Code

![Image](https://i.imgur.com/sNLbvkS.png)

![Image](https://i.imgur.com/mosoyC4.png)
Get your album id in imgur
Tags: imgur, tools, blog
Published: 2020-01-18 04:40:08

---
title: Get your album id in imgur
published: true
tags: imgur, tools, blog
---

[Original post in spanish](https://blog.rodrigojuarez.com/imgur/tools/blog/2020/01/17/get-imgur-album-id.html)

I want to use my Imgur account as storage for the screenshots in my posts.

I'm using Visual Studio Code as my markdown editor, and I found this awesome extension that makes my life easier: [vscode-imgur](https://dev.to/codingcoach/using-screenshots-in-markdown-with-vs-code-16bi).

When I started to configure the extension, I needed the id of the album used as storage in Imgur.

I didn't found details for the albums, but if you select the Images option in your user menu

![Image](https://i.imgur.com/eBJSVtz.png)

You can open any existing album or create a new one

![Image](https://i.imgur.com/vraEXtN.png)

And in the dropdown *Edit this album* you can select the Embed Album option

![Image](https://i.imgur.com/92npFH5.png)

In that code, the highlighted part is the album id, everything after a/ in the data-id attribute

![Image](https://i.imgur.com/bEuZ7X9.png)
Gatsby Dynamic Page Creation is the Key for Blogs
Tags: gatsby
Published: 2020-01-18 04:26:04

Continuing from

{% post https://dev.to/patarapolw/my-first-gatsby-page-with-transformed-graphql-query-4d2h %}

Apparently, everything a blog requires, is dynamic page creation. The official tutorial is here. -- <https://www.gatsbyjs.org/tutorial/part-seven/>

## How I did it

- Firstly, I moved `/src/pages/index.tsx` to [/src/templates/Listing.tsx](/packages/gatsby-blog-cli/src/templates/Listing.tsx). Basically, I am gonna use it for template.
- I also created [/src/templates/Post.tsx](/packages/gatsby-blog-cli/src/templates/Post.tsx) to use to create posts.
- There are two magics on [gatsby-node.js](/packages/gatsby-blog-cli/gatsby-node.js) for this,
  - `exports.createPages`
  - `exports.onCreateNode`
- You should inspect what `slug` entails, in case you want to customize it.

```js
exports.createPages = async ({ graphql, actions, reporter }) => {
  const { createPage } = actions
  const result = await graphql(
    `
      {
        allMarkdownRemark(
          sort: { fields: [frontmatter___date], order: DESC }
        ) {
          edges {
            node {
              fields {
                slug
              }
            }
          }
        }
      }
    `)
  if (result.errors) {
    reporter.panicOnBuild('Error while running GraphQL query.')
    return
  }

  const posts = result.data.allMarkdownRemark.edges
  const postsPerPage = 5
  const numPages = Math.ceil(posts.length / postsPerPage)
  Array.from({ length: numPages }).forEach((_, i) => {
    createPage({
      path: i === 0 ? '/' : `/page/${i + 1}`,
      component: path.resolve('./src/templates/Listing.tsx'),
      context: {
        limit: postsPerPage,
        skip: i * postsPerPage,
        currentPage: i + 1,
      },
    })
  })

  posts.forEach((p) => {
    createPage({
      path: `/posts${p.node.fields.slug}`,
      component: path.resolve('./src/templates/Post.tsx'),
      context: {
        slug: p.node.fields.slug,
      },
    })
  })
}

exports.onCreateNode = ({ node, actions, getNode }) => {
  const { createNodeField } = actions
  if (node.internal.type === 'MarkdownRemark') {
    const value = createFilePath({ node, getNode })
    createNodeField({
      name: 'slug',
      node,
      value,
    })
  }
}
```

## Bonus

I am also trying to find out how to lazy load images and and iframes. I ended up using

- [lazysizes](https://github.com/aFarkas/lazysizes)
  - This allow lazyloading inside components as well.
- [gatsby-remark-lazy-load](https://www.gatsbyjs.org/packages/gatsby-remark-lazy-load) along with [gatsby-remark-images](https://www.gatsbyjs.org/packages/gatsby-remark-images/)
  - These will transform `![]()` to lazyloading.

Again, my example repo is here

{% github patarapolw/non-root-gatsby-blog no-readme %}
Discussion 11
Published: 2020-01-18 04:16:03

I believe conditionals are important because they give meaning to a value. You an assign certain int values to certain strings and it can produce a more intricate statement. 



func tStat( roomTemperature: Int, currentSetting: Int)

<p><b><u>
let heaterSetting =  roomTemperature =< currentSetting {<br>

else return kickStartHeater<br>

}<br>

let coolingSetting = roomTemperature => currentSetting{<br>

else return kickStartCooler<br>

}<br>
</b></u></p>
Full Adder
Tags: adder, turingmachine, computerscience, fulladder
Published: 2020-01-18 04:14:43

A full adder Figure 1 is a digital circuit that adds three one-bit numbers: two operands named X and Y and a carried bit named CIN. The circuit produces a two-bit output: an output carry bit named COUT and the result bit S.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/6slm25bbhkoeg7dpks3w.png)

In this practice is about compute the Turing Machine that emulates an 8-bits iterative adder, as an example in the Figure 2.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/vgs8gxdx50hamej00g7i.png)

Using the picture from the figure 1 will be something like the figure 3.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/lrz2wo1q63hgsxr8fkuq.png)

In the next figure 4 it shows of the adder works.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/j4wwvi91ls3sw0qzqkah.PNG)
                            Figure 4 Full adder 8 bits.

For the development of this practice, as a first step we must design a model for to know the functionality of the process, The symbol — means that it will decreasing, The symbol + means that it will increasing to do the movements through the process, The model is show in the Figure 5.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/eaysyp0yn62r4vc2qied.png)

                            Figure 5 The Adder’s Model.

In this table will be explained a explanation about how the model works, on the left side of the table it will show the movements in the tape, the cell with the color gray will be the header.

B=Blank, R=right, L=left,the cell in gray will the header.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/2daybih4h6u31awte4sl.png)

Conclusion

At the beginning it was difficult to understand, because I didn’t know where I should start, So I wonder, How this works? And there’s where I can figure out and make it possible. One of the things that I noticed, It’s that if you move the The Adder’s Model in the Figure 5 to the Right its a heart ❤

the code https://github.com/martincorona007/Adder
Discussion 10
Published: 2020-01-18 03:59:27

There are many different ways one could apply a function to real life situations. Our morning routine could be one of these things. From the moment we open our eyes to the moment we start our scholar day or begin our labor. Another thing we could convert into a function is making a meal we could gather the items that will be used to make our dinner and the way in which we prepare and combine these items could change the outcome of the finished product. When we ask someone for help we can also compare this to a function, depending how easy or complex we ask questions or give orders to help us with our tasks we will receive a better output. Another daily task we can put into a function is on our daily commutes, there are things that will always be the same(constants) such as the street lights we might encounter along in out drive or things that change (variables) such as the amount of traffic that will be out on that day. We could also define our daily workouts as a function. Pretty much everything and anything we do in a day can be called out as a function. Even when we are sad. for example we can make an if else statement that suggests if something is negative if would result in sadness.
Musings on CI/CD static sites and the environment
Published: 2020-01-18 03:30:56

A lot of IT people I know seem to think that they are environmentally correct due to static site deployment.

I am very interested to know how true this is.

If you have 10 static (sic) sites rebuilding on every change (say, for this exercise, one change per hour (faux user) per site via headless cms).. (so lots of unnecessary builds; possibly overlapping; every content change(save) is a build).. a lot of builds are not going to make it (but happen) and maybe also somewhere an extra cron to force a rebuild (for the customer.. in case of...) .. how is that better than one or two simple js or php site talking to the db?

The amount of power consumed is silly..

Can anyone really play the static card? their only card played is "possible" seo.. 100% Google Chrome Audit

Open discussion as I am truly interested.
linux lite os 4.8 screenshots
Tags: gnulinux, distro, screenshots
Published: 2020-01-18 02:36:42

[linux lite os](https://www.linuxliteos.com/) 4.8 screenshots

![Alt text of image](https://res.cloudinary.com/osde8info/image/upload/v1579314651/VirtualBox_llos_18_01_2020_02_24_01_zakigf.png)

![Alt text of image](https://res.cloudinary.com/osde8info/image/upload/v1579314650/VirtualBox_llos_18_01_2020_02_06_02_yu77fn.png)

![Alt text of image](https://res.cloudinary.com/osde8info/image/upload/v1579314650/VirtualBox_llos_18_01_2020_01_58_59_xl9pag.png)

![Alt text of image](https://res.cloudinary.com/osde8info/image/upload/v1579314650/VirtualBox_llos_18_01_2020_02_01_50_ykyfzw.png)
Coercion in JavaScript - 🤔 do you know what it is?
Tags: javascript, beginners, webdev, tutorial
Published: 2020-01-18 01:25:42

Let's talk about Coercion today. Simply put, coercion is the process of changing a value from one type to another. Let's see a very simple example.

```js
const number = 42
const string = String(number)
```

We're talking about explicit coercion in this example. We explicitly tell JavaScript to coerce a number into a string. The same is possible for other values. Let's see some more examples of **explicit coercion**.

```js
const num = Number("10")
const bool = Boolean(0)
const float = parseFloat("10.2")
const anotherNum = parseInt("19")
const string = String(99)
```

But there are also cases (actually a lot of them) where **implicit coercion** will happen in JS.

```js
const arr = []

if(arr.length){
   // do something
}
```

You've probably written some code like this before. In this case, implicit coercion happens in the if statement, because the if statement takes a boolean as an argument and `arr.length` returns a number. 

Another example of implicit coercion is, for example, when you use a number in a string literal like this:

```js
const num = 42
const str = `${num} pizzas for our office, please`
```

In the string literal, `num` is implicitly coerced into a string. Of course, we could also do this explicitly:

```js
const num = 42
const str = `${String(num)} pizzas for our office, please`
```

Also, coercion always happens, when you use a double equal to compare two values. It doesn't happen, when you use the triple equal:

```js
console.log("42" == 42) // true
console.log("42" === 42) // false
```

In the `"42" == 42` case, implicit coercion is done by JS, to compare equal types. That's why the comparison is true. The triple equal `===` does no implicit coercion, that's why this comparison is false.


---

Want to get better at Web Development?
[🚀🚀🚀subscribe to the Tutorial Tuesday ✉️newsletter](https://codesnacks.net/subscribe/)
apple v eu
Tags: apple, standards, eu, mobile
Published: 2020-01-18 01:18:20

https://twitter.com/SkyNews/status/1218083880714014720

https://news.sky.com/story/why-iphones-might-need-the-same-charging-cable-as-androids-in-future-11910409?dcmp=snt-sf-twitter

who will win ? 

an example of why 52% of the UK voted to LEAVE the EU
Day 72 : Proceed
Tags: hiphop, code, coding, lifelongdev
Published: 2020-01-18 00:16:25

_liner notes_:
- Professional : Pretty good day today. Got a lot of my report done. Almost there. Had a couple of meetings and caught up with teammates. Planned for my next conference trip hotel booking. Yeah, got some stuff done. Of course, it's never as much as I would like. haha

- Personal : Just got a little more work to do to prep for the radio show tomorrow. Pretty excited to broadcast from the newly renovated station. Also, on Sunday, going to meet up with some listeners of the radio show.

![Lake surrounded by mountains with an island in the middle in Spirit Island, AB, Canada](https://thepracticaldev.s3.amazonaws.com/i/bopety5hcie4cf8wiy35.png)

Going to be a long weekend. Of course, I was so focused on work that I forgot to start my laundry so I'm going to get on that after I post this. Then I'll proceed to finish up some things for the radio show and if there's time, finish up my report for work. Think that's it.

Have a great night and weekend! (Side note: Today marks the 25th Anniversary of the Roots - "do you want more?!!!??!" Thus the song attached. Such a great album!)

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube O5TUqdxqHS0 %}
I've Rediscovered How Fun Javascript Can Be, Ask Me Anything!
Tags: ama, javascript
Published: 2020-01-18 00:08:25

I remember when Javascript finally clicked for me way back in 2017.

It was magical. 

I could build apps with [weird functionality](http://shannoncrabill.com/pay-day/) without too much overhead.

Then, my focus changed, life happened. 

Nearly 3 years later (after learning OOP, Ruby, and Ruby on Rails in the meantime) I'm back on the Javascript train and ready to keep experimenting and learning. 

AMA.
cloudinary updates you may have missed
Tags: images, vue, imageprocessing
Published: 2020-01-17 23:11:08

cloudinary updates you may have missed

* [cloudinary T&Cs (updated nov 2019)](https://cloudinary.com/product_updates/updates_to_cloudinary_s_terms_of_service)
* [cloudinary training academy](https://training.cloudinary.com/)
* [cloudinary auto gravity](https://cloudinary.com/documentation/cloudinary_object_aware_cropping_addon?query=object%20&c_query=Cloudinary%20Object-Aware%20Cropping#specifying_objects_to_avoid_using_auto_gravity)
* [cloudinary vue example](https://support.cloudinary.com/hc/en-us/articles/360011139699)
Who's interested in a Svelte/Sapper course based on a real world web app?
Tags: svelte, webdev, course, education
Published: 2020-01-17 22:50:00

**Update:** This is now available at www.mikenikles.com/cloud-native-web-development as a hands-on guidebook.

Hello dev.to community members interested in Svelte/Sapper,

There are a number of great online courses to learn the basics of Svelte. Also, [the official tutorial](https://svelte.dev/tutorial/basics) is a must-complete resource to get started.

I've used Svelte/Sapper for about a year on a production web app and shared [why I moved from React to Svelte](https://dev.to/mikenikles/why-i-moved-from-react-to-svelte-and-others-will-follow-210l).

However, what I think is missing is a more in-depth course based on a larger, real-world web application. If there's interest, I'm considering to open source my web application that uses the following:
* Svelte / Sapper
* Tailwind CSS
* Deployed to Firebase Hosting
* Firestore (with realtime updates in the browser)
* Cloud Functions
* CI / CD

The course would be split into small, ~10 minute videos with corresponding pull requests and a write-up for people who prefer text over video. It would explain concepts as and when they arise, e.g. components, props, slots, SSR, deployments, progressive web app, etc.

Who would be interested? What (else) would you like to be included?