teleren/devto huggingface dataset:
Memento mori: your startup is still not a unicorn
Tags: productivity, career, watercooler, management
Published: 2022-05-01 19:55:52

You know how interviewers love to ask the question “where do you want to be in 5 years”?
Well, it just so happens, this is one of my favorite questions to ask... companies.

## Where will *company* be in 5 years?

It always depends on who is asked, but generally, the founders are those most hyped.

Being a programmer or creator, you probably can relate to how they treat their “babies”.

### It’s not about your idea

Most of the time, as good an idea it might be, it’s not enough to make a unicorn. 
Few become a unicorn because it’s also about timing and luck.

### Why the hype is bad

Many I’ve asked talk with passion, and it’s good they do!

But some seem to be blind to all the flaws of their idea and, worse of all, they just think that everyone will just use it and recognize it as the best thing ever.

## Memento mori

You’ve probably heard about how Julius Caesar and other Roman emperors would have this whispered to them in their moment of triumph for them to remember that they aren’t infallible.

### Why you might need an “Auriga”

Auriga is the one who would whisper “memento mori”, and you might want someone like that working with you.

Someone like that would be someone that would have challenging questions, that will tone the hype with real concerns that someone with rose-tinted glasses might not think about.
It would be an ungrateful position, where you would be seen as a buzzkill, pessimist, or something worse. 

But someone, somewhere at some time will make the same questions, and then you be grateful to have an Auriga having asked those same questions before.

### An Auriga could also be a beginner

Companies sometimes seem like they want “cult members” of the brand and it would be unthinkable to hire someone who doesn’t use their service.

But exactly the beginner is someone you want a handful of, they will see and ask questions about what you think is “obvious”.

The beginner journey is also what makes people stay or leave, so new people will certainly have the most impact on that journey.

---

## What would you be an Auriga for?

If I were to be an Auriga, I would probably be for blockchain (crypto and NFT). 
I can see it can solve real-world problems, but meme coins and collectible monkeys...

Or for a social network... since it’s something I don’t really use.

### So... What you be an Autiga for?

---

Cover Photo by [Mathew MacQuarrie](https://unsplash.com/@matmacq?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/collections/1503883/memento-mori?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)


[![buy me a coffee](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g7lwj42k48msufetdbu3.png)](https://buymeacoffee.com/noriller)
Python challenge_19🐍💪
Tags: python, beginners, tutorial, programming
Published: 2022-05-01 19:55:19

##List xor

Define a function named list_xor.

Your function should take three parameters:
- n, list1 and list2.

Your function must return whether n is exclusively
- In list1 or list2.

In other words, if n is in both lists or in none of the lists, return False.

If n is in only one of the lists, return True.

####For example:

1- list_xor(1, [1, 2, 3], [4, 5, 6]) == True
2- list_xor(1, [0, 2, 3], [1, 5, 6]) == True
3- list_xor(1, [1, 2, 3], [1, 5, 6]) == False
4- list_xor(1, [0, 0, 0], [4, 5, 6]) == False
5- list_xor(5, [5, 5, 5], [4, 4, 4]) == True

####[Test your solution](here:https://pythonprinciples.com/challenges/List-xor/) 


####My Solution
```
def list_xor(n, list1, list2):

    list_one = n in list1
    list_tow = n in list2
    
    if list_one != list_tow:
        return True

    if list_one == list_tow:
        return False
```


### Connect with Me 😊
- [LinkedIn](https://www.linkedin.com/in/mahmoud-el-kariouny-822719149/)
- [Twitter](https://twitter.com/Mahmoud42275)
MAC OS X: How to split large file into pieces?
Tags: macosx, split, commandline
Published: 2022-05-01 19:51:42

OS X includes a command line tool called split. See man split or https://ss64.com/osx/split.html for all the details.

You can call split using the Terminal.app and the command:

```
split -b 5m bigfish.txt
```

To split text, use web tool: https://qit.tools/text/split/.
Open Source Responsive Template and Component
Tags: javascript, webdev, opensource, react
Published: 2022-05-01 19:42:02

Hey, guys check out [Devi](https://dev-ui.vercel.app/), A Open-source full responsive and customisable React [Component](https://dev-ui.vercel.app/components/hero) and [Template](https://dev-ui.vercel.app/templates/nftlandingpage) Library.

[GitHub](https://github.com/kumard3/dev.ui)
C4 Performance Training
Published: 2022-05-01 19:25:17


<a href="http://c4perform.com/">sport performance training</a> is a local youth and adult athletic training company that prides itself on working with adult and kids of all abilities and goals. We specialize in working with adult and youth athletes from all sports in the Philadelphia suburbs and the Main Line. There are many variables that influence our curriculum such as: chronological age, mental age, nature of the sport an athlete plays, and individual needs of an athlete.
Using right data location.
Tags: solidity, gasoptimization, bestpractice
Published: 2022-05-01 19:09:06

---series: Gas Optimization techniques---
Using the right data location while creating contracts can help save gas on transactions. 
Data locations in solidity:
- **Storage** - used while referencing state variable to introduce change
- **Memory** - variable is copied to memory and changing it does not change the state of blockchain.(can be used for function inputs as well as to reference state variable to get data)
- **Calldata** - same as memory, but can be used only in function inputs.

## How to decide the data location?
(Consider the following contract)

```solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

contract dataLocation{

    struct Order{
        string productName;
        address reciever;
        bool status;
    }

    mapping(address => Order) public orderDetails;

    function makeOrder1(string memory _productName) external { // using memory location
        Order storage _order = orderDetails[msg.sender];
        _order.productName = _productName;
        _order.reciever = msg.sender;
    }

    function makeOrder2(string calldata _productName) external { // using calldata location
        Order storage _order = orderDetails[msg.sender];
        _order.productName = _productName;
        _order.reciever = msg.sender;
    }
}
```
- In this code example we have used _storage_ while introducing change to blockchain i.e updating state variable (**orderDetails**).
Note:- if we used _memory_ data location, the **_order** would have no significance outside the function scope. (no change in state variable **orderDetails**)

- The functions **makeOrder1** and **makeOrder2** use _memory_ and _calldata_ locations respectively for taking function inputs.
Note:- both functions are doing the same thing, just data locations are different for storing input.

Execution cost of both the functions:
**makeOrder1**

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

**makeOrder2**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5u2a2t7wvi2i3afu699k.PNG)

The execution cost while using _calldata_ reduced to less than half.
**Reason->** While using _memory_, the input data is copied whereas while using _calldata_ the data is taken as it is. Hence the gas is reduced.
Due to this, we cannot make changes to input if they are stored in _calldata_ location. So if we need to make changes to input, we need to use _memory_
The only website you'll need to find quality resources to learn coding
Tags: webdev, programming, tutorial, github
Published: 2022-05-01 19:03:29

The only website you'll need to find valuable resources to learn coding and programming

Now in the age of information most developers struggle to find valuable resources to learn from and that's the idea behind uniqueresources.dev is to accumulate good/tested resources for you to learn from!

https://uniqueresources.dev

it is also opensource, check it out and contribute!
Reforçando as bases
Tags: algorithms, devjournal, java, beginners
Published: 2022-05-01 18:58:52

Hoje eu estava lendo a ótima thread de [Dicas para Jr., Pl. e Sr.](https://twitter.com/hugaomarques/status/1460050269467643908) do [Hugo Marques](https://linktr.ee/hellohugomarques) no Twitter quando em um dos tópicos ele comentou sobre o curso [Algorithms, Part I by Princeton University](https://www.coursera.org/learn/algorithms-part1). Entrei na página só por curiosidade e vi que por coincidência uma nova turma do curso se iniciava hoje (01 de maio) além do curso ser em Java.

Nessa jornada para me desenferrujar eu estava sentido falta de relembrar as bases sobre algoritmos, estruturas de dados e análise de algortimos. Eu estava focado apenas em desenferrujar logo as linguagens (comprei até um novo livro de JavaScript), estava me focando em Java para chegar em SpringBoot e JavaScript para pegar Node e os frameworks de frontend.
Mas não tinha começado a relembrar o básico ainda.
Eu estava começando a me sentir assim:

![Gambiarra](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ofxkpbju3oyi99v8el3s.jpg)




## O Curso

Pois bem, me matriculei e vou começar o curso.

![O curso](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a1ue3opyhiiph2lnq1wl.png)

São seis semanas e os assuntos abordados são:

- Semana 1: Introdução, Union-Find, e Análise de Algortimos.
- Semana 2: Stacks and Queues e Elementary Sorts.
- Semana 3: Mergesort e Quicksort.
- Semana 4: Priority Queues e Elementary Symbol Tables.
- Semana 5: Balanced Search Trees e Geometric Applications of BSTs
- Semana 6: Hash Tables e Symbol Table Applications.

De todos esses o único tema que eu me lembro muito pouco é o da semana cinco mas mesmo assim eu achei uma ótima fazer o curso todo. É gratuito, de boa qualidade e acho que mesmo no que eu me lembro eu devo estar muito sem prática. Vai ser legal.

No fim das contas eu quero mudar de área e voltar pra TI o mais rápido possível mas a minha personalidade e a famigerada Sindrome do Impostor não me permitiriam pular dentro do Framework ou linguagem da moda se eu souber que as minhas bases estão frágeis.

Lógico que isso não vai me impedir de tentar alguma vaga que apareça antes de terminar o curso mas eu me sinto bem sabendo que mesmo que eu não esteja 100% em algum tópico eu estou correndo atrás.

E eu acho que no fim das contas isso é o mais importante nessa área né: O mundo de TI e Ciência da Computação é extremamente vasto ninguém nunca vai saber tudo, mas devemos ter uma base boa e sempre estar estudando e aprendendo mais.
Membuat Objek Dengan Melakukan Kloning
Tags: javascript, beginners, programming
Published: 2022-05-01 18:51:35

Hai teman-teman 👋

Kali ini saya akan membagikan tentang cara membuat objek dengan melakukan kloning. Pada umumnya ketika kita membuat sebuah class seperti contoh berikut:

```javascript
class Store {
    constructor(name, city, category) {
        this.name = name;
        this.city = city;
        this.category = category;
    }
}
```

Untuk memudahkan kita dalam melakukan kloning, maka perlu modifikasi pada class di atas menjadi seperti berikut:

```javascript
class Store {
    constructor(name, city, category) {
        this.name = name;
        this.city = city;
        this.category = category;
    }

    setName(name) {
        this.name = name;
        return this;
    }

    setCity(city) {
        this.city = city;
        return this;
    }

    setCategory(category) {
        this.category = category;
        return this;
    }

    clone() {
        return new Store(this.name, this.city, this.category);
    }
}
```

Untuk cara penggunaannya bisa dilihat seperti kode berikut:

```javascript
const store1 = new Store('Void', 'Jakarta', 'Gadget');
const store2 = store1.clone().setCity('Bandung');
const store3 = store2.clone().setName('Void Apparel').setCategory('Fashion');
```

Pada kode di atas, saya membuat toko gadget dengan nama Void yang berlokasi di Jakarta. Kemudian saya membuat lagi toko yang sama akan tetapi berlokasi di Bandung. Terakhir, saya membuat toko pakaian dengan nama Void Apparel dengan menggunakan properti dari toko kedua. Kesimpulannya, kita dapat memanfaatkan properti dari objek lain yang sudah ada dan mengubah beberapa bagian saja untuk membuat objek baru. Kita tidak harus selalu membuat objek dari nol.

Demikian yang dapat saya bagikan, apabila ada yang perlu dikoreksi silahkan share di kolom komentar. 😁
Anonymous Controller tests for Request Spec
Tags: rails, rspec
Published: 2022-05-01 18:38:15

When developing your test suite via request spec, you may want to test functionality of controllers which do not have any actions. These controllers exist for sharing common functionality between multiple controllers. 

While writing these tests via `controller` testing is more [straight forward](https://relishapp.com/rspec/rspec-rails/v/3-6/docs/controller-specs/anonymous-controller), I couldn't find any direct docs for such when using `request` testing.

Let's get to it then. Lets assume that we have a controller called `BaseController.rb` that looks like the following 

```
class BaseController < ActionController::API
   private 
   def current_company
     return "forem" if request.headers['X-Api-Token'].present?
     return "external"
   end
end
```
For the sake of the article we made a simple method that returns the current company as Forem if url, contains string 'forem' or else simply return "external"

Lets test this out. In our rspec file, base_controller_spec.rb we use the following code 


```
describe 'Sets company', type: :request do
  before do
    klass = Class.new(BaseController) do
      def index
         json_response(current_company, :ok))
      end
    end
    stub_const('TestController', klass)

    Rails.application.routes.disable_clear_and_finalize = true 

    Rails.application.routes.draw do
      get '/test', to: 'test#index'
    end
  end

  after { Rails.application.reload_routes! }

end
```
Here's what we did

- In the before block define a new anonymous Class. Animus classes are standard ruby classes without a constant assigned to them. They are very helpful for writing maintainable test.
- `Class.new(BaseController)` is a form of inheritance in ruby. 
- Inside this anonymous class we define a new method/action which  returns a simple json response. Via this response we can test if our base controller method works as expected.
- We use `stub_constant` which helps us to prevent leaking of this class to other spec files. 
- We preserve all original routes via `Rails.application.routes.disable_clear_and_finalize = true`
- Then create a new route endpoint to hit our test. This route points to our newly create controller action defined inside the anonymous class 
- Once all our tests are run we make sure to return our routing table to its original state. 

Lets get to our tests. Should be self explanatory

```
it 'when api token is given' do
  get '/test', headers: {'X-Api-Token': 'random_test'}
  expect(response.body).to eq("forem")
end

it 'when api token is not given' do
  get '/test', headers: {} 
  expect(response.body).to eq("external")
end
```

This simple temple should hope you to solve more complex problems for testing base controllers. A full discussion can be [found here]
(https://github.com/rspec/rspec-rails/issues/1596#issuecomment-834282306)
Book Club: "Test Driven Development: By Example" #6
Tags: books, tdd, discuss
Published: 2022-05-01 18:28:51

---
title: Book Club: "Test Driven Development: By Example" #6
published: true
description: A chapter by chapter discussion of "Test Driven Development By Example" by Kent Beck
tags: books, tdd, discussion
series: Book club TDD By Example
---

## Chapter 6: Equality for All, Redux

This chapter could be called VINDICATION; we are going to refactor `Dollar` and `Franc` to extend a `Money` superclass. This is a nice walkthrough of a mindful refactor, where we make iterative changes and _keep re-running the tests_.

Beck touches on the difficulty of working in a codebase that doesn't have adequate existing tests. He says to,
> Write the tests you wish you had ... Retroactively test before refactoring.

This is easy to do in our Money scenario, but it's no wonder that this can go wrong; if the existing tests don't explain the proper behavior this can be confusing: how do I retrospectively _know_ what tests I wish I had?

p.s. I messed up the commits here, having apparently forgotten to _commit_ my changes from chapter 5. I decided to win back some honour and re-do chapters 5 and 6. In the process, I found that the natural way to duplicate the code for `Franc` was to copy the file in the IDE and paste it into the same folder, using the new class name. I only needed to rename the variable in the `Franc.equals` method. 

🔎 View my code-along repo at https://github.com/ruthmoog/test-driven-development-by-example 

-----

![Book cover](https://learning.oreilly.com/library/cover/0321146530/250w/ ) Kent Beck's "[Test Driven Development: By Example](https://www.oreilly.com/library/view/test-driven-development/0321146530/)" was released in 2002. The book aims to explain how to use TDD to write quality code that works.
Test-engineer Interview
Published: 2022-05-01 18:04:23

_Собеседование с инженером-тестировщиком. 250+ вопросов с градацией по уровням Junior, Middle, Senior. Основы теории по всем ключевым направлениям._

---


**Прежде чем окунуться в мат. часть, ответь себе на эти вопросы.**



**Почему ты стал тестировщиком?**

**Зачем ты стал тестировщиком?**

**Перечисли то, что непосредственно влияет на качество работы тестировщика?**&#x20;

****

**Какие планы на профессиональный рост?**&#x20;

**Какие знания и навыки планируешь приобрести в ближайший год?**

**Почему именно эти знания и навыки?**

**Зачем тебе именно эти знания и навыки?**&#x20;

****

И подготовь ответы для всех, кто спросит.



Одновременно с началом изучения теории необходима практика,
Опережающая теоретический материал и без статичного уровня сложности.
Looking for feedback.
Published: 2022-05-01 17:40:11

Hello all! Please do check out our [shoppable video beta.](https://www.notion.so/Fade-Private-Beta-Now-Open-for-Mux-Developers-50d25e6c921c46918e77b53eae27f04d) We are focused on making immersive premium content shoppable in movies, series, animation, music, XR and more. Could use your constructive feedback for optimization. 

Thank you!!
Storybook x React x Typescript | How to manage complex props with simple control
Tags: react, typescript, storybook, trick
Published: 2022-05-01 17:30:58

## The problem
When you're implementing a [Storybook](https://storybook.js.org) you can change your components props with [Storybook's controls](https://storybook.js.org/docs/react/essentials/controls). But sometimes, when you have a complex props, controls are not adapted and you may need multiple control for one props and/or have to mock some data.

The problem come with Typescript, your `argTypes` is waiting for a type equals to the component props type. But I have a good news ! I'm going to give you a trick to properly bypass this problem.

## The trick
Let's take a "simple" complex prop as an example :
I have a component `Heading` with props which have this type :
```typescript
type HeadingPropType = {
  text : {
    text : string
    html : ReactNode
    raw : string
  }
  image : {
    url : string
    alt : string
  }
}
```
As you can see we have two props :
- `text` : a string displayed in multiples format
- `image` : an image url with an alt attribute which will not be very useful in a Storybook

With this type of props, Storybook will display controls which ask the user to fill an object but I guess we all agree that a string and an input file are more suitable.

We can display them simply with `ArgTypes` but making them work is a bit more complicated.
What you need is a [HOC (Higher Order Component)](https://fr.reactjs.org/docs/higher-order-components.html) which will return your component but with simplified props.

Something like this :
```typescript
const componentSimplifier = <T1, T2>(
  ComplexComp: React.ComponentType<T2>,
  propsConverter: (props: T1) => T2
) => (props: T1) => <ComplexComp {...propsConverter(props)} />
``` 
These line define the function `componentSimplifier` which takes two Generics Types (T1, the simple one and T2, the component props type) and two arguments :
- `ComplexComp` : Simply the component you want to add in your story
- `propsConverter` : A function that will convert simple props into complex ones

For our example we have :
```tsx
T1 = {
  text : string
  image : string
}
T2 = HeadingPropType
ComplexComp = Heading //The component we want to display
propsConverter = ({text, image}: T1) => ({
  text : {
    text : text,
    html : <h1>${text}</h1>,
    raw : text,
  },
  image : {
    url : image,
    alt : "default alt string"
  }
})
```

The final call to this function will be :

```tsx
const SimpleHeadingPropsType = {
  text : string
  image : string
}

const propsConverter = ({text, image}: T1) => ({
  text : {
    text : text,
    html : <h1>${text}</h1>,
    raw : text,
  },
  image : {
    url : image,
    alt : "default alt string"
  }
})

const SimplifiedHeading = componentSimplifier<
  SimpleHeadingPropsType,
  HeadingPropType
>(
  Heading,
  propsConverter
)
```

That's it ! Now you can use `SimplifiedHeading` in your story with adapted controls !
The Most Underrated Tools Every Developer Must Know: Part 1
Tags: productivity, codenewbie, programming, womenintech
Published: 2022-05-01 17:25:00

Yes you heard it right! I am going to share some of tools that will save lots of your time in coding, Your productivity will be increased....

Hi all, I am a software developer with mid level experience in building code and developing software. In my free time I like to explore twitter and developer resources. Along the way I came across lots of resources that I bookmark and use it later. I am going to share some of the resources every weekend so stay tuned! 

- [Convert JSON to Javascript](https://www.convertsimple.com/convert-json-to-javascript/)

**What**: This site takes JSON string as input and generates Javascript object.
**How**: You can paste JSON string or just upload the json file.
**Security**: It is completely safe, entire processing happens at client side and no data is send to server side.


![JSON to JS Object](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vyng0d022ahdmi8rl938.png)


- [JSON to C# classes](https://json2csharp.com/)

**What**: This site converts JSON string into C# POJO classes. which will take a hour to identify and establish relationship between objects.
**How**: You can paste JSON string and click on convert.
**Security**: Data is moved to server and processed on server ( not saving any where) and then send back as per their privacy policy.


![JSON to C# object](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dxugdxcc0qpfcktk45sp.png)

You can use this site to convert JSON/XML to POJO classes in another language as well.

Note: All though they are not saving data it is still recommended to not expose data with top most privacy. 

As a developer we most of the time work with the projects and clients where data security is of top concerns. We cannot trust  rather not recommended by clients to expose our data to any online sites, then how to deal with those data? Do we need to create POJO class manually?

Stay Tuned! In my next post I will mention some Visual Studio and Visual Studio Code tricks that will create POJO's in seconds. 

Happy Coding!...


<img src="https://media.giphy.com/media/3o7btQsLqXMJAPu6Na/giphy.gif" width="100%" />