teleren/devto huggingface dataset:
100 Days of Swift - Day 5
Published: 2022-04-12 22:22:09

Continuation of [Hacking With Swift](https://www.hackingwithswift.com/) [100 Days of Swift](https://www.hackingwithswift.com/100)

Day 5 - Functions

Functions are a little bit special for swift, first of all return keyword is not required, function keyword gets boiled down to func, and return statements are specified with -> DataType; kind of bonkers if you ask me but hey, gotta get use to it.

In the other hand here we get an interesting concept, "parameter labels", these allow for a function to have an internal and external name for a passed parameter, ex:

`func greet(to name: String) -> String { "Hello! \(name)" }; greet(to: "Davmi");`

To get rid of the required parameter name when calling a function we can use the discard operator, the same way print() does not require the parameter to be set print(nameOfParameter: "") we can change our greet function like this:

`func greet(_ name: String) -> String { "Hello! \(name)" };`

And then the function can be called like: `greet("Davmi");`


Variadic functions are totally different, while on c# with have the `params` keyworks, on swift we use ... after the param type, so a variadic function would be

`func variadicFunc(numbers: Int...)`

In swift all parameters are immutable, in order to pass by reference (modify the value of the parameter), you need to add the ampersand symbol &.
Menyelesaikan soal "Diagonal Difference" di HackerRank
Tags: javascript, programming, beginners
Published: 2022-04-12 22:20:09

![Soal](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wzn6bndm10dlfid9coym.jpg)
Pada soal di atas kita diminta untuk mengitung selisih mutlak dari jumlah antara diagonal sebuah matriks persegi. Kali ini saya akan membagikan cara saya menyelesaikan soal tersebut menggunakan bahasa pemrograman javascript. Berikut kode pemrogramannya:
```javascript
function diagonalDifference(arr) {
    let diagonal1 = 0;
    let diagonal2 = 0;
    
    arr.forEach((row, i) => {
        diagonal1 += row[i];
        diagonal2 += row[row.length - i - 1];
    });

    return Math.abs(diagonal1 - diagonal2);
}
```
Pada kode di atas, saya membuat variabel diagonal1 dan diagonal2 untuk menyimpan jumlah dari elemen masing-masing diagonal. Di bawahnya, saya melakukan perulangan pada array arr dengan menggunakan forEach dan menjumlahkan nilai diagonal1 dan diagonal2 sesuai dengan indeks diagonalnya masing-masing. Terakhir, saya mengembalikan nilai selisih antara diagonal1 dan diagonal2.

Demikian yang bisa saya bagikan, apabila ada yang perlu dikoreksi atau Anda punya cara lain untuk menyelesaikan soal di atas silahkan share di kolom komentar. 😁
My favourite rsync commands
Tags: linux, ubuntu, devops, sysadmin
Published: 2022-04-12 22:12:45

Below, i have collated some `rsync` commands that I use in my day-to-day system administration tasks.
I found **[rsync](https://rsync.samba.org/)** a better tool compared with other FTP/SFTP tools that I have used in the past. (FileZilla was my goto tool in the past).

Another thing that fascinated me and attracted me to using rsync was the need to carry out all my sysadmin/development tasks inside one gui using an IDE (I fell in love with [VSCode](https://code.visualstudio.com/) as my favourite).

Now, let's begin:

#### Rsync command to copy a file/folder from local pc to a remote server

###### With key/certificate
```
$ rsync -iav /path/to/keyfile/key.pem /local/directory/path/ user@example.com:/remote/directory/path/

```

###### Without key/certificate
```
$ rsync -iv /local/directory/path/ user@example.com:/remote/directory/path/
```

#### Rsync command to copy a file/folder from remote pc/server to a local pc/server

###### With key/certificate
```
$ rsync -avzP --rsh=ssh user@example.com:/remote/directory/path/ /local/directory/path/

```

###### Without key/certificate
```
$ rsync -avzP --rsh=ssh user@example.com:/remote/directory/path/ /local/directory/path/
```

#### Rsync command to copy a file/folder from remote pc/server to another remote pc/server

```
$ rsync -i /path/to/keyfile/key.pem user@example.com:/path/to/file.txt user@example.org:/path/to/file

```
EAE da acceso a los Servicios de Carreras Profesionales desde el primer día con Professional Impact
Published: 2022-04-12 22:09:16

Este servicio, Professional Impact, representa un activo diferencial con respecto a otras escuelas de negocio.

EAE Business School ha lanzado el plan de Professional Impact para adelantar y dar acceso al Servicio de Carreras Profesionales, desde el momento en el que se matricula en la Escuela y con anterioridad al inicio del curso académico. De este modo, el candidato puede comenzar a abordar y a trabajar en la tangibilización de sus aspiraciones profesionales. Este servicio representa un activo diferencial con respecto a otras escuelas de negocio.

El objetivo es conocer cuanto antes quién es y a dónde quiere llegar el candidato y darle herramientas para orientar su reto profesional, para complementar el conocimiento y las competencias que le proporcionará el programa al que se ha matriculado. El proceso consiste en tres etapas: evaluación y diagnóstico, construcción de la propuesta de valor en el mercado y un plan de acción anual para alcanzar la meta.

El candidato realizará primero un autodiagnóstico y un test psicotécnico y motivacional. Con los resultados de ambos, arranca el proceso de Accountability Model de EAE, que consiste en la rendición de cuentas del candidato, con el compromiso de detectar áreas de mejoras. En este sentido, recibirá un feedback individual sobre sus resultados por parte de su mentor y diseñarán su plan de acción.

Con este nuevo servicio, se modifica el itinerario de Carreras diseñado para cada estudiante, incluyendo la fase Warm up, de autodiagnóstico y test de competencias, antes de la Fase Ready, que incluye el acceso al portal de empleo Career Center y workshops.

“Nadie conquistaría el Himalaya sin todo el proceso previo de preparación. Nadie llega al pie de la montaña sin haber hecho una investigación, una reflexión previa, conseguido todas las herramientas que pueda necesitar durante el ascenso, porque peligraría la experiencia. Por eso desde el momento en que se matriculan les ayudamos a prepararse para la aventura que van a iniciar en unos meses”, explica la directora de Carreras Profesionales, Carmen Martos.

[Leer Mas...](http://orientarioja.com)
Day 557 : I Need You To
Tags: hiphop, code, coding, lifelongdev
Published: 2022-04-12 22:05:15

_liner notes_:
- Professional : The day flew by! Time, I need you to slow down a little. haha I reviewed a blog post that a coworker created for the blog post. Made my edits and suggestions. Got them approved by the writer and then added it to our CMS to be posted to the blog this week. Also added all the events I have coming up to our team's JIRA board so I can get a high level view of what's coming up and what I need to do. I booked some flights and hotels for some events. I investigated an error that was reported with a tutorial. I think something may have changed with the CLI and I ran into another issue. Going to work with a coworker to troubleshoot the issues tomorrow.

- Personal : Finally made an effort to catch up on the shows I've been missing out on. I watched 2 episodes of "Attack on Titan" and one of "Atlanta" before calling it a night.

![photo of a field with High Tatras Mountains in Slovakia in background with the sun setting in the middle giving the landscape a yellow red and purplish hue.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ggbfb4tfavrosks9frru.jpg)

Going to see if I can finally finish adding the pics from the London trip to my site. Then I'll probably look into adding multiple photos at once on my site. To end the night, I'll watch a couple of more episodes of "Atlanta" to catch up. There's still "Killing Eve" that I haven't even started the new season. I'm out!

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube FBWdb9-NbIA %}
My life since dropping out of college (4 years ago)
Tags: devjournal, webdev, writing, career
Published: 2022-04-12 21:20:08

I’m a software engineer in FAANG working on smart devices…a blogger, YouTuber, & e-educator

6 months ago I was in Hawaii. Helicopter rides, black sand beaches, cage-less shark diving, jumped a dangerous as hell 70 to 80 foot cliff jump (I blame tequila), and was lifting religiously in a home gym I’d built up.

Before that, I lived in middle of nowhere MO country side. Worked at a digital marketing agency, practiced martial arts, and lived a simple life.

Before that, I was a city kid living with college friends. Ran a bit, lifted a lot, drank too much, had fun. Went to south padre for spring break & did awesome free lance projects. 5 monitor set up, played guitar, laid back.

Year before that I was living in Colorado - the first half of my time there I lived out of a trailer with my high school buddy. Worked 5am at a coffee shop, showered at the gym, skied a lot. Druggies stole our trailer & I moved to the highest elevated US City. Drove my mustang off a cliff, took 3:30am bus rides for 5:15am coffee shop shifts. 4 hrs of total bus riding & 8 hour shifts were too impractical. It was time to leave the coffee shop & the amazing family owning it. Started free lancing. Bored as hell and lonely, Leadville was not my place. Missed the family and that altitude messes with my heart murmur. Had the first panic attack of my life — after that I started working out, cycling, eating right, practicing guitar, learning Spanish, & coding meticulously every day. Most disciplined I’ve ever been.

The year before that I was in college. Dropped out after 28 days. I lost my scholarship when I dropped so had to pay the college to leave school. Everyone I looked up to told me I shouldn’t & that I needed a “safety net”.

My best friends Dad, someone I admire beyond words invited me to breakfast. First & foremost a great father/husband, he’s also a black belt, as nutritionally disciplined as anyone I’ve met ever, works out religiously, & was an executive on Fortune’s 40 under 40. Great man. Great human being.

The way his glassy blue eyes stared into my soul — man. He was right. College was the safe option. I was on scholarship, I’d have very little debt.

His eyes may have looked into my soul but my soul wasn’t about to waste 4 years of life. He scared me, but I wasn’t changing my mind.

I dropped out to start a business.

I worked 80 to 100 hour weeks for a year. I gave everything I had. Everything. I failed. That’s when I moved to Colorado in the middle of the night embarrassed, ashamed, & burnt out.

And that’s my life as a college drop out.

---

[Clean Code Studio](https://cleancode.studio)
Slow down race car driver (patience)
Tags: productivity, leadership, motivation, devjournal
Published: 2022-04-12 21:17:47

### A Racer Who Fails To Take Their Pit Stops Fails To Execute

---

A racer who fails to take their pit stops within a nascar race, fails to execute.

They fail to make it to the finish line. They fail at even obtaining a chance of winning.

They fail to execute.

Always race forward with intensity, iterate 500 times forwarding each time, but do not let impatience knock you out of the race entirely.

Be patient, take your pit stops, and _then_ execute.

---

[Clean Code Studio](https://cleancode.studio)
Tip to shrink you code using "Omit" to create interfaces!
Tags: react, typescript, javascript, webdev
Published: 2022-04-12 21:13:34

Hey guys! I want to share one tip to you! 

Imagine that you have one interface called by "Deposit" to create using: Id, Name, Value, CreatedAt properties. 

Usually we will create somethink like this:
````
interface Deposit{
    id: number;
    name: string;
    value : number;
    createdAt: string;
}
```

And if you need create another interface from "Deposit". For example, create a new one without the Id called by "DepositInput". We can use the Omit sintaxe. :D  

`type DepositInput = Omit<Deposit, 'id' >`

instead: 
````
interface DepositInput {
    name: string;
    value : number;
    createdAt: string;
}
```

You have oportunity to make short your codes. 
Enjoy :)
Colorized Photos with SVG Filter 1
Tags: css, svg, webdev
Published: 2022-04-12 21:13:04

The feColorMatrix SVG filter element changes colors based on a transformation matrix. First we take the color we want in rgb format and next we divide each value for 255.

`feColorMatrix = 
[
[r,0,0,0,0], // red
[0,g,0,0,0], // green
[0,0,b,0,0], // blue
[0,0,0,1,0], // multiplyer
] `

For Example for RED COLOR:

rgb =  {r: 255, g: 0, b: 0, opacity: 1}
And replace each value / 255 in Matrix.

"1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0"

This Matrix is used as value of  feColorMatrix

```
<svg xmlns:xlink="http://www.w3.org/1999/xlink" class="jsx-715889512 background fade-in" style="width: 100%; height: 100%;">
    <filter id="red">
        <feColorMatrix type="matrix" values="1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0" color-interpolation-filters="sRGB"></feColorMatrix> 
    </filter>
    <image width="100%" height="100%" filter="url(#red)" xlink:href="https://blackwhite.pictures/media/c/0904/fishing-rope-texture-2874.jpg"></image>
</svg>
```


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


For Example for BLUE COLOR:

rgb =  {r: 0, g: 0, b: 255, opacity: 1}
And replace each value / 255 in Matrix.

"0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0


This Matrix is used as value of  feColorMatrix

```
<svg xmlns:xlink="http://www.w3.org/1999/xlink" class="jsx-715889512 background fade-in" style="width: 100%; height: 100%;">
    <filter id="blue">
        <feColorMatrix type="matrix" values="1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0" color-interpolation-filters="sRGB"></feColorMatrix> 
    </filter>
    <image width="100%" height="100%" filter="url(#blue)" xlink:href="https://blackwhite.pictures/media/c/0904/fishing-rope-texture-2874.jpg"></image>
</svg>
```

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

For this examples we use b&w images for better visual result from [blackwhite.pictures](https://blackwhite.pictures) 

Next time we will show you how to combine these colors to get duotone images.
Day 4: too busy - too lazy
Published: 2022-04-12 20:57:47

Hi!
there is no perfect match like being lazy on a busy day, that's what happened today. I had a complete task to work on, a paper to write, a meeting to attend, a match to watch, remember the unfinished task of setting up react project without `create-react-app`? that too! and I had to make sure I learn something new for today to prove I'm not a big loser :) 
I have been feeling so lazy for the whole day but fortunately I managed to finish the task, ditched the meeting improve on both the paper and the project
I wanted to look into setting up test environment with Jest but the day was just too short fortunately not wasted because I learned something interestingly about handling returns in async-await functions I didn't know the promise can hang when you don't specify the return statement
so what's the plan for tomorrow you ask? as they say tomorrow we amend our mistakes that's what's going to happen

signing off...
Top 7 Featured DEV Posts from the Past Week
Tags: top7
Published: 2022-04-12 20:50:30

---
title: Top 7 Featured DEV Posts from the Past Week
published: true
description: A round up of the most-read and most-loved contributions from the community this past week
tags: icymi 
cover_image: https://thepracticaldev.s3.amazonaws.com/i/sfwcvweirpf2qka2lg2b.png
---

_Every Tuesday we round up the previous week's top posts based on traffic, engagement, and a hint of editorial curation. The typical week starts on Monday and ends on Sunday, but don't worry, we take into account posts that are published later in the week._ 

## Building a DEV Clone from Scratch

Having learned both frontend and backend technologies, @eknoor4197 felt ready for a bigger project. Instead of making their own blog, they made a clone of DEV and its API!

{% embed https://dev.to/eknoor4197/i-built-a-devto-clone-from-scratch-including-the-api-56k9 %}


## From Figma to NextJS using AWS Amplify

AWS Amplify is a great set of tools to build your full-stack applications on AWS. @codebeast converts Figma components to React components with Amplify studio, making them ready to use for his next project. 

{% embed https://dev.to/codebeast/from-figma-to-nextjs-app-in-minutes-4jp9 %}


## How to Stay Up-To-Date in Tech

@techworld_with_nana shows us how to stay up-to-date with new technology without getting overwhelmed by juggling 

{% embed https://dev.to/techworld_with_nana/how-i-learn-new-technologies-as-a-devops-engineer-without-being-overwhelmed--495e %}


## Growing Beyond Mid-Level: A Guide for React Devs

If you're a mid-level React developer looking to become an advanced React developer, this post is for you! @srmagura has reviewed junior and mid-level code and compiled some of the most common mistakes that don’t take long to fix.

{% embed https://dev.to/srmagura/bad-habits-of-mid-level-react-developers-b41 %}


## Scalable Architecture for your NextJS Project

This tutorial shouldn’t replace the official documentation, but @alexeagleson made an awesome video guide for starting with your NextJS project. 

{% embed https://dev.to/alexeagleson/how-to-build-scalable-architecture-for-your-nextjs-project-2pb7 %}


## Knowledge transfer

@beetlehope accomplished something truly valuable with this post — they shared some tried and true tips for advancing in your career! 

{% embed https://dev.to/beetlehope/from-junior-to-mid-level-my-top-five-tips-on-how-to-make-this-transition-4jda %}


## How to Write Unit Tests

As a beginner programmer, you often hear advice to test your code. It’s good advice too! @marcinwosinek shows us how we can start doing it!

{% embed https://dev.to/marcinwosinek/how-to-write-unit-tests-52dl %}


_That's it for our weekly Top 7 for this Tuesday! Keep an eye on dev.to this week for daily content and discussions...and be sure to keep an eye on this series in the future. You might just be in it!_
This is where the magic happens! 👏🏻
Tags: webdev, productivity, discuss, devjournal
Published: 2022-04-12 20:46:13

When the pandemic first started and we was all sent to work from home I packed up my work computer and stayed with my parents. There was one problem.. Where was i going to work? My parents have never had a dining table, they definitely didn't have a desk or study, **but** they had a coffee table 💡 so for the first 4 months I was sat on the floor with my mac computer on the coffee table and my dog next to me (i was on the floor so open invitation for cuddles). This was not ideal of course but i had to work with what i had. 

After I returned home, I lived in a flat share and so apart from my bedroom, all the space was communal. Again, I didn't have a desk but I at least had a dining table, so my mac computer and second screen took up the entire table and this was my work space during a lot of the pandemic. Unfortunately having to take this down every evening so my roommates could use the table and after my bum had gotten **SO** numb from these fancy instagramable bucket chairs I spoke with my boss and we organised a desk.

During the last lockdown I had my desk and office chair **crammed** into my small room, I could only just fit my two monitors, keyboard and mouse and this is where I worked for the remainder of the lockdown. Yes I finally had a desk and comfortable chair! But, I was also sleeping, living and working in my room. I went weeks without stepping foot in the living room, I had completely lost my work/life balance.

Bringing this story to now.. 
I recently moved into my own place, we also have hybrid working within the office so we can have a mixture of home and office working which is a great way to break up the week! But with all the moving I was back to square one, no desk, no chair, I returned everything after the pandemic and so I had to get creative. I would work from the breakfast bar (sounds fancy but the chairs that was already here are too tall for the bar so you have to hunch), this was not good for my back! I would then work from my bed, but lets be honest how can you get into work mode from your bed!? This was really not good for my mental health, especially as I'm doing more training, personal code projects, online networking.. I needed my own space where I could focus and be creative!

So today I made that space! 👏🏻 It's minimalistic and nothing special but to me its **my** space. It doesn't have to be fancy like a lot of these posts or TikToks you see, it just has to be right for you. I can't explain how better my mind feels already, I now can't wait to use this space 😊

![Deskspace](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pcurex3mwtcdlgbbfjxg.JPG)

Do you have a lockdown story? Or an area you're most proud of? Please share your stories..
Redirect GH-Pages to Netlify
Tags: netlify, jamstack
Published: 2022-04-12 20:21:38

I recently changed a personal site from being hosted in gh-pages to Netlify (gh-pages is great, but Netlify functions are hard to beat).

The old site used a regular gh-pages url:

- [charlesLoder.github.io/hebrewTransliteration](https://charlesloder.github.io/hebrewTransliteration/)

It gets the job done, but it's not easy to remember.

The latest iteration got a slick new url:

- [hebrewtransliteration.app](https://hebrewtransliteration.app/)

I wanted to make sure links to the old site redirected to the new site, but without a server it felt a little tricky.

Netlify has [redirects](https://docs.netlify.com/routing/redirects/) but that's only for pages on that domain. They won't help us here.

The workaround I came up with is relatively simple, even if it's a bit hacky.

## Netlify build

Like most Netlify projects, pushes to the [`main`](https://github.com/charlesLoder/hebrewTransliteration) branch trigger a build.

Easy peasy, which means I no longer had to worry about the gh-pages branch.

## Create a new project

Next, I had to create a new project locally that looked like this:

```bash
.
├── README.md
├── dist
│   └── index.html
├── package-lock.json
└── package.json
```

The only dependency is [`push-dir`](https://www.npmjs.com/package/push-dir)

*_in reality, no dependencies are necessary. But I like to have a `/dist` directory, so I use `push-dir` for that_

### Set up the redirect

In order to redirect users, this is all that's needed:

```html
<head>
  <title>Hebrew Transliteration</title>
  <meta http-equiv="refresh" content="3; url = https://hebrewtransliteration.app" />
</head>
```

The key is the [`http-equiv` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attributes).

With this attribute set to `"refresh"`, by setting the `content` to `3` after 3 seconds the page will redirect to the `url`.

I also threw in some content letting the user know they were being redirected.

### Git & GitHub

Once I had it the way I liked it, I had to initialize a git repository and commit.

```bash
git init
git add .
git commit -m "Init commit"
```

Then I had to the Github repo as the remote origin:

```bash
git remote add origin https://github.com/charlesLoder/hebrewTransliteration.git
```

Most importantly, don't push anything yet!

### Now, push!

Remember, this is only going to be on the `gh-pages` branch.

Using the `push-dir` package, I ran:

```bash
npx push-dir --dir=build --branch=gh-pages
```

It's pretty straightforward, the `dist` directory was pushed to the `gh-pages` branch of `origin`.

---

Surprisingly, there is very little about this that I could find. This [blog](https://www.aleksandrhovhannisyan.com/blog/github-pages-vs-netlify/#tips-for-switching-from-github-pages-to-netlify) was the closest thing, but it was little help.

Perhaps this was painfully obvious to others, but not to me...

If you know of a better/different method, let me know in the comments!