teleren/devto huggingface dataset:
Do you use pictures from Unsplash? You might want to think twice
Tags: discuss, copyright, unsplash
Published: 2019-07-17 08:16:26

I came upon this article in my news feed this week and it made me think on how many times I went to Unsplash for a nice picture. I'm not saying it's a common thing, but like insurance and accidents, it's enough to happen once to mess things up. I think I'm going to stick with my own pictures and only use illustrations from [unDraw](https://undraw.co/). Like the one I'm using for this article. Hashtag `#notsponsored`.

---

## [How Using Unsplash Got This Photographer Into Legal Trouble](https://www.thephoblographer.com/2019/07/15/unsplash-copyright-infringement/)

---

So here are my questions to you related to this topic:

Where do you pick your images for blog posts and social media? Do you care where it comes from? Are you making sure you're on the "safe" side of the rules?
The Fullstack Angular Developer
Tags: angular, nestjs, fullstack, typescript
Published: 2019-07-17 07:58:32

---
title: The Fullstack Angular Developer
published: true
description: NestJS for the Angular developer
tags: Angular, NestJS, Fullstack, TypeScript
---

TLDR: The parallels between an Angular and NestJS app are striking. You can share types, functions et al between the two platforms, allowing you, an Angular developer, to write a fully featured Backend application using Angular paradigms.

My thoughts on the term “Fullstack” are firmly attached to a pendulum. It’s currently swinging in the region of “there is no such thing”. Each discipline alone is too broad to have in-depth knowledge on both. You may be able to spin up an API server with Express, but that doesn’t make you “Fullstack”.


![](https://media.giphy.com/media/a93jwI0wkWTQs/giphy.gif)

Nevertheless, the term Fullstack is present in our industry and I've seen a number of job postings that have a React + NodeJS pairing. This got me thinking about what the stack would be in the Angular ecosystem. Behold, NestJS.

We recently had to build a feature that required some Restful APIs. In order not to be blocked, we went down the "easier" 🤨 route of creating our own with NodeJS. We were already using Nx to manage our monorepo so it was trivial to add NestJS to our project.

The learning curve was next to nothing. NestJS was heavily inspired by Angular, so you'll feel right at home. TypeScript, Decorators, Services, Modules etc are all featured in Nest. It also does a really good job at abstracting some key concepts when it comes to creating Restful API's. HTTP response codes are automatically returned. Get, Post methods and a majority of other enhanced functionality are handled by decorators.

The biggest barrier I find when learning a new framework or library is the documentation and lack of available resources. Thankfully this is not an issue with NestJS. The docs are beautiful and due to the rise in popularity of Nest, there are a ton of helpful resources. In addition to that, there are schematics for the Angular CLI, so scaffolding is a breeze.

Eventually, I see the Angular + Nest stack becoming the de facto for full stack Angular Applications. The low barrier to entry for Angular developers makes it a dream pairing.
How do you analyze your CSS?
Tags: css, discuss
Published: 2019-07-17 07:54:16

Recently I posted a question on Twitter:

<blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">Hi developers!<br>I wanted to ask you a question about <a href="https://twitter.com/hashtag/CSS?src=hash&amp;ref_src=twsrc%5Etfw">#CSS</a>. <br><br>1) Do you test your CSS? How do you do it?<br>2) If not, why not?<br><br>I often use Specificity Visualiser for comparing versions.<a href="https://t.co/ncNIvBWk5L">https://t.co/ncNIvBWk5L</a><br><br>And recently CSS Stats tool: <a href="https://t.co/mmOLY7gyyW">https://t.co/mmOLY7gyyW</a>.<br><br>Any suggestions? <a href="https://t.co/nC0RGvaKfX">pic.twitter.com/nC0RGvaKfX</a></p>&mdash; Silvestar Bistrović (@malimirkeccita) <a href="https://twitter.com/malimirkeccita/status/1149382859775496194?ref_src=twsrc%5Etfw">July 11, 2019</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

I got only one response, but it was significant. [Bart Veneman](https://twitter.com/bartveneman) posted [his tools](https://www.projectwallace.com/oss) for CSS analysis. It was a great discovery for me. I am playing with these tools ever since, and I am trying to learn new ways to analyze my CSS files.

Before this, I often used [CSS Stats](https://cssstats.com/) to see the performance of my CSS, and [Specificity Visualizer](https://isellsoap.github.io/specificity-visualizer/) to see the specificity graph.

CSS is still a very underrated part of the web technology stack. Tools like these are the right step in bringing attention to the importance of the efficient and performant CSS code.

Do you know of any other tool? How do you use it? What in particular, are you looking for in these analyses?
How to use reflection to test private and protected methods
Tags: articles, php, testing
Published: 2019-07-17 13:56:00

---
title: How to use reflection to test private and protected methods
published: true
tags: Articles,PHP,Testing,php
canonical_url: https://42coders.com/how-to-use-reflection-to-test-private-and-protected-methods/
---

Developing application with TDD methodology we tend to achieve the highest possible code coverage, including private and protected methods as well. But writing unit test for a non public method is not trivial. Changing the visibility for the sake of unit tests is not a good idea. In these cases we can use php’s reflection to make those methods accessible, let’s see how.

## Methods

Create new Reflection class from our class:

```
$class = new \ReflectionClass('MyNamespace\MyClass');
```

Get the private/protected method:

```
$myProtectedMethod = $class->getMethod('myProtectedMethod');
```

Make it accessible:

```
$myProtectedMethod->setAccessible(true);
```

Create and instance from our class:

```
$myInstance = new MyClass();
```

Call the method with arguments on the instance created above:

```
$result = $myProtectedMethod->invokeArgs($myInstance, [$argument1, $argument2]);
```

## Properties

In similar way we can we can change the visibility of the non public properties of a class. This could be useful when we want to unit test edge cases or error handling, and we want to change the internal state of the instance to simulate the erroneous behaviour.

Create new Reflection class from our class:

```
$class = new \ReflectionClass('MyNamespace\MyClass');
```

Get the private/protected property:

```
$myProtectedProperty = $class->getProperty(myProtectedProperty);
```

Make it accessible:

```
$myProtectedProperty->setAccessible(true);
```

Create and instance from our class:

```
$myInstance = new MyClass();
```

Set the value of the property on the created instance:

```
$myProtectedProperty->setValue($myInstance, 'value');
```

You can find more information about the reflection in the php documentation: [https://www.php.net/manual/en/book.reflection.php](https://www.php.net/manual/en/book.reflection.php)

The post [How to use reflection to test private and protected methods](https://42coders.com/how-to-use-reflection-to-test-private-and-protected-methods/) appeared first on [42 Coders](https://42coders.com).
Throttle and Debounce
Tags: webdev
Published: 2019-07-17 06:48:10

---
title: Throttle and Debounce
published: true
description: 
tags: webdev
---

I think they are so cool techniques to prevent running a function too many times. There is a little difference between them and it confused me before thinking about it.

When I started to think about it (it was today, because I needed to use them), it started to seem easy to know what I need to use.

First, we need to decide what we want to do. 

If we want to make **limitation** on a function which runs every time when an event occurred, we can use the **throttle.** We can use the throttle to decrease the number of calls. Let's imagine you're running a function when the mouse is moved. So, every time the function will run.
You might want to limit it to run every 2 seconds. The function will run only every 2 seconds while the mouse is moving.
You limited it and decreased the number of calls.

If we want to **defer** a function call until an event is completed, we need to use **debouncing**. There is a quick example of it. Let's imagine you want to make a search box that will give the suggestions according to the text to the user. Will you make a query in your database when the user hit to the keyboard every time? Of course, no! Because it'll hurt your database, right? You need to defer making query until the user stopped typing. You can say, make a query when if the user won't type anything in  500ms. It's **debouncing**.

---

**Throttle** will run after every **X** time.

**Debounce** will run only once when an event is done.

---

There is also a great demo to fully demonstrate how they work.

You can check it out: <a href="http://demo.nimius.net/debounce_throttle" target="_blank">Throttle - Debounce Demo</a>
Union Budget 2019 for Healthcare Industry
Tags: healthcareindustry, unionbudgetforhealthcare, healthcarebudget2019, unionhealthcarebudget2019
Published: 2019-07-17 07:27:45

Let's discuss how industry leaders are reacting over the union budget for the healthcare industry in 2019-20. According to the source, this budget is to enhance mobile app development for healthcare.

https://yourstory.com/mystory/union-budget-2019-for-healthcare-industry
Can Salesforce components be customised easily?
Tags: help, salesforce, customization, development
Published: 2019-07-17 05:16:56

---
title: Can Salesforce components be customised easily?
published: true
tags: help, salesforce, customization, development
---

Hi Devs!

Just wondering if you could help with this, as I don't have any experience with Salesforce. 

I was asked if Salesforce components can be customised easily? If so, are there any best practices to do it?

For instance, in a table component, there are icon that have a drop-down functionality – How easy (or impossible) is to change the icon?

Many thanks to all!
Do you think functional code readable ?
Tags: discuss, functional
Published: 2019-07-17 05:11:14

Functional programming paradigm aims at correctness and beauty. It produces the most elegant piece of code with a streamlined look and feel.

Personally, I can effortlessly write functional code and would like to write it rather than procedural or object-oriented code. It's more straightforward for me: I'd like to use `map` rather than for-loop.

But because most of my colleagues just don't get functional programming, they claim my code is unreadable, so unmaintainable. Beginners are scared away from my code.

A sample of my code, making use of `lodash` a lot:

```javascript
const get_piece = (board, x, y) =>
  _.chain(board.pieces)
    .filter(piece => piece.current_x == x && piece.current_y == y)
    .first()
    .value();

const process_move = (move, board) => {
  // FIXME the move should be specified by absolute coeff of the piece to move
  const to_move_x = board.hole_x + move[0];
  const to_move_y = board.hole_y + move[1];

  const piece = get_piece(board, to_move_x, to_move_y);

  piece.current_x = board.hole_x;
  piece.current_y = board.hole_y;
  board.hole_x = to_move_x;
  board.hole_y = to_move_y;
};

const adjacent_offsets = Object.freeze([
  [0, 1], // up
  [1, 0], // left
  [0, -1], // down
  [-1, 0] // right
]);

// Check if co-effient is in bound of the board
const in_bound = (board, offset) =>
  (board.hole_x + offset[0] >= 0) &&
  (board.hole_y + offset[1] >= 0) &&
  (board.hole_x + offset[0] < board.split_x) &&
  (board.hole_y + offset[1] < board.split_y);

// Return a random element from an array, uniform distribution
const choice = array => array[Math.floor(Math.random() * array.length)];

const random_move = board => {
  const possible_moves = _.chain(adjacent_offsets)
    .filter(offset => in_bound(board, offset))
    .value();
  const move = choice(possible_moves);

  process_move(move, board);
};

const shuffle = (board, times) => {
  _.range(times).map(() => random_move(board));
};

const is_piece_in_position = piece =>
  piece.current_x == piece.result_x && piece.current_y == piece.result_y;

// return true if all pieces in right position
const check_result = async board =>
  _.chain(board.pieces)
    .map(is_piece_in_position)
    .every()
    .value();
```

Do you think functional code readable ?
Using Terraform Null Resources
Tags: systemadministratio, configurationmanage, automation, devops
Published: 2019-12-31 09:09:32

---
title: Using Terraform Null Resources
published: true
tags: system-administratio,configuration-manage,automation,devops
canonical_url: https://medium.com/@jmarhee/using-terraform-null-resources-ad6df344502f
---

The null\_resource in Terraform can allow you to instantiate arbitrary data into an object with a typical resource lifetime. It has an map…

[Continue reading on Medium »](https://medium.com/@jmarhee/using-terraform-null-resources-ad6df344502f?source=rss-d532e3e97d0f------2)
Slack情報収集のためのチートシート
Tags: japanese
Published: 2020-04-19 18:23:01

---
title: Slack情報収集のためのチートシート
published: true
date: 2019-07-17 04:30:33 UTC
tags: japanese
canonical_url: https://d.nekoruri.jp/entry/2019/07/17/133033
---

[モヒカンSlack](https://qiita.com/kotakanbe@github/items/32cf4eb3de1741af26fb)などに限らずSlackをRSSリーダーのように使っている人が多いと思いますが、特定の分野の情報を追いかけるときの覚え書きです。

#### 基礎

Slackでは[RSSアプリ](https://slack.com/apps/A0F81R7U7-rss)でスラッシュコマンドが用意されているので、一度アプリを登録しておけば、フィードを追加するときは以下のコマンドが使えます。

> /feed subscribe ＜RSS等のURI＞

#### RSSフィードのURI

だいたい以下を追加しておくと良いです。＜keyword＞は目当てのキーワード（"azure"とか"javascript"とか) に置き換えます。

- はてなブックマーク  
[http://b.hatena.ne.jp/search/tag?q=](http://b.hatena.ne.jp/search/tag?q=)＜keyword＞&users=3&mode=rss  
※ 最低はてブ数を変えたいときはusersをいじる
- Slideshare  
[https://www.slideshare.net/rss/tag/](https://www.slideshare.net/rss/tag/)＜keyword＞
- Qiita  
[https://qiita.com/tags/](https://qiita.com/tags/)＜keyword＞/feed

その分野で精力的に情報発信している人が居れば、以下のURIでQiitaやSlideshareがストーキングできます。

- Slideshare  
[https://www.slideshare.net/rss/user/](https://www.slideshare.net/rss/user/)＜username＞
- Qiita  
[https://qiita.com/](https://qiita.com/)＜username＞/feed.atom

あと、個人的には[Developers.IO](https://dev.classmethod.jp/)も追いかけてます。

- [https://dev.classmethod.jp/category/cloud/](https://dev.classmethod.jp/category/cloud/)＜keyword＞/feed/ とか

特定のブログを追いかけたいときは、メジャーどころなブログエンジンなら、ソース開いて「feed」とか「atom」「rss」あたりを検索すればRSSフィードのURIがmeta要素とかに入っているので、そこから持ってきます。
Three Aspects Of A Good Manager
Published: 2019-07-12 19:36:40

---
title: Three Aspects Of A Good Manager
published: true
description: 
tags: 
---

Over my long career I have had bad and good managers. I have tried to take the good aspects/qualities out of the good ones and make them apart of my management style. So far according to my yearly team surveys I'm a good manager. I attribute my greatness to three things.


<h1>1. Fairness</h1>

Managers should be extremely fair with their people. They shouldn't hold people  accountable to a different standard than they would hold themselves to. 


<h1>2. Communication</h1>

Managers should make a point to communicate with their people on a regular basis (monthly). Set aside time during the month to listen to your individual team members questions, concerns or complaints. 

<h1>3. Vision</h1>

This is important and goes along with communication. Managers should have a vision. Some utopian (long term) goal that you want your team to reach. The goal should have a clear and huge benefit to the team, not the manager. The reward to reach it should be communicated also. The manager should consistently communicate this vision and keep it in the memory of their team.

<h1>Conclusion</h1> 
In my career I have had hard demanding managers but if they were fair and listened then I appreciated them. You can work for the best company in the world making a whole lot of money but if you have a bad manager it will be miserable. That goes the other way also. I worked somewhere where the pay was low but because I had a good manager I stayed (until the end at that).

If I missed something, please comment.
JavaScript Sets are Excellent!
Tags: javascript, functional, coding
Published: 2019-07-17 04:25:31

# Sets In JavaScript Are 🔥
- In [MDN Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) it states "The Set object lets you store unique values of any type, whether primitive values or object references."

So the obvious use case for Sets, removing duplicates! Which they do very easily and concisely. I personally like the example I created for the banner. The combination of spread `...` and `new Set()` inside of an **array literal** consuming input from the function, meaning it will take in any iterable that can be spread "dedupe" it and return those values in an array! Super cool!! A lot going on in a small package.

# Quasi-Typecheck/searching & searching & deleting
 - Sets in JavaScript have some things Arrays don't have and are missing some things Arrays do have... Example, Sets have no index! "But I thought you said it was iterable?" I did, that doesn't mean it has an Index 😆

 - Ok, so what is one of the most useful things all iterables share! I want to know it "has" 😆 something, with Objects `.hasOwnProperty()` will check if something exists but not if the type matches... 
  ![const object = { cat: `meow`, 1: `hundred` }
console.log(object.hasOwnProperty(`cat`))
console.log(object.hasOwnProperty(`1`))](https://thepracticaldev.s3.amazonaws.com/i/3ewz2kxtn0n8ch4g6e5q.png)

 - So... Not only does the `.has()` from Sets check work a little differently than the one from `.hasOwnProperty()` but it also works a bit differently than `.includes()` from arrays but both `.has()` & `.includes()` will return false of the **type** does not match what is being search for. 
 ![const mySet = new Set([1, 2, 3, 4])
console.log(mySet.has(`2`)) // false
console.log(mySet.has(2)) // true](https://thepracticaldev.s3.amazonaws.com/i/tc1eo32ih8gydrb8grt6.png)

 - The next super useful thing from built-in of Sets and there isn't the equivalent in Arrays is `.delete()` which in Arrays you either know the index or search for and get the index of the element then work out how to remove it. 
     - What does Set `.delete()` look like in comparison? 
   ![const mySet = new Set([1, 2, 1223, 431242, 342345245235, 2123123, 12313])
console.log(mySet.delete(2)) // true
console.log(mySet.delete(342345245235)) // true
console.log(mySet.delete(`431242`)) // false
console.log(mySet); // Set { 1, 1223, 431242, 2123123, 12313 }](https://thepracticaldev.s3.amazonaws.com/i/u4y1gq2g32z005w92jov.png)

A great resource to read on Sets as well!
https://medium.com/front-end-weekly/es6-set-vs-array-what-and-when-efc055655e1a

🚧🚧🚧🚧
More to come on Set use cases and examples, with explanations 😎
🚧🚧🚧🚧
Environment variables in Linux and Mac OS
Tags: bash, api, tokens
Published: 2019-07-17 03:58:51

---
title: Environment variables in Linux and Mac OS
published: true
description: The practice of using environment variables is a good way to avoid sensitive information leaks and keys, especially while working with open source projects and public repositories.
tags: Bash, API, Tokens
cover_image: https://miro.medium.com/max/1280/1*x--jge1Xrq6SCvoBpdNGXA.jpeg 
---

If you have worked on a project which consists of API’s or anything that involves tokens to interact with servers, you might have worked with environment variables. This article explains how to create environment variables in MAC and Linux OS. They can also stop disasters such as [these](https://www.quora.com/My-AWS-account-was-hacked-and-I-have-a-50-000-bill-how-can-I-reduce-the-amount-I-need-to-pay) happening.

What are the Environment variables, and why use them?
Environment variables are system variables with a specific meaning that can be referenced when necessary all over the Operating System. They usually begin with a $ symbol in bash. It must also be noted that when storing API keys or secret data for Production, [environment variables are not the best option](https://softwareengineering.stackexchange.com/questions/352653/how-to-manage-environment-variables-in-local-development). They are handy for testing and development as most languages have inbuilt support.

## Create the variables.
Place your keys in the following format in `~/.bashrc` in case of Linux and `~/.bash_profile` in case of Mac OS.

`export SECRETKEYNAME="Some-Key-here"`

**Note:** The variable name should be in uppercase letters only.

Once you are done copying your key to the file, the next step is to refresh the files and make the variables accessible all over the system. You can do it using the command source `~/.bashrc` Linux or source `~/.bash_profile` in case of Mac OS. You can use `printenv` to view all the variables on Mac and Linux OS. You can also access the existing variables like `$HOME` or `$USER` using the terminal.

**Example:** echo `$HOME` displays your home directory name.

To set the environment variables across sessions and restarts, you can store them in `~/.bashrc` , `~/.bash_profile` or `~/.profile`.

The practice of using environment variables is an excellent way to avoid sensitive information leaks and keys, especially while working with open source projects and public repositories.


###References and further reading:

1. [Quora Thread on AWS Hack and 50K Bill](https://www.quora.com/My-AWS-account-was-hacked-and-I-have-a-50-000-bill-how-can-I-reduce-the-amount-I-need-to-pay).
2. [Environment variables on Wikipedia](https://en.wikipedia.org/wiki/Environment_variable)
3. [How to manage environment variables in local development](https://softwareengineering.stackexchange.com/questions/352653/how-to-manage-environment-variables-in-local-development)
4. [An Extensive Read on Digital Ocean](https://www.digitalocean.com/community/tutorials/how-to-read-and-set-environmental-and-shell-variables-on-a-linux-vps)
What's your take on coding exercises for non-coding interviews
Tags: discuss, career, interview
Published: 2019-07-17 03:47:09

---
title: What's your take on coding exercises for non-coding interviews
published: true
description: If your desired position is not specifically a coding one (i.e dev manager, team lead, etc) should you still be discarded if you fail a coding exercise?
tags: discuss, career, interviews
---

It has happened to me in the past, and the most frustrating part is that these were big-time companies. They were offering very interesting roles, big relocation packages and yet, I was turned down for not being able to solve those coding exercises that you never get in real-life scenarios.

What is your take on that kind of interview process? PRO? Or against it? And Why?

I'm personally against it, but not for the obvious reason... I personally think there are better ways to understand if a person knows what they're talking about particularly if that person is not applying for a coding role.
I do interview people on a weekly basis and I never ask to see the code, especially for higher seniorities. In those cases, the applicant should be able to provide proof without showing code. They can cover past experiences, problems encountered, solutions provided and so on. 

But that's just me, I'd love to know what the rest of the community thinks, leave your thoughts below!