teleren/devto huggingface dataset:
TypeScript: Tuples are just fixed length arrays‽ 🤔
Tags: typescript, tutorial
Published: 2020-03-03 09:58:13

Tewple or Tupple? Well both actually, keep this in mind during discussions.

## Table of contents
📚 [What is a Tuple](#whatis)
🧬 [Usage](#usage)
☠ [The "tread with caution"](#tread-with-caution)

### 📚 <a name="whatis"></a> What is a Tuple

Okay, so what is a Tuple?  Simply put, it's a data structure, that consists of a fixed length array where each item may or may not be of the same type.

```typescript
// Using a type
type MyTupleType = [boolean, string];

// Using an interface
interface MyTupleInterface
{
 0: boolean
 1: string,
};

```

The above definitions are identical and lets us choose which is best for our situation.

### 🧬 <a name="usage"></a> Usage

Using our definitions above, let's create our first Tuple!

```typescript
const myTuple: MyTupleType = [false, "stringValue"] 
```

Great, so what can we do with our Tuple?

```typescript

// Accessing our data
const myBoolean = myTuple[0]
const myString = myTuple[1]

const [myBoolean, myString] = myTuple; 

// Setting our data
myTuple[0] = true;
myTuple[1] = "Another String";

// Looping our data... remember, it's an Array.
myTuple.forEach(m => console.log(m));


// Useful for functions, this pattern is widely used with React Hooks
function validate(value: any): MyTupleType {
  // Some validation here
  return [false, "Invalid value provided"]
}

```

### ☠ <a name="tread-with-caution"></a> The "tread with caution"

Because a Tuple is an array, we're allowed to push in new data 👀.

```typescript
// Continuing from above
myTuple.push(true, "why is this possible");
myTuple.push("why is this possible", true);
```

Both the cases above are valid, as the compiler is unioning our types.  In our example this produces the type of `string | boolean`.  

This may not immediately come across as a bad thing, however try accessing any of your newly pushed data and experience the wrath of the compiler!

```typescript
const [a1, a2, b1, b2] = myTuple;
// const b2: undefined
// Tuple type 'MyTupleType' of length '2' has no element at index '2'.

const myValue = myTuple[3];
// Tuple type 'MyTupleType' of length '2' has no element at index '3'
```

Proof read & edited by my beautiful wife ❤!

Remember to #KeepHavingFun
What framework would you recommend between ansible and puppet?
Tags: disuss, linux, scripting, automation
Published: 2020-03-03 09:48:40

Hi everyone,

What framework would you recommend between ansible and puppet?

Ansible - [ansible](https://www.ansible.com/)

Puppet - [puppet](https://puppet.com/)

Also what good alternatives can you recommend for Docker?

Because on one of my posts I received the following comment and made me ponder https://dev.to/nicekiwi/comment/m6ap.

Thank you in advance for all the participants too this dicussion.
What is the best scripting language for secure automation and speed?(python, ruby, rust)
Tags: discuss, learn, linux, scripting
Published: 2020-03-03 09:42:07

Hi everyone,

I have the following question after reading some posts and some previous knowledge:

>What is the best scripting language for secure automation and speed on Linux and in general for DEV-OPS?(python, ruby, rust)

Thanks in advance to all the participants to this discussion
Engineer.ai Platform "Builder" Lets Anyone Build Apps Without Knowing Coding

Tags: engineerai, builder, engineeraigurgaon
Published: 2020-03-03 09:42:01

Welcome to builder by Engineer.AI.
	
Builder by Engineer.ai helps you to pick and choose all the ingredients for your app and lets you sit back and relax till your app is ready! We promise, now building an app will be as simple as ordering a pizza.


<a href="https://entrackr.com/2018/11/softbank-jungle-ventures-fund-engineer">Engineer.ai</a> is AI assembly line which makes your apps to order. You've got the idea we've got the code together we'll bring your app idea to life with builders rich interactive platform. Engineer.ai promises that building your app is as simple as ordering pizza.


Let's start building your idea with Engineer.ai Builder to get started.
 

1. Select what type of product you want to build; you have the option to choose from a variety of platforms. Suppose you want to build an app next, you'll be directed to the templates page. 

2. Select the template or templates that most closely resemble your idea, by doing this builder understands how you want your product to function. 

3. Once a template is selected, builder will be able to identify and recommend specific features for your product. 

Let's say your idea functions as a shared economy platform, but also includes components of a more traditional e-commerce model and is geared towards Millennial.  

Don't see a comparable template; just explain your idea to us (<a href="https://sites.google.com/view/engineerai/blog/builder-by-engineer-ai">Engineer.ai</a>) and we'll take it from there from building to maintenance based on the template selections. Engineer.ai’s Builder has added the features to meet the functionality requirements for your product. 

Simply add or remove the features as you see fit Select OK to continue with the recommended features. If this is your first time building with us, we recommend scheduling a demo with one of our team members or watching one of our tutorials before getting started.

After deciding all the features you want to include, choose the time zone of your human team and how fast you want your product to be delivered. Engineer.ai team will build all the unique bits that make your idea a completely customized product based on your selection. Build and reproduce the timeline that works for you and a roadmap that suits you in real time. 

Finally, phases show you all the possibilities of what Engineer.ai’s builder can deliver to you. Do you want just the designs, a prototype or a complete app to finalize your product and get started with development? 

Simply provide payment for the first week of work, you will then be connected with one of our project managers for a deep dive into your project. 

Before kickoff you will also be given access to a dashboard, so you can track progress in real time. So now the only question is what will you build? 

Watch Full Video: https://www.youtube.com/watch?v=ZURrLesd0do
Breaking out of tutorial purgatory ... again
Tags: webdev, build2learn, projects, motivation
Published: 2020-03-03 09:22:08

The world moves fast. Even more the world of software development. It seems that new frameworks are being released every other day. At the start of every year people come up with lists such as  "The top programming languages to learn in 20xx". Even the established JavaScript frameworks such as React and Angular have multiple releases every year which brings better ways of doing things.

You might have heard of the phrase "Javascript Fatigue". Which refers to the feeling of despair which sets upon oneself if they try to do keep up to date with what is happening in the javascript world.
The truth is **learning never ends**. There will always be new things to learn. Better ways of doing things. At some point you will have to make a decision. It is time to stop learning and start doing.
When I heard about the [Chingu Cheetah Dash](https://dev.to/chingu/chingu-cheetah-dash-prep-pack-so-you-don-t-freak-out-before-we-start-4g4) I was keen to give it a go. In case you are not aware, Chingu is a platform that brings developers together to work on projects. These can be group projects or solo projects. The idea is to actually build something, not just follow tutorials.

When I got an invite to be part of this cohort running for this month of March, I thought it would be a good idea to use it to get some projects done, update my knowledge and share the journey with fellow learners.
*Today I realised that I still was stuck in Tutorial Purgatory in spite of my best intentions.*  When I started it I thought that I will try to do 30 projects in 30 days and it is already the third of March and I have not actually started coding yet. I have spent the last few days learning about building CI/CD pipelines and related technologies. I didn't really need to do it but I felt that it can make my projects *better*. By going down this route I was deviating from what my objective was for this month. To spend as much time as I can on working on projects.

So here is the deal: 

> A project that is finished is *better* than a project you haven't even started yet.

As I was thinking about it, the following image came to my mind. The coding journey is like walking along a narrow winding path. Your goal is somewhere along the road but you can't see it yet as it is some way off. 
What you can see are a number of side paths and doors which may or may not be locked. If you have played video games you would have a main quest which is at the end of the road. The diversions which are on the way may lead to power ups, new weapons to attack with or some side quests which lead to some other rewards.

Tutorials are like these side quests. You have to balance doing these vs working towards your main goal. There will be an unlimited number of things for you to learn, but these side quests will not bring you closer to your main goal.

My final piece of advice is this. Dont try to learn everything. Learn enough to achieve what you need to get done. Don't let the side quests distract you from your main goal.
Have you ever solved a software thing so simple and impressive that you thought yourself a genius?
Tags: ask, askdev
Published: 2020-03-03 08:58:13

---
title: Have you ever solved a software thing so simple and impressive that you thought yourself a genius?
published: true
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/bbdvfq9pzcs5gzqxwxol.png
description: 
tags: ask, ask-dev
---

What is that thing that you were able to crack so impressively?
Nice tip - open your Github project page from CL
Tags: git, bash, tip
Published: 2020-03-03 07:54:50

Hey hey!

There's this `bash_profile` alias I've been using and probably it's helpful for you too:

For MacOS:
```alias gh="open \`git remote -v | grep git@github.com | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`"```
For Linux (provided by Shawn McElroy in the comments, thank you):
`alias gh="$BROWSER $(git remote -v | grep git@github.com | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\)"`


After that, just use the command `gh`. It will open your browser with the currently active Git project in Github.
CSS.gg and Inter VAR - The Best Things So Far
Tags: css, webdev, design, beginners
Published: 2020-03-03 07:13:43


Hi,
 So I'm falling asleep right now, after working the whole day but I want to share some resources with you. So the thing is that we at our startup, try to improve UI, UX + Speed day by day and we are really open-minded to try new things that can help us to provide a much better experience. So right now we are using 'Roboto' as our only font-family on the web application for a long time and we were happy with it, but then [Tailwind UI](https://www.tailwindui.com) came up and then we saw this font:

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

It's an amazing font, and I loved it at first sight and it's a Variable Font so I checked the browser support as I haven't used any variable font before for any production application.

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

It's amazing to see that much browser support and then I showed this font to the project manager and he liked it very much and then done! It really changed the entire look of our web application as it's a text-heavy application.

##### CSS.gg
So, we're currently using Material Design Icons and they're just too much for us, we only use outlined versions of icons and we are too picky in icons, and we were already thinking about replacing the icons as it's loading time is also too slow.

So I read this [post](https://dev.to/weekly/frontend-collective-week-3-2nnd) yesterday here, and the guy featured [CSS.gg](https://www.css.gg) icons and I read here that It's made up of CSS entirely and it's lightweight. I said OK, and then I clicked the link to the website and then OOOOOHHHH Yahhh, what the heck man???? All Icons are free, and we can also import only one icon, and they are only made up of CSS. So I checked all the icons, they are all outline-styled. They are highly customizable and also animatable, So it was a great deal.

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

It's also trending right now, on Github.

#### Resources Mentioned Here
 - [Inter Var - Font Family](https://rsms.me/inter/)
 - [CSS.gg](https://www.css.gg)


So follow me on twitter, If you want some sh**y memes and lots of learning resources.

Twitter = [@justaashir](https://www.twitter.com/justaashir)
Teach me like I'm 5! Difference between ReactJs and React Native
Tags: react, reactnative, help
Published: 2020-03-03 05:30:25

---
title: Teach me like I'm 5! Difference between ReactJs and React Native
published: true
description:  What is the exact difference between ReactJS and React Native? When to use which? 
tags: react, react native, help
---

What is the exact difference between ReactJS and React Native? When to use which? I am still not able to figure out when ReactJS to use and when React Native? Also, (it might be silly question, but as I am completely new to this, please bear with me) is ReactJs called React? or React Native is React?
A simple Database Suggestion
Tags: database
Published: 2020-03-03 05:17:59

---
title: A simple Database Suggestion
published: True
description: 
tags: Database
---

If you have been doing software development then you might have encountered a situation where you would want to deactivate a user account or mark some actions as done, where you might be using Boolean Data-type to store those actions.

E.g.

If you want to deactivate then you might have been setting boolean is_active field to true for active users and false for in-active users.

Or

If you want to save notification status for an order then you might have been using email_status as a boolean field with default value as false which you change it to true when the email status is shared with the customer.

The approach above is completely fair and it works but there is a problem in the above approach. It does not have a record of exactly when the user was deactivated or exactly when the email_status was sent to the customer.

For that most of the developers follow a simple approach, instead of using boolean field is_active they use activated_on (or deactivated_on depends on your business requirement) Date field with default value as NULL. They use the following queries to find users:

![https://gist.github.com/akshaykhale1992/22448e265e646c5143ec2725d0358549#file-queries-sql](https://dev-to-uploads.s3.amazonaws.com/i/fwozkp8cg2kyc8vr5osz.png)

[View on Gist](https://gist.github.com/akshaykhale1992/22448e265e646c5143ec2725d0358549#file-queries-sql)

I am not saying this is the best approach but it surely help you to make more sense out of the data in the Database and it completely depends on your business requirements.

That’s all folks!!!

Thank you for reading :) :) :)

Originally Published on Medium: [A simple Database Suggestion](https://medium.com/@TheAkshayKhale/a-simple-database-suggestion-dc52404e8fcc)

Follow me on my social media profiles:
[Twitter@TheAkshayKhale](https://twitter.com/TheAkshayKhale)
[Fb@TheAkshayKhale](https://www.facebook.com/TheAkshayKhale)
[Medium@TheAkshayKhale](https://medium.com/@TheAkshayKhale)

GitHub: [AkshayKhale1992](https://github.com/akshaykhale1992)
Practical Application Of Your Favorite Data Structure - Stack
Tags: discuss, career, hiring, webdev
Published: 2020-03-03 04:31:39

Hey, Dev community!

An interesting real-world application of the stack data structure is the Undo/Redo function in text editors and Word Processing Software. Storing all the text changes in a stack makes it easy to obtain the latest change. 

I have written a post on the Stack data structure [here](https://dev.to/datastructures/stack-data-structure-in-javacript-2l0l) on dev.to. Please check that out if you want to learn about how to create a stack data structure from scratch in Javascript.

I love data structures. Specifically, I love learning about the application of data structures in real-world use cases.

What is your favorite data structure and why?

Cheers!
How to stay current with Ruby and Rails
Tags: ruby, rails, learning, discuss
Published: 2020-03-03 03:38:12

Here's the list of resources that I use to stay current with Ruby and Rails.

## Podcasts:
- <a href="https://devchat.tv/ruby-rogues/">Ruby Rogues</a>
- <a href="https://devchat.tv/my-ruby-story/">My Ruby Story</a>
- <a href="https://5by5.tv/rubyonrails/">Ruby on Rails podcast</a>
- <a href="https://remoteruby.transistor.fm/">Remote Ruby</a>
- <a href="https://www.codewithjason.com/rails-with-jason-podcast/">Rails with Jason</a>
- <a href="https://www.bikeshed.fm/">The Bike Shed (not only ruby)</a>
- <a href="https://the-ruby-blend.fireside.fm/">The Ruby Blend (new podcast by CodeFund)</a>

## Screencasts:
- <a href="https://www.driftingruby.com/">DriftingRuby</a>
- <a href="https://gorails.com/">GoRails</a>
- <a href="https://www.rubytapas.com/">Ruby Tapas</a>

## Newsletters
- <a href="https://rubyweekly.com/">Ruby Weekly</a>
- <a href="https://rails-weekly.ongoodbits.com/">This Week in Rails</a>

## Conferences 
- RailsConf
- RubyKaigi

I didn't include the obvious stuff like official Ruby or Rails guides, news, API documentation etc.

What everyone else is using to stay current? Would love to know!

<small>The idea of sharing these resources came from Jason Swett.</small>
My new YouTube channel: CoderDave
Tags: devops, youtube, technology
Published: 2020-03-03 02:39:51

I'm finally super excited to announce I have started my new [YouTube Channel](https://www.youtube.com/channel/UCtiFg7r8WBBzC6xo-tfEYFw), called [__CoderDave__](https://www.youtube.com/channel/UCtiFg7r8WBBzC6xo-tfEYFw).

In this channel I'm going to talk about _DevOps_, _Azure_, _Coding_ and everything _Microsoft_.

I will upload a new technical video each week, on Tuesday, and be sure not to miss also the Friday night show (well, that depends on your time zone, but for me in Hong Kong that is Friday Night). During the show, we will review the latest news about Microsoft and Azure. The show is called "The M&AN Show", which stands for **M**icrosoft __&__ **A**zure **N**ews.

I also often speak at conferences and technical events, so I plan to make a series of videos to take _YOU_ inside those conferences.

If you don't want to miss a thing, just be sure to subscribe () and turn on the notifications.

See you soon on [CoderDave](https://www.youtube.com/channel/UCtiFg7r8WBBzC6xo-tfEYFw)!

![CoderDave images](https://dev-to-uploads.s3.amazonaws.com/i/uamqsmpkdtyqwvgkzcpb.png)
The Advanced Python Task Scheduler
Published: 2020-03-03 02:35:53

<p>Most long-running programs have a need for executing periodic tasks. APScheduler is a mature and open source library that provides all of the features that you need in a task scheduler. In this episode the author, Alex Grönholm, explains how it works, why he created it, and how you can use it in your own applications. He also digs into his plans for the next major release and the forces that are shaping the improved feature set. Spare yourself the pain of triggering events at just the right time and let APScheduler do it for you.</p><p><a href='https://www.pythonpodcast.com/apscheduler-python-task-scheduler-episode-252/'>Listen Now!</a></p>
Easier Stream Processing On Kafka With ksqlDB - Episode 122
Published: 2020-03-03 02:33:30

<p>Building applications on top of unbounded event streams is a complex endeavor, requiring careful integration of multiple disparate systems that were engineered in isolation. The ksqlDB project was created to address this state of affairs by building a unified layer on top of the Kafka ecosystem for stream processing. Developers can work with the SQL constructs that they are familiar with while automatically getting the durability and reliability that Kafka offers. In this episode Michael Drogalis, product manager for ksqlDB at Confluent, explains how the system is implemented, how you can use it for building your own stream processing applications, and how it fits into the lifecycle of your data infrastructure. If you have been struggling with building services on low level streaming interfaces then give this episode a listen and try it out for yourself.</p><p><a href='https://www.dataengineeringpodcast.com/ksqldb-kafka-stream-processing-episode-122/'>Listen Now!</a></p>
Testing Firestore Cloud Function Local Emulator (Red, Green, -Refactor-)
Tags: firebase, testing, javascript
Published: 2020-03-03 02:24:37

✅👍 ➡ https://www.youtube.com/c/michaellustig?sub_confirmation=1 ✅
👨‍💻   https://dev.to/technoplato
↙ 2️⃣8️⃣0️⃣ 🔤 💬 https://twitter.com/technoplato
↗ 2️⃣8️⃣0️⃣ 🔤  https://medium.com/@michaellustig
💾 https://github.com/technoplato
leetcode reverse an array
Tags: learning, arrays
Published: 2020-03-03 02:19:25

---
title: leetcode reverse an array
published: true
description: 
tags: learning,arrays
---

I am always looking to learn something. Sometimes it is re-working problems like I am a complete beginner. Almost like starting over. I have read that called "beginners mind" in some literature.

So today I looked at unopened emails and I had one from Passion of Programming. It was a programming problem of reversing an array.

So I started a Python repl and started figuring out how to reverse an array.

```python
def r(a,start,end):
    print(a,start,end)
    
    def swapit(pos1,pos2):
        tmp = a[pos1]
        a[pos1] = a[pos2]
        a[pos2] = tmp

    for i in range(int(len(a)/2)):
        swapit(start+i,end-i)
    print(a,start,end)
    return a
```

I wrote a few test cases and it looked correct.

Is it the best way to do it? Probably not but it is what I came up with fairly quickly and it passed my tests.

One thing that I like about Python is being able to define a function exactly where you need it. The ```def swapit(pos1,pos2):``` only works in the function r. Another way to say that is that swapit is scoped to only run in the function r.

One other thing I noticed is that it skips the middle element if you have an array that has an odd length.

So there you are. Now the next time I am asked an array for a job interview. BOOM!