teleren/devto huggingface dataset:
Better if statement w/ ternary operator ? : 💻
Tags: webdev, javascript, productivity
Published: 2019-02-05 20:45:48

---
title: Better if statement w/ ternary operator ? : 💻
published: true
description: A quick article to introduce you the ternary operator
tags: #webdev #javascript #productivity
cover_image: https://thepracticaldev.s3.amazonaws.com/i/3c7bsxpvfuk4v35vgnkj.jpg
---


The **if operator** is a mainstay of computer programming, we use it everywhere.

Sometimes we need to test a value to then, execute some simple code: 

```

if (a === b) {
	console.log('true');
} else {
	console.log('false');
}

```


This syntax is really **clear** and **simple** to use, but it takes a lot of place.
 
In a large-scale program, it can reduce the **visibility** and **comprehension** of the whole.

For a simple case like this, it's often more simple to use the **ternary operator**.

## Syntax 


```
(condition) ? (operation A) : (operation B)

```

This operator is very useful but often **unknown** or **misunderstood** by programmers.

**Details**:
    - condition, the condition
    - operation A, the action to execute if the condition returns true
    - operation B, the action to execute if the condition is false, concretely an else

## Example 

Here is a simple example in javascript :

```
// If the age >= 18, then the adult variable takes the value true, otherwise, it's taking the value 
//false

age >= 18 ? adult = true : adult = false

// With a basic if statement

if (age >= 18 ) {
    adult = true
} else {
    adult = false
}
```
**Way simpler no?**

Another example: a function which returns the **GCD** of a and b.
However it's not the best example at all. 

Indeed, it's not easy to read, a **normal if statement** will be **better** in this case. 


```
function gcd(a, b) {
 
    return ( (a%b) === 0 ?  b : gcd(b, a%b) )

}


```


## Conclusion

To conclude, this notation is really **helpful** and help us **increase** our **productivity**.
However, it has to be used in really **simple cases**.

For complex statements or operations, the if / else notation is still the **best** way!

**Thanks for reading me 😇**
GoLang implementation of how blockchain achieves immutability
Tags: opensource, go, blockchain
Published: 2019-02-05 20:14:25

---
title: GoLang implementation of how blockchain achieves immutability
published: true
description: I promised you a blockchain immutability theory demonstration implemented in Go... here we go!
tags: opensource, golang, blockchain
---

In my previous article, I theoreticized on [How blockchain achieves immutability](https://dev.to/blocksbylukas/how-blockchain-achieves-immutability-op9).

Time to focus on practice.

{% twitter 1092446714542342144 %}

Let me know if you have any questions or doubts about the theory or this particular Go code, I am happy to help, answer!

For more blocks checkout my Twitter-chain: https://twitter.com/BlocksByLukas
Which Do You Value More, Your Time or Your Privacy?
Tags: discuss, healthydebate
Published: 2019-02-05 20:00:00

---
title: Which Do You Value More, Your Time or Your Privacy?
published: true
description: Are you willing to share your personal data in the name of time? 
tags: discuss, healthydebate
cover_image: https://thepracticaldev.s3.amazonaws.com/i/4jv19uivtvncycxyjuxj.jpg
---

Privacy advocates and anti-big-tech individuals seem to be very outspoken about the dangers of technology and centralized information, but you never hear much from the other side. The way I see it there are two groups of people. 1) Those who value privacy over time and 2) Those who value time over privacy. Let’s take a closer look at the two.

#Team Privacy

As a member of team privacy, you value your privacy. 

**You would rather spend a little extra time doing something yourself than giving up your personal information to let technology do it for you.** 

You tend to distrust big business and prefer to use products and apps built by smaller companies you trust. 

#Team Time

As a member of team time, you value your time. 

**You don’t mind giving up a chunk of your personal info in exchange for the convenience technology brings and the time it can save you.**

You tend to use products and apps built by bigger tech companies because they're easier to get started with and they seamlessly integrate your information across your devices and accounts.

#Which are you?

<blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">Are you on <a href="https://twitter.com/hashtag/teamprivacy?src=hash&amp;ref_src=twsrc%5Etfw">#teamprivacy</a> or <a href="https://twitter.com/hashtag/teamtime?src=hash&amp;ref_src=twsrc%5Etfw">#teamtime</a>? <a href="https://t.co/H6wKyVzK7L">https://t.co/H6wKyVzK7L</a></p>&mdash; Josh Hadik (@JoshHadik) <a href="https://twitter.com/JoshHadik/status/1092908335580495872?ref_src=twsrc%5Etfw">February 5, 2019</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> 

*Feel free to defend your side if you want, just keep it friendly!*

Are you on #teamprivacy or #teamtime?
Serverless for small projects = 💯
Tags: serverless, lambda, aws, devops
Published: 2019-02-05 19:40:14

---
title: Serverless for small projects = 💯
published: true
description: Serverless is all the rage nowadays, here are the benefits it provided when I started a smaller project.
tags: serverless,lambda,aws,devops
---

Serverless is an [event-driven framework](https://serverless.com/) that I can confidently say is now my **go-to for small projects**. Paired with the one-click devops solutions that [AWS](https://aws.amazon.com/) provides, I can dedicate time to the project itself instead of trying to implement a fully-fledged production architecture right off the bat.

<img src="https://raw.githubusercontent.com/serverless/assets/master/Icon/Framework/PNG/Serverless_Framework-icon01.png" width="350" />

I started on a side project recently and chose Serverless to see what it was all about. Here are some _a-ha!_ moments that made me happy with my decision:

#### Familiar build process with [`serverless-webpack`](https://github.com/serverless-heaven/serverless-webpack) ⚙️
  - Node/React/TypeScript/Babel/other buzzwords

#### 100% uptime ⏱ 
  - No 'sleeping' like other free tiers *\*cough\** [Heroku](https://devcenter.heroku.com/articles/free-dyno-hours#dyno-sleeping) *\*cough\**

#### Instant local server with [`serverless-offline`](https://github.com/dherault/serverless-offline) 🛠
  - Emulates [AWS λ](https://aws.amazon.com/lambda) and [API Gateway](https://aws.amazon.com/api-gateway) with no config needed

#### Effortless deploys 🚀 
  - Deploy to CloudFront with `sls deploy`
    - Custom domains with [`serverless-domain-manager`](https://github.com/amplify-education/serverless-domain-manager)
  - Deploy to S3 with [`serverless-finch`](https://github.com/fernando-mc/serverless-finch)

#### Easy domain/SSL 🔒
  - Purchased domain on Route53, one-click DNS config
  - Free [Amazon-issued SSL cert](https://aws.amazon.com/certificate-manager/), one click to use with CloudFront

---

And just to cover both sides, here are some gripes I had:
 - Initial AWS credential setup was a [hassle](https://serverless.com/framework/docs/providers/aws/guide/credentials/), but only need to do it once.
 - I'm [locked in](https://www.theregister.co.uk/2017/11/06/coreos_kubernetes_v_world/) for the time being. But obviously if I breach $100k in AWS bills, I'll have the resources to build on Kubernetes.

And that's my case for Serverless in this context. For small projects, the trade-offs are self-evident. Stay tuned for more on how to start your own! ⚡️
Challenges
Tags: discuss, beginners, frontend, motivation
Published: 2019-02-05 19:12:19

---
title: Challenges
published: true
description: Start February with the right foot
tags: discuss, beginners, frontend, motivation
---

So ... we are starting February, what about the goals of the year? already saved them for the next one like me 😅?

Well, it's not about making you feel bad or demotivate you, is the opposite, I'm here to tell you about some challenges that maybe you didn't know.

Everyone or at least most of us know Codepen, that wonderful place where people share artworks in the form of code whether in HTML, CSS or Javascript and where we land in search of that extraordinary thing that the client wants in his site or that the designer, who is not a programmer, thought it would be nice.

Codepen publishes a challenge every week, I'm not really sure how long ago they started because until this year I paid attention of the messages that came to my notification tray😩. Each month has a specific theme and each week they give you elements and from there you let your imagination run, January was with colors and February with shapes.

Since I am not a creative person in visual terms, that is, design, I decided to get serious with these challenges, I really reaffirm how uncreative I am in these terms, but I will continue to try them with each challenge. You can enter my [codepen profile](https://codepen.io/laviku), you will not find anything awesome, but I'm working on it and [here](https://codepen.io/collection/XMoaZz/) is my collection of challenges of the year aaaand [here](https://codepen.io/challenges/2019/february/) is the first challenge for this month. 

Enjoy!!


Puedes encontrar esta entrada en español [aquí](https://laviku.tech/2019/02/05/retos/).
What is the Difference Between a Function and a Method in JavaScript?
Tags: beginners, javascript, webdev
Published: 2019-02-05 19:00:36

---
title: "What is the Difference Between a Function and a Method in JavaScript?"
published: true
description: "Functions, methods, passing a value all sound like jargon to new developers but these are key concepts to understand. What do they mean and what is the difference between them?"
tags: beginners, JavaScript, webdev
cover_image: https://res.cloudinary.com/twhiteblog/image/upload/v1549393111/Header%20Images/function.jpg
---

This article was originally posted on [my blog](https://tiffanywhite.tech/terminology-method-function/).

[Abby Snopek](https://twitter.com/snopek308) tweeted the following:


{% twitter 1080650513635569666 %}

In short: a *method* is a **function** that belongs to a class. In JavaScript, however, a *method* is a **function** that belongs to an ***object***.

Everything in JavaScript is an object; a **function** is an object; an *Array* is an object. This is a quirky design decision, but *because* most everything in JavaScript is an object, we can do neat things with  [Prototypal Inheritance](https://medium.com/javascript-scene/master-the-javascript-interview-what-s-the-difference-between-class-prototypal-inheritance-e4cd0a7562e9). The nice thing about *prototypal inheritance* is that we can manipulate several different properties on the prototype chain *at once*.

Give that above article a read for more information. Also, check out the [Inheritance and the prototype chain article on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain).

Update: I wrote this post without coffee and realized I should show some examples. Will rectify this after my java ☕.

---

### Sign Up for the Newsletter. No spam. I hate that, too.

https://buttondown.email/tiffanywhite
The many forms of work
Tags: webdev, career, beginners
Published: 2019-02-05 18:50:42

---
title: The many forms of work
published: true
description: Work isn't just writing code.
tags: webdev, career, beginners
---

When starting out, many people think work is just the tangible things you do e.g. lines of code, modules shipped, sprints run, etc.  Work is much more than that.

Examples of work I have done just from today: 
- Talking through problems with a colleague and [rubber ducking](https://en.wikipedia.org/wiki/Rubber_duck_debugging)
- Reviewing and reading old pull requests
- Drawing and writing on a whiteboard
- Having a small victory dance once the problem was solved

I had no physical output. No lines of code. Nothing shipped. But I helped a colleague with her problem and established a plan forward.  It was a very productive morning.
Fantastic! Public S3 Buckets and How to Find Them
Tags: cloudsecurity, devops, cloudengineer
Published: 2019-02-05 18:41:48

---
title: Fantastic! Public S3 Buckets and How to Find Them
published: true
description: Discover how AWS communicates the creation of S3 buckets and the implications of relaxed permissions.
tags: #cloudsecurity #devops #cloudengineer
canonical_url: https://auth0.com/blog/fantastic-public-s3-buckets-and-how-to-find-them/
---

Unwanted public S3 buckets are a continuous threat. They have been (and still are) causing havoc all over the web. There are several tools out there to help your company with finding public S3 buckets. They are almost all standalone scripts or lambda functions that query the AWS APIs via some sort of SDK (Python, Node.js, etc.).

But when centralized security is implemented, as we have done so at Auth0, this task can be performed using a data lake or any sort of system/service where logs are aggregated, analysed, and acted upon. In that regard, the first source for your AWS events is CloudTrail.

Digging around the Internet we didn't find enough resources that explained to us the different ways an S3 bucket can be made public and how to detect it in raw CloudTrail logs, so we started playing around, running tests and building queries to find that out. This blog post will guide you through our process, our findings, and our solutions.

[Read on ☁️](https://auth0.com/blog/fantastic-public-s3-buckets-and-how-to-find-them/?utm_source=dev&utm_medium=sc&utm_campaign=aueng_s3buckes)

![Fantastic! Public S3 Buckets and How to Find Them](https://thepracticaldev.s3.amazonaws.com/i/8ytpmex1qyfboap1poz6.png)
Laravel CRUD and TestCase Code Generator
Tags: laravel, vue, vuetify, codesandbox
Published: 2019-02-05 18:26:53

---
title: Laravel CRUD and TestCase Code Generator
published: true
description: 
cover_image: https://thepracticaldev.s3.amazonaws.com/i/derjs8zxut9z0ui657ni.png
tags: laravel,vue,vuetify,codesandbox
---


My tool will get easier that Laravel developer coding 
 the basic CRUD method.

{% twitter 1091905637573750784 %}

{% twitter 1091926537119494145 %}

##Using Frame Work
vuetify.js

##GitHub
{% github narith-minami/laravel-crud-and-test-code-generator %}


##URL
https://7k095m9l6q.codesandbox.io/

Let's enjoy your programming life:)
Sneak a Peek into Seasoned Software Development
Tags: discuss, advice, learning, development
Published: 2019-02-05 18:15:48

---
title: Sneak a Peek into Seasoned Software Development
published: true
tags: discuss, advice, learning, development
---

Ever wonder how other people work? How pairing or TDD looks? Wanted to be able to throw questions at people who have been at this for years? Wanted to see veterans struggle through the work?

Every so often my friend [@schmonz](https://twitter.com/schmonz) and I get together and pair-program on something. 

We thought we'd open up the doors to us working together by streaming it on Twitch.


*Tell us if you're interested and what you'd like to see. Tell us what you'd hope to get from our streaming session. We're going to have fun doing it, and we'd like to make it fun for you all too!*


About me: I've been writing software and coaching teams for a decade. My mission is to help create teams that change the world. I've mentored people in their careers in software development. People say my I have a unique talent for solving the problems that scare others away.

About schmonz: He didn't give me anything so I'll tell you what I think. First and foremost he is one of the most insightful and wise software developers I've met. He works thoughtfully and skillfully through problems, and when I look back at what he has produced it is unquestionably better than he found it. People all over the world have given praise about how much they've learned from him. I look forward to every time we talk and get to work together.

Anyway, let us know what you think!
What does FOUC stand for?
Tags: todayisearched, todayilearned
Published: 2019-02-05 18:02:24

---
title: What does FOUC stand for?
published: true
description: Flash of Unstyled Content
tags: todayisearched, todayilearned
---

 I saw the below screen on my phone earlier and shared it with the team. It went away on refresh and I couldn't reproduce it, but wanted to check that no one else was seeing it. 

@maestromac responded with, "looks like FOUC."

I had no idea what that meant but on a quick search, realized that it stands for "Flash of Unstyled Content."

Straight forward enough, but what an acronym! How is it even pronounced?! 

![jumbled-notifications](https://thepracticaldev.s3.amazonaws.com/i/kz3gd446bz9eieysexbe.png)
Top 5 DEV Comments from the Past Week
Tags: bestofdev
Published: 2019-02-05 17:45:10

---
title: Top 5 DEV Comments from the Past Week
published: true
description: Highlighting some of the best DEV comments from the past week.
tags: bestofdev
cover_image: https://res.cloudinary.com/practicaldev/image/fetch/s--7VrAA2ln--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://thepracticaldev.s3.amazonaws.com/i/qmb5wkoeywj06pd7p8ku.png
---

This is a weekly roundup of awesome DEV comments that you may have missed.  You are welcome and encouraged to boost posts and comments yourself using the **[#bestofdev](/t/bestofdev)** tag.

**[Why do you code?](https://dev.to/oieeaaaa/why-do-you-code-3i67)**, that is the question.  @theycallmenucci provided a wonderful answer:
{% devcomment 8gjm %}

There was a spirited discussion in the **[How to prevent pasting into input fields](https://dev.to/claireparker/how-to-prevent-pasting-into-input-fields-nn)**.  The original article was focused on the technical details, and was NOT advocating for this practice.  Still, @devhead captured the sentiment of many folks responding to the article with this top comment:
{% devcomment 8f08 %}

In an **[Advice for Developers in the Early Stage of their Career](https://dev.to/lauragift21/advice-for-developers-in-the-early-stage-of-their-career-252b)** thread, @keptoman shared some insights now that they're three years in:
{% devcomment 8e6a %}

Responding to the prompt of: **[In programming, is it better to have many small files or one large file?](https://dev.to/cecilelebleu/in-programming-is-it-better-to-have-many-small-files-or-one-large-file-1oom)**, @dmfay really breaks down the abstraction of "files" itself:
{% devcomment 8hff %}

Finally, in a discussion about **[What are the least intuitive fundamentals and best practices in software development?](https://dev.to/ben/what-are-the-least-intuitive-fundamentals-and-best-practices-in-software-development-1945)**, @matthewbdaly explains the counter-intuitive impact about how adding developers to a project really affects development speed:
{% devcomment 8fc1 %}

See you next week for more great comments ✌
Setup for AWS centralised logging
Tags: ruby, aws, logging
Published: 2019-02-05 17:20:42

---
title: Setup for AWS centralised logging
published: true
description: AWS centralised logging
tags: ruby, aws, logging
---

What will be a better setup for centralised logging(application logs) for multiple instances(rails apps) running behind an AWS application load balancer?

    - ELK (manual setup)
    - AWS ElasticSearch
    - APN (AWS Partner Networks) like datadog, spluk
Orchid is now more Kotlin than Java!
Tags: showdev, orchid, static, webdev
Published: 2019-02-05 17:04:43

---
title: Orchid is now more Kotlin than Java!
published: true
description: Orchid is now more Kotlin than Java!
tags: 
- showdev
- orchid
- static
- webdev
---

Just wanted to share a quick win here. After over a year of slowly migrating the Orchid codebase from Java to Kotlin, it's officially more of a Kotlin project than a Java project!

![https://thepracticaldev.s3.amazonaws.com/i/qs5p7nkxymq9i2c26uwz.png](https://thepracticaldev.s3.amazonaws.com/i/qs5p7nkxymq9i2c26uwz.png)

Orchid has a couple other small wins that I'll be sharing in the next few days as well, stay tuned!

{% github JavaEden/Orchid %}
Hardware idea
Tags: productivity, idea, hardware
Published: 2019-02-05 16:51:41

---
title: Hardware idea
published: true
description: Hardware idea for programmers
tags: productivity, idea, hardware
cover_image: https://thepracticaldev.s3.amazonaws.com/i/qhd0wtvs1rgmfi9dko0o.png
---
Hardware is probably too big word for what I have in mind. A gadget? Helper?

## Problem
I am learning to touch type. Right now I can pretty much type all words without looking on the keyboard. 
Problem starts when I have to write code. Beside typing names for variables, functions and methods I have to type language specyfic syntax:
`: ; " ' { [ ] } - + = ( )`  ...at least in JavaScript world. 
When I order my 'pinky' finger to press minus keycap, the process to show the minus sign on screen is something like this:
`[]` backspace `0` backspace `-` . Sometimes it takes me more steps to finally have what I want. Or even worse, eventually I have to look at the keyboard...

## Solution
On J and F keycaps on the standard keyboard there is this raised dot or bar. This is an indicator for index fingers to find home row without looking.
Cool idea that is very helpful. 
What if there were similar indicators for 'pinky' fingers?😄 On those hard to aim and reach keycaps. 

![layout](https://thepracticaldev.s3.amazonaws.com/i/tpgvrxl306t0rubbihro.png)

When reaching to that keycap you can instantly know if you are about to press correct key.
There could be indicators only on `0` and `1`. Or there could be some additional on `[` or even `\`. 
Of course, there is no limitation to shape. Only one condition: shapes need to be easily distinguishable.

![bumps](https://thepracticaldev.s3.amazonaws.com/i/frse7o2kth71yls9pjqy.png)

How to modify a keyboard like that?
STICKERS!!!
Black vinyl stickers. Transparent stickers. Anything that will have this 'bump'.

What do you think?
Is this idea valid?
Would it help you?

I think it would help me. 😅
PVS-Studio for Java
Tags: java
Published: 2019-02-05 16:22:08

---
title: PVS-Studio for Java
published: true
description: PVS-Studio static analyzer for Java
tags: java
---

In the seventh version of the PVS-Studio static analyzer, we added support of the Java language. It's time for a brief story of how we've started making support of the Java language, how far we've come, and what is in our further plans. Of course, [this article](https://www.viva64.com/en/b/0603/) will list first analyzer trials on open source projects.
Scraper para DEV desde Emacs
Published: 2018-11-21 13:34:11

---
title: Scraper para DEV desde Emacs
published: true
tags: 
canonical_url: https://yorodm.github.io/blog/web-scrapping-emacs/
series: scraping in lisp
---

# Scrapper para DEV desde Emacs.

Recién publiqué en [DEV](https://dev.to/yorodm/scrapping-dev-with-common-lisp-6j0) un artículo acerca de como hacer un [scraper](https://es.wikipedia.org/wiki/Web_scraping) para obtener los títulos del [feed principal](https://dev.to). El artículo surgió de una discusión amistosa acerca de la relevancia de Common Lisp como tecnología en la actualidad y quedé muy satisfecho con el resultado.

Me llamó tanto la atención la simpleza detrás de las bibliotecas utilizadas que decidí ver si había una para Emacs Lisp y… TL;DR, aquí está el scrapper 😍.

```
;;; Eval this in the scratch buffer, first make sure to get
;;; `elquery' from MELPA.
;;; Eval this in a buffer and get the headlines in *another* buffer
;;; named *dev*
(require 'elquery)
(let ((dev-buffer (generate-new-buffer "*dev*")))
  (with-current-buffer (url-retrieve-synchronously "https://dev.to")
    ;; Feel free to hate this
    (dolist (elt (mapcar 'elquery-text (elquery-$ "div.single-article h3"
                                                  (elquery-read-string (buffer-string)))))
      (with-current-buffer dev-buffer (insert (concat elt "\n"))))))
```