teleren/devto huggingface dataset:
Advent of code Day 2 Part 2 Complexity
Tags: adventofcode, complexity
Published: 2018-12-03 12:38:47

---
title: Advent of code Day 2 Part 2 Complexity
published: true
description: Let's try to reach a solution faster than O(n^2*k)
tags: adventofcode, advent of code, complexity
---

I've been trying to solve the Advent of code day 2 part 2 exercise. The 'simplest' algorithm I've come up with is the following (Pseudo-code)

```
i <- 0
while i <= len(file) do:
    j <- i+1
    while j <= len(file) do:
        same = sameCharacters(file[i], file[j])
        if len(file[i]) == len(file[j]) == len(same+1) then:
            return same
        j++
   i++
```

`file` contains the whole exercise input, `file[i]` returns line number `i` of the input and `sameCharacters` returns the common characters between two words compared position by position as per explained by the exercise.

So, if the maximum length of a word is `k`and the number of lines in the file is `n`this solution would have complexity `O(n^2*k)`.

I've been trying to come up with a solution with a better worst-case complexity. I've thought on making a tree out of the words in the file, so that its root would point to the first letter of each word, then each node would point to the next letter and so on, the leafs would point to the index of the corresponding word in the file, so an array like `[aaa, abb, baa]` would become

  root
 /   \
 a    b
/\    |
a b   a
| |   |
a b   a
| |   |
0 1   2

Creating this tree would take `O(n*k)` but then, although I believe that this could improve performance, one would still need to search the whole tree for each word in the worst case scenario and the complexity would stay `O(n^2*k)`. I've not come up with anything better yet, anyone has any idea?
Implementing auto-completion by Regex
Tags: python
Published: 2018-12-03 11:18:23

---
title: Implementing auto-completion by Regex
published: True
description: Implementing auto-completion easily.
tags: Python
---

Using an input as a pattern(this is a reversed way of major use cases), you can implement a simple word auto-completion feature easily!

```python
import re

example_words = ["Python", "Linux", "HHKB", "Pizza", "Ninja"]

pattern = input()

for word in example_words:
    if re.match(pattern, word, re.IGNORECASE):
        print(word)
```

Input example
```
li
```

Output
```
Linux
```
Version: Python 3
I'm working on a free design course for non-designers
Tags: design, discuss, uxdesign, webdesign
Published: 2018-12-03 11:03:21

---
title: I'm working on a free design course for non-designers
published: true
description: Need feedback on what topics I should cover
tags: design, discuss, ux design, web design
---

Hey everyone! About a month back, I started posting videos on my channel to teach UI/UX design to folks looking to start their career or pick up design as an additional skill. I've made about 16 videos so far, and have identified my audience as
- Developers who want to learn design
- Students who want to get into design
- Designers who want to improve their craft/business skills

Some videos I've put out already:
- [Steps in the design process](https://www.youtube.com/watch?v=oSz5KTdKW88)
- [How to develop an eye for design](https://www.youtube.com/watch?v=T4BvVOC_J_k)
- [What tools should you use? Sketch/XD/Figma?] (https://www.youtube.com/watch?v=bUFjEPOO488)
- [How do you practice design?] (https://www.youtube.com/watch?v=pBgufXz2lbU)
- [Fundamentals of visual design] (https://www.youtube.com/watch?v=gSCJMTLrW6Y)
- [How to use typography in UI design](https://www.youtube.com/watch?v=C-AACoESJa8)
- [and more!](https://youtube.com/abnux)

I wanted some feedback on what kind of stuff I should post more of. Some ideas I had:
- Full tutorial/case study of designing an app from scratch
- Full tutorial/case study of designing a website from scratch
- Design reviews, where I ask you for submissions and help you improve
- Portfolio reviews, where I give you feedback on your portfolio

I've also put down some ideas in a Google doc, you can check it out [here.] (https://docs.google.com/document/d/1GlgsrMRL6URhrvjM8nPzWDAhXrvPCmQYxQ18GbJ--hY/)

Any suggestions? Do subscribe on [YouTube](https://youtube.com/abnux) if this is something that interests you!

PS: Hello everyone! This is my first post ever on dev.to
Introducing Laravel Links Telegram Channel
Tags: laravel, sideprojects, productivity, telegram
Published: 2018-12-03 10:56:47

Hi All, this is Adi again, I wanted to update you all on an idea I had about a week ago. So, about a week ago, I was looking for a newsletter or a facebook page that shared Laravel and PHP related resources every day. I was not able to find any that was actively maintained or posted random links that I did not want to see.

After a few days of the frustrating search for this perfect stream of Laravel Links, I decided to [created my own](https://telegram.me/laravellinks). Then the question of which "social media" arose. After thinking about ease of use, ability to scale, automating the posting process and other aspects, I decided to go with a Telegram Channel. Telegram Channel checked all the necessary checkboxes. It is easy to use, many developers use it, no limit to the members and the best of all, I can automate the posting process with a bot.

On Nov 28, 2018, I created a Telegram Channel and posted a message about what this will be about. The description I've given it is - Laravel Links is a Telegram Channel dedicated to sharing great Laravel / PHP resources, tutorials, code snippets, tips, general info, official updates, videos, questions, forum posts and more. As of Dec 3, 2018, there are 41 members, an average message view of 36 and 23 links posted.

If you are interested in joining this Telegram Channel take a look at https://telegram.me/laravellinks
I have put together a landing page too it's at https://ll.simplestweb.in

**More about me at https://simplestweb.in**
Advent of Code 2018 - Solving the first day's challenge
Tags: java, example, web, competition
Published: 2018-12-03 10:42:30

---
title: Advent of Code 2018 - Solving the first day's challenge
published: true
description: Going though the process of solving the advent of code challenges for this year.
tags: Java, example, web, competition
---

{% youtube lwOMLsvXD4o %}
What FTP client can you recommend? Why?
Tags: discuss, ftp
Published: 2018-12-03 10:38:08

---
title: What FTP client can you recommend? Why?
published: true
description: What makes the perfect FTP client for you?
tags: discuss, ftp
---

For most of my FTP needs, I've been using FileZilla. While convenient for most needs, the site manager becomes a bit bloated when more and more projects are added. 
So I was curious:

> **What do you look for in a good FTP client? What clients would you recommend?**

Bonus points for:
- Being available for both Mac and Windows.
- Being able to organise a larger number of sites or easily switch/search between them.
Spectrum Joins GitHub
Tags: discuss, github, webdev
Published: 2018-12-03 09:30:45

---
title: Spectrum Joins GitHub
published: true
description: Spectrum chat community joins Github.
tags: discuss, github, webdev
---

![img](https://thepracticaldev.s3.amazonaws.com/i/to5l1x5mga40hqsj5dds.jpeg)


https://spectrum.chat/spectrum/general/spectrum-is-joining-github~1d3eb8ee-4c99-46c0-8daf-ca35a96be6ce

Thoughts?
AoC Day 3: No Matter How You Slice It
Tags: adventofcode, discuss
Published: 2018-12-03 07:12:57

---
title: "AoC Day 3: No Matter How You Slice It"
published: true
description: Day three of the challenge involves looking for overlapping grid rectangles.
tags: adventofcode, discuss
cover_image: https://thepracticaldev.s3.amazonaws.com/i/0fr7cujo3f1q7i7562xv.png
series: Advent of Code
---

[Day three!](https://adventofcode.com/2018/day/3)  Our DEV leaderboard is up to 44 people, which is awesome!

Also, check out the much classier cover images for these posts that @aspittel came up with!  🎅🥇💻

Anyways, today's challenge asks us to calculate which cells are or are not overlapped as it gives us a bunch of grid rectangles (x, y, height, width) to plot out.

How did everybody do?
Stickers Contest!!🐶😍🤓
Tags: stickers, discuss, devlife, productivity
Published: 2018-12-03 03:11:43

---
title: Stickers Contest!!🐶😍🤓
published: true
description: Something that we must have in our laptops are stickers. Who has de best collection?
tags: stickers, discussion, devlife, productivity
cover_image: https://res.cloudinary.com/print-bear/image/fetch/f_auto,q_auto/https://images.ctfassets.net/rw1l6cgr235r/3uFJFANzDa64wMIKqcUiS0/b8a3424ea5d198c7681b71c20e0628da/laptop-stickers-hero.jpg
---

Hello everybody!

I hope you’re doing awesome, I’m very happy with my new job and I got a few new stickers, so I thought that we could do a contest!!! I love stickers, I think is part of our presentation, some people want to fill their laptop cases with them, others just want a few, but stickers are like badges! and they have a lot of stories behind.

So, what I thought was that you can comment on this post with a photo of your laptop case, and the best story you had when you got one of those. All kind of stickers count because there are people like me that get crazy and have tons of panda and huskie's stickers 😅

So, let's be the great community we are, give a heart to all the cases that you like, because of the designs, the stories or whatever, and the winner (there has to be a winner I know) will be the one with more hearts! and will receive Dev.to stickers as a gift from me. The contest end on Friday 7 of December, 2018 at 10:00 a.m. (Mexico City timezone 😉).

I'll share my stickers too, although I don't have a lot right now but I hope you like it and let's see all the amazing stories we have!

As always, hugs and husky love ❤️ Good luck to everybody!
A JavaScript implementation of the bridge crossing game
Tags: game, javascript, bridge
Published: 2018-12-03 01:30:34

---
title: A JavaScript implementation of the bridge crossing game
published: true
description: A JavaScript implementation of the bridge
tags: game, JavaScript,bridge
canonical_url: https://github.com/victorqribeiro/bridge
---


See it live [here](https://victorqribeiro.com/bridge) or take a look at the code [here](https://github.com/victorqribeiro/bridge)
A month of Flutter: create the app
Tags: flutter, tutorial
Published: 2018-12-03 00:00:17

_Originally published on [bendyworks.com](https://bendyworks.com/blog/a-month-of-flutter-create-the-app)._


The start of any [Flutter](https://flutter.io) project involves installing the [Flutter SDK](https://flutter.io/docs/get-started/install) and [choosing an editor](https://flutter.io/docs/get-started/editor). I'll be using the Linux flavor of the SDK and Android Studio with the Flutter and Dart plugins installed.

Follow the linked instructions to [install the Flutter SDK](https://flutter.io/docs/get-started/install) and set up the Android Emulator or iOS Simulator.

Once you have the SDKs installed run `flutter doctor` to make sure everything is installed correctly. "Connected device" might fail if you don't currently have the emulator running.

~~~bash
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.11.11, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[✓] Android Studio (version 3.2)
[✓] Connected device (1 available)

• No issues found!
~~~

Now create the base app itself. `flutter create <name>` is a handy command to do this.

~~~bash
$ flutter create birb
Creating project birb...
  # truncated...
  birb/.metadata (created)
  birb/.gitignore (created)
  birb/README.md (created)
Running "flutter packages get" in birb...                    1.2s
Wrote 64 files.

All done!
[✓] Flutter is fully installed. (Channel beta, v0.11.11, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices is fully installed. (Android SDK 28.0.3)
[✓] Android Studio is fully installed. (version 3.2)
[✓] Connected device is fully installed. (1 available)

In order to run your application, type:

  $ cd birb
  $ flutter run

Your application code is in birb/lib/main.dart.
~~~

One change I'll make here is renaming the `birb` directory to `app`. In the future I plan on having the project as a [monorepo](https://hackernoon.com/one-vs-many-why-we-moved-from-multiple-git-repos-to-a-monorepo-and-how-we-set-it-up-f4abb0cfe469) and include Firebase Functions code in a sibling directory.

Make sure that `flutter test` passes.

~~~bash
$ flutter test
00:03 +1: All tests passed!
~~~

If you haven't already, set up a virtual device to run the app in. Alternatively you could connect a real device.

![Android Studio Virtual Device Configuration](https://thepracticaldev.s3.amazonaws.com/i/sdify7hp691wcf3uz1gw.png)

[Run the generated app](https://flutter.io/docs/get-started/test-drive) in the Android Emulator (or iOS Simulator) to make sure the app works. For this series I'll be using a Pixel 2 profile with the Play Store. The running app should look something like this:

![Screenshot of sample app running in Android Emulator](https://thepracticaldev.s3.amazonaws.com/i/2vgpmckmnl0ig8vh9wbf.png)

Tomorrow I'll [work on configuring continuous integration](https://github.com/abraham/birb/issues/2) to make sure tests are always passing.

## Code changes

- [#4 Create initial app](https://github.com/abraham/birb/pull/4)
Go async for productivity
Tags: productivity, life, education
Published: 2018-12-03 11:44:57

---
title: Go async for productivity
published: true
tags: Productivity, Life, Education
canonical_url: https://miguelpiedrafita.com/async-productivity/
cover_image: https://images.unsplash.com/photo-1434030216411-0b793f4b4173?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjExNzczfQ&s=1f6c508a5249790ab845238f11bfb5b0
---
{% blogcast 298 %}

Over the last year, I've read a lot of stories regarding uninstalling your social media apps from your phone or disabling notifications but, until very recently, I didn't pay much attention to any of this. I'm a teenager and everyone at my age intensively uses their phone; I thought. It's not like I'm being distracted from my job or anything, right?

Well, then my grades arrived and it turns out I do have a job: studying and getting good marks. The problem is that you need to be extremely focused to be able to memorize stuff and I'm not good at concentrating especially with an internet connection😅.

I started researching on how to concentrate and to avoid distractions and found out some great resources like [Brain.fm](https://brain.fm) (because apparently metal isn't good for studying, who'd have guessed) but I still wasn't able to completely focus on my books.

One day, CleanMyMac accidentally closed Discord and Whatsapp. When I was going to bed, I noticed I had been a lot more focused and realized that I hadn't received any messages during my study and, because I thought I had the apps open and notifications would appear, I didn't bother checking them.

That was the moment I understood the "delete your social media apps" advice. Today's platforms are built to be instant and you're mean to treat them synchronously: If I received a notification, I'd stop what I was doing to reply or retweet.

You have to go async. When you're working, you _don't need to know_ if someone messaged you. Disable notifications. When you're done (when you want to know if someone messaged you) open the app. **It shouldn't depend on the availability of information but on your willingness to receive that information.**

---

_Liked this article? Consider [supporting my work](https://miguelpiedrafita.com/patreon)._
TIGL3D DevLog 1+2: Humble beginnings
Tags: gamedev, unity3d, devlog
Published: 2018-12-02 22:31:44

---
title: TIGL3D DevLog 1+2: Humble beginnings
published: true
description: First two weeks of development on The Indie Game Legend 3D from January 2018
tags: gamedev, unity, devlog
cover_image: https://thepracticaldev.s3.amazonaws.com/i/jpri70s21w99eojfz1jc.gif
---
Here's the first two weeks of development on [The Indie Game Legend 3D](http://indiegamelegend.com/) from January 2018:

{% youtube ABZffyKKUQo %}

{% youtube mvlFJKSyctE %}
Recommend: Anonymous Functions, Programming Elixir 1.6 — Chapter 5 
Tags: elixir, tir
Published: 2018-12-02 21:30:37

---
title: Recommend: Anonymous Functions, Programming Elixir 1.6 — Chapter 5 
published: true
description: 
tags: elixir, tir
---

Today I read this good post of a series about Elixir. Share it.


```elixir

# FizzBuzz - Write a program that prints the numbers from 1 to 100. But for multiples of 3, print "Fizz" instead of the number and for the multiples of 5, print "Buzz". For numbers which are multiples of both 3 and 5, print "FizzBuzz".

# First, the JavaScript implementation

const fizzBuzz = (num) => {
   if (num % 3 === 0 && num % 5 === 0) return "FizzBuzz";
   if (num % 3 === 0) return "Fizz";
   if (num % 5 === 0) return "Buzz";
   return num;
};

const range = (num) => [ ...Array(num).keys() ].map(num => num + 1); # This helper function simply creates an array of numbers - i.e range(100) == [1, 2, 3, ..., 100]

console.log(range(100).map(fizzBuzz));

# Next, the Elixir implementation

fizz_buzz_result = fn 
  (0, 0, _) -> "FizzBuzz"
  (0, _, _) -> "Fizz"
  (_, 0, _) -> "Buzz"
  (_, _, num) -> num
end

fizz_buzz = fn (num) -> fizz_buzz_result.(rem(num, 3), rem(num, 5), num) end

IO.puts(Enum.map(1..100, fizz_buzz)) 

# I think one of the most interesting aspects of the Elixir implementation is that there is NO conditional logic involved. 
# Instead of using `if / else` logic, Elixir takes advantage of pattern matching and multiple clauses to produce the same effect!

```

[link-->](https://medium.com/@fay_jai/programming-elixir-1-6-chapter-5-summary-6a7b5d88cf07)


    Chapter 1 and 2 — OOP, Functional Programming, and Pattern Matching
    Chapter 3 — Immutability
    Chapter 4 — Basic Elixir Types
    Chapter 5 — Anonymous Functions (this post)
    Chapter 6 — Modules and Named Functions (coming soon)
    Chapter 7 — Lists and Recursion (coming soon)
    Chapter 8 and 9 — Maps, Structs, and Keyword Lists in Detail (coming soon)
    Chapter 10 — Processing Collections (coming soon)
    Chapter 11 — Strings and Binaries (coming soon)
    Chapter 12 — Control Flow (coming soon)
Bash Script for meme lords of Linux
Tags: linux, bash, script, meme
Published: 2018-12-02 21:08:21

---
title: Bash Script for meme lords of Linux
published: true
description: Just a little script I wrote for people who appreciate implementing memes into their daily workflow
tags: linux, bash, script, meme
---

Maybe I am slightly late to the meme, but its still worth a laugh here and there. Its a "commit sudoku" meme. Sudoku, as a misspell of Sepuku (hara-kiri, suicide, etc.). So I wrote a little script for meme and someone to type more but have a little BATMN* while doing that.

```bash
commit(){
    if [[ "$1" == "sepuku" ]]; then
        logout
    fi
    if [[ "$1" == "sudoku" ]]; then
        sudo systemctl suspend
    fi
    if [[ "$1" == "lifent" ]]; then
        sudo shutdown -P now
    fi
    fi [[ "$1" == "tensei" ]]; then
        sudo shutdown -r now
    fi
}
```

So now you can logout of your SSH like a boss `commit sepuku`
or shut down your computer `commit lifent`

If you're new to Linux/bash, to use this code, you have to paste the function I wrote above to the end of your `~/.bashrc` file. And activate the change to the rc file just do `source ~/.bashrc`.


* BATMN - Blow Air Through My Nose, since most of the time people do exactly this, not laughing out loud.

## Update

You can install this script to your `~/.bashrc` by copy-pasting this command:

```bash
curl https://gitlab.com/snippets/1787198/raw | cat >> ~/.bashrc
```
The difference between libraries and frameworks with analogies
Tags: sciencetech, developer, framework, java
Published: 2018-12-31 13:31:12

---
title: The difference between libraries and frameworks with analogies
published: true
tags: Science & Tech,developer,framework,java
canonical_url: 
---

[![](https://i1.wp.com/www.fatosmorina.com/wp-content/uploads/2018/12/framework-vs-library.png?resize=653%2C215&ssl=1)](https://i1.wp.com/www.fatosmorina.com/wp-content/uploads/2018/12/framework-vs-library.png?ssl=1)

Img source: geeksforgeeks.org

Software developers use the words _libraries_ and _frameworks very_ frequently and interchangeably, but they are not the same. Koushik Kothagal, who is a really good programming instructor, with a lot of helpful tutorials, especially for Java technologies, has published a really great video explaining both of these concepts and is really easy to understand and follow.

Both libraries and frameworks have been developed to help developers save up time from doing repetitive tasks over and over again, and instead, have tools that they simply can use without needing to implement everything from scratch.

In the video, Koushik takes the example of libraries as tools that a carpenter, for example, may need to use. With tools, you may have a set of tools that you may need. These tools, however, are not used simply by a carpenter. They can be used by anyone, for many types of professions. This is the example of the libraries of programming languages. A programming language may have a lot of libraries that you can use for some tasks, like formatting a string, logging the exceptions that may occur during runtime, and other libraries.

Frameworks, on the other hand, may be thought as procedures that are streamlined for a particular task, for example, the procedure of producing tables. This process is specific and applicable only for building tables, and cannot be used to build boats or cars.

Frameworks which also save a lot of time and a lot of effort, but they actually give you less flexibility, due to the constraints that may be needed to be set up in order for a particular framework to function properly. A particular framework that is for building web applications can only be used to build web applications, as it is specialized for that particular objective, whereas a library that can be used for a certain function in a web application can be used for a desktop or a mobile application as well.

Watch the video below to see a little bit more explanations about this from the Koushik himself.

<iframe type="text/html" width="676" height="381" src="https://www.youtube.com/embed/PjyVXs0_3H8?version=3&amp;rel=1&amp;fs=1&amp;autohide=2&amp;showsearch=0&amp;showinfo=1&amp;iv_load_policy=1&amp;wmode=transparent" allowfullscreen="true" style="border:0;"></iframe>

The post [The difference between libraries and frameworks with analogies](https://www.fatosmorina.com/the-difference-between-libraries-and-frameworks-with-analogies/) appeared first on [Fatos Morina](https://www.fatosmorina.com).
Testing in React
Tags: help, javascript, testing, react
Published: 2018-12-02 20:16:02

---
title: Testing in React
published: true
description: Looking for guidance around some fundamental knowledge for testing React apps
tags: help, javascript, testing, react
---

Looking for anyone interested in lending me their time to answer some questions I have surrounding testing React applications. I've spent some time diving into testing, it's fundamentals, and other resources surrounding testing React. 

I'm building a small application for a meetup I'm hosting and would love to talk to someone who is currently writing tests with Jest & react-testing-library.

Appreciate it!!
Diagrams hide complexity
Tags: manifestingagile
Published: 2018-12-02 19:50:02

---
title: Diagrams hide complexity
published: true
description: A small experiment in poking at dev practices
tags: manifestingagile
---
![Diagrams hide complexity](https://thepracticaldev.s3.amazonaws.com/i/i7kzzeolzupxeeff3wop.jpeg)

Diagrams really help convey the big picture of what you're busy building with, but like all devs I often get tricked into thinking I understand all the details just because I can put it into a nice succinct drawing on a whiteboard.