teleren/devto huggingface dataset:
Map a string in Python with enumerate
Tags: python, builtin, code
Published: 2018-11-30 09:21:23

---
title: Map a string in Python with enumerate
published: true
tags: python,built-in,code
canonical_url: https://flaviabastos.ca/2018/11/30/map-a-string-in-python-with-enumerate/
---

Problem: create a map of the letters and indices in a string.

My first approach was to loop over the string using _range(len(s))_, and checking if the letter exists in the map before adding it:

```
    s = 'mozzarella'
    mapped_s = {}
    for i in range(len(s)):
        if s[i] in mapped_s:
            mapped_s[s[i]].append(i)
        else:
            mapped_s[s[i]] = [i]
    print(f' mapped: {mapped_s}')

```

That works:

```
{'m': [0], 'o': [1], 'z': [2, 3], 'a': [4, 9], 'r': [5], 'e': [6], 'l': [7, 8]}
```

but there’s a more pythonic way of getting this map: use enumerate()!

```

    letters = 'mozzarella'
    mapped_s = collections.defaultdict(list)
    for index, letter in enumerate(letters):
        mapped_s[letter].append(index)
    print(f'mapped: {dict(mapped_s)}')

```

Enumerate is a [python built-in function](https://docs.python.org/3.6/library/functions.html#enumerate) that gives you a list of tuples of the indices and the elements in an iterable:

```

print(f'enum {list(enumerate('mozzarella'))}')
enum [(0, 'm'), (1, 'o'), (2, 'z'), (3, 'z'), (4, 'a'), (5, 'r'), (6, 'e'), (7, 'l'), (8, 'l'), (9, 'a')]

```

It can be used to loop over the iterable while keeping track of the index and the element similar to what _range(len(s)) _was doing in my first example:

```

    for i, element in enumerate('mozzarella'):
        print(f'{i}: {element}')

```

It also removes the need to check if the letter already exists before creating that letter’s map!

You can read more about enumerate [in the docs](https://docs.python.org/3.6/library/functions.html#enumerate) or this super nice article by [Dan Bader](https://dbader.org/blog/python-enumerate).

> The post [Map a string in Python with enumerate](https://wp.me/pa0b0y-1n) was originally published on [flaviabastos.ca](https://flaviabastos.ca)
Anybody supports to work on a my small and cool open source project over the weekend?
Tags: 10secondsofcode, help
Published: 2018-11-30 04:23:32

---
title: Anybody supports to work on a my small and cool open source project over the weekend?

published: true
description:  Anybody supports to work on a my small and cool open source project over the weekend
tags: #10secondsofcode, #help
---

My Poject link : https://github.com/10secondsofcode/10secondsofcode
SUpreme-A Command line file manager for Linux
Tags: bash, linux, ubuntu
Published: 2018-11-30 03:20:25

---
title: SUpreme-A Command line file manager for Linux
published: true
description: SUpreme is a command line file manager written in shell script.SUpreme supports file management operations on phone(android),usb drive,cloud storage and local drive
tags: bash,linux,ubuntu
I'm an inline link: https://github.com/Kiran-Bose/supreme
---
How To Become a Blockchain Developer? Step-by-step Plan
Tags: blockchaindeveloper, ethereum, eos, bitcoin
Published: 2018-11-30 00:26:56

---
title: How To Become a Blockchain Developer? Step-by-step Plan
published: true
description: 
tags: Blockchain Developer, Ethereum, EOS, Bitcoin
---

[<img src="https://thepracticaldev.s3.amazonaws.com/i/5kuegaw6hbmd7zwfj743.jpeg">](https://youtu.be/R6AJAwTXjo4)

[Youtube Link](https://youtu.be/R6AJAwTXjo4)

Do you want to become a Blockchain developer? The Blockchain industry is growing rapidly and salary are very attractive, but how can you make it into the industry and become a Blockchain programmer?

In this video I will give you a step-by-step plan (10 steps). This will cover among other things Bitcoin, EOS, Ethereum, Dapps, smart contracts. If you are a beginner in Blockchain, follow this guide and in 6 month you will find a job as Blockchain developer. 

Overview (0:53)
Step 1 (1:48): Define your goals
Step 2 (7:03): Pick a Blockchain
Step 3 (10:30): Learn about existing Ethereum Dapps
Step 4 (14: 17): Learn Ethereum
Step 5 (17:34): Learn Development Tools & Libraries
Step 6 (21:45): Learn Smart Contract & Solidity
Step 7 (25:41): Build your own Dapp
Step 8 (30:15): Prepare for Blockchain interviews
Step 9 (31:48): Apply to Blockchain jobs
Step 10 (33:19): Get help from the community
Emacs: Highlight $FlowFixMe comments
Tags: emacs, flow, javascript
Published: 2018-11-30 00:19:37

---
title: Emacs: Highlight $FlowFixMe comments
published: true
tags: emacs, flow, javascript
canonical_url: https://www.chaseadams.io/2018/emacs-highlight-flow-fix-me/
---

I've been working with Flow a lot since joining Webflow and one of the things that I constantly miss is the `// $FlowFixMe` comments. I decided to highlight `// $FlowFixMe` comments in red so they stood out.

Emacs makes it trivial to add configuration to highlight specific lines based on certain criteria. In `init.el` or any file that you load configuration through, you can add the following:

```lisp
  (defface flow-fix-me-comment '((t (:foreground "#ff0000"))) "Red")

  (font-lock-add-keywords
   'js-mode '(("// $FlowFixMe" 0 'flow-fix-me-comment t)))
```

Breaking it down:

- `defface` allows us to declare a customizable `FACE` (you can think of `FACE` as a style). We're naming it `flow-fix-me-comment`
- `font-lock-add-keywords` allows us to highlight a mode based on a specific keyword.
- `'js-mode` is the mode we want to highlight on.
- `"// $FlowFixMe"` is the term we want to use as the criteria for highlighting.
- If the term matches the line, apply the `flow-fix-me-comment` `FACE`.

Make sure to `eval-buffer` on the snippet, reload your config or restart Emacs to see the changes take place.

The end result will look like this:

![Use Emacs to highlight $FlowFixMe in Javascript](https://thepracticaldev.s3.amazonaws.com/i/cyqnkkqw1eb8bdvbme2q.png)

If you're using Emacs to develop for JavaScript and using Flow in your projects, this is a great way to make sure you don't get burnt by any `$FlowFixMe` comments during development!
Why I attended a coding bootcamp
Tags: bechev, bootcamp, flatironschool, beginners
Published: 2018-11-30 00:07:52

---
title: Why I attended a coding bootcamp
published: true
description: Why did I attend a coding bootcamp
tags: bechev, bootcamp, Flatiron school, beginner
---

After 8 months of hard work, I'm finally there - about to graduate from my coding bootcamp. So now, what?

###__Flashback__:
At around 18 years old, I attended an engineering school back in France. This is where I had my first experience coding. I was never really exposed to it before. 
The least I can say is that experience was not very conclusive. It was almost 15 years ago and most memories are a bit fuzzy but what I do remember is how abstract it was.
We were asked to build some functions that will return some values. _Hum... ok. and so? what happened?_ As you know, when you return a value, nothing is printed, ___you do not see the result___ of your function. This is exactly where I got lost. I needed to ___see___ what happened.
A few classes of physics and months after, my decision was made. I'll study economics and finance instead of engineering.

###__Fast forward 3 years:__
I am now working towards my masters degree in Finance and as all finance students I need to be proefficient in Excel and part of my curriculum are dedicated lessons which extend to VBA and C.
This is the moment I became conscious of the power of programming. VBA is actually extremely visual. What ever code you write you see the changes in your spreadsheet. It's ___AWESOME___. I love it! (___I loved seeing the changes so much that I was initially using the spreadsheets as arrays so I could see even more changes...___) In my group of friends, I become the "__coding guy__". Taking care of the programming aspect of projects (options pricer, stock market simulation etc).

###__Fast forward 11 years (roughly 8 months ago):__
I am now working as a consultant in Finance, barely doing any coding. Over the years, I took a bunch of online tutorials and MOOC to teach myself. I understand the basics of object-oriented programming, ___almost got fired from an internship for programming a Christmas tree with decoration which changes color on Excel___ and recently moved to New-York City for work.
Coming from France, I discover a brand new world in New-York City. People have 20 side businesses, they keep learning new things and one very trendy thing to learn is coding. To answer for this demand, ___bootcamps___ are here and that's exactly what I did.

###__Current times:__
It's been 8 months, I finished my online bootcamp, I "___know___" how to build a website. And so now, ___what?___

Feel free to follow me on:

- [Twitter](https://twitter.com/bechev?lang=en)
- [Instagram](https://www.instagram.com/bechev_/)

__Notes:__ 
This article is the first of two. The second one reflects on the learning experience during the bootcamp and start to answer the "so now, what?". [Please find it here](https://dev.to/bechev/so-now-what-part-2-5aii)
This article was originally posted on 9/29/2018
The Art of Refactoring II: Refactoring For Clarity
Tags: refactoring, c, dotnet
Published: 2018-12-08 00:14:45

---
title: The Art of Refactoring II: Refactoring For Clarity
published: true
tags: refactoring, c#, dotnet
canonical_url: 
---

With the set of readability-enhancing strategies from [Part 1](https://makingloops.com/art-of-refactoring-part-1/) added to our toolset, let’s apply them to our original _code blob_ and see what comes out of it.

I decided to go the video route with this one. Let me know what you think about this format in the video comments!

{% youtube KAULqXHw83M %}
AWS Lambda Rust Runtime Announced
Tags: aws, serverless, rust, lambda
Published: 2018-11-30 04:57:27

---
title: AWS Lambda Rust Runtime Announced
published: true
tags: aws,serverless,rust,lambda
canonical_url: 
---

Among [the AWS Lambda announcements](https://aws.amazon.com/blogs/aws/new-for-aws-lambda-use-any-programming-language-and-share-common-components/) is a feature called “Lambda Runtime API” to enable use of different programming languages.

This is accompanied with the immediate availability of a [Rust Runtime](https://aws.amazon.com/blogs/opensource/rust-runtime-for-aws-lambda/)!

There’s been a lot of “serverless”, “Wasm”, and other web-technology buzz-words flying around (as always), and my stance is usually _wait and see_. But this is very tempting and may be the nudge I’ve been waiting for- I **do** like AWS.
How to effectively spread test culture at organization level? 
Tags: discuss
Published: 2018-11-29 23:21:06

---
title: How to effectively spread test culture at organization level? 
published: true
description: It's been 4 years since I have started working as a software developer, but my current project is only the third one to have automated tests. I have found that they are crucial to any project. Most times, the team decided not to write tests due to tight deadlines. I would like to know if you people have already experienced this sort of situation and what actions did you take.
tags: discuss
---
Episode 11: Building a JSON API - Input Validation and Sanitation - Part 2
Tags: node, mongodb, javascript, docker
Published: 2018-11-29 23:06:35

---
title: Episode 11: Building a JSON API - Input Validation and Sanitation - Part 2
published: true
description: Episode 11 continues where episode 10 left off.. more validation and sanitation on inputs.
tags: nodejs, mongodb, javascript, docker
series: building-a-json-api-with-express
cover_image: https://thepracticaldev.s3.amazonaws.com/i/8b9ad6wy0ot8973k83p8.png
---

Input validation and sanitation, mostly sanitation. Finishing up the Read route, then continuing on to Update, and Delete.

{% youtube sm3236gXqT4  %}

There is still more to cover, in particular the item validations, but given that is a dynamic object almost entirely, almost all we could do is escape the values that are passed to it. Does it deserve its own episode? Let me know.

Thanks for watching! 

Source code:

{% github NathanBland/core %}
A Telegram Bot that manages your torrents
Tags: showdev, telegram, bots, python
Published: 2018-11-29 22:59:32

---
title: A Telegram Bot that manages your torrents
published: true
description: TeleTor Telegram Bot
tags: #showdev #telegram #bots #python
---
The bot solves simple problem: it allows you to manage torrents downloads started either on your raspberry pi or on your pc under linux from Telegram. It's convenient to use from mobile.
The bot is easy to use. It was built in Python.

<img src="https://www.dropbox.com/s/vj9liavfx9xph4x/TeleTor.gif?raw=1" alt="TeleTor Telegram Bot" width="550"/>

It helps you to manage your torrents in Transmission BitTorrent client.
Installation is quite easy.

You can list, start, stop, delete your torrents. It's possible to set a path aliases which will be used for downloads.
Download progress is shown in realtime.

[GitLab repo](https://gitlab.com/ray.kovalev/teletor "TeleTor"), [GitHub repo](https://github.com/iRay/TeleTor "TeleTor")
My Journey through Javascript: Arrays and Objects
Tags: beginners, javascript, arrays, objects
Published: 2018-11-29 22:40:18

---
cover_image: https://thepracticaldev.s3.amazonaws.com/i/qm5agvvnyj7vko840vhu.jpg
title: My Journey through Javascript: Arrays and Objects
published: true
description: An overview of what I learn as I learn Javascript
tags: #beginner #javascript #arrays #objects
<meta prefix="og: http://ogp.me/ns#" property="og:image" content="{link to image address}" />
---
Now that we know basic syntax we can talk about more advanced variable types, <em>arrays and methods</em>. We learned in my previous post about <a href=https://dev.to/reduncan/my-journey-through-javascript-basic-syntax-bj6>Basic Syntax</a> that numbers, strings and booleans are types of variables in JavaScript. However, we also have arrays and objects. 

<strong>Arrays:</strong>

    const cars = ['Tesla', 'Ford', 'Honda', 'Jeep'];

- list like variables 
- the length and the type of elements inside an array are not fixed
- elements inside of arrays can consist of any type of variable that we have already discussed
- arrays are denoted using an open and closing square bracket []
- the elements inside of an array are separated by a comma
- elements inside of an array can be accessed using bracket notation (cars[1])
- the numbering of elements inside of an array begins at 0

<strong>Objects:</strong> 

    const car = {
        make: 'Tesla',
        model: 'Model X',
        price: 71,200,
        color: 'red'
    };

- list of key / value pairs
- key / value pairs can consist of any elements, even functions
- objects are denoted using opening and closing curly brackets {}
- key / value pairs are denoted by stating the key then having a colon followed by the value (make: 'tesla') 
- each key / value pair is separated by a comma
- key / value pairs in an object can be accessed using either dot notation (car.name) or bracket notation (car[name]), but dot notation is the standard

Now we can make it even trickier and have an array of objects. These are formatted by creating an array and each item in the array is an object made of key / value pairs. 

    const cars = [
        {
            make: 'Tesla',
            model: 'Model X',
            price: 71,200,
            color: 'red'
        },
        {
            make: 'Tesla',
            model: 'Model S',
            price: 65,000,
            color: 'silver'
        },
        {
            make: 'Tesla',
            model: 'Model 3',
            price: 34,200,
            color: 'black'
        }
    ];

The same properties from above still apply to an array of objects, but the way we access key / value pairs does change. To access the key / value pairs we must use dot and bracket notation. If we wanted to access the price of the Tesla Model S we would type cars[1].model. We have to use bracket notation to access the correct object in the array and dot notation to access the key / value pair inside of the second object. 

These are the basics of arrays and objects! Next time we will look at array and object methods. 

Until next time :)
SparrowHub's new design
Tags: sparrowhub, perl, linux, scripts
Published: 2018-11-29 21:39:52

---
title: SparrowHub's new design 
published: true
description: SparrowHub has got a new look and style
tags: sparrowhub, perl, linux, scripts
---

Enjoy!

https://sparrowhub.org


What's been changed:

- UI has been redesigned and made more laconic and pragmatic
- The latest version of Twitter bootstrap is used
- New introduction for technical and none technical people

---

SparrowHub is a Script Management System written on Perl.
Migrations on the Hasura GraphQL Engine (Heroku to Digital Ocean)
Tags: graphql, vue, javascript, youtube
Published: 2018-11-29 19:05:58

---
title: Migrations on the Hasura GraphQL Engine (Heroku to Digital Ocean) 
published: true
description: I show you how to migrate a Web Application running with the Hasura GraphQL Engine in the backend from the Heroku cluster to a Digital Ocean droplet.
tags: GraphQL, Vue, JavaScript, YouTube
---
If you've been keeping track of some of my posts:


{% link https://dev.to/malgamves/vue-x-hasuragraphql-2pki %}
{% link https://dev.to/malgamves/using-mutations--22d2 %}

I've been building a web application with Vue.js powered by a Hasura backend using GraphQL. Now Hasura just launched a DIY GraphQL BaaS with DigitalOcean and Auth0 and I wanted to see what it would take to migrate my Vue app from its existing Heroku backend to this shiny new DigitalOcean setup.

I've been dodging video content for a while, so I was delighted to work on this.

{% youtube eWymkJ3KF6g %}

Let me know what you think. All feedback is welcome!
The last three weeks have been a roller coaster ride - it's been amazing! I'm putting together a post to share everything that I've been up to. Excited? 
Have a great week ❤
CLibs: A Package Manager for C
Tags: c, clibs, package, manager
Published: 2018-11-29 18:18:54

Many modern-day languages like Python and Rust have their own standard package managers that help with installing dependencies for projects. C never had one... until now.

CLibs is a package manager for C that is focused on "micro" libraries. This means all libraries you can install with CLibs are lightweight, fast, and have a small footprint in your overall projects.

## Getting Started

To install CLibs, enter in the following commands into your preferred terminal:

```cpp
git clone https://github.com/clibs/clib.git /tmp/clib
cd /tmp/clib
make
sudo make install
```

Make sure you have the developer version of libcurl installed on your system.

Searching for the package you need is easy.

```cpp
clib search [package-name]
```

Installing is also easy.

```cpp
clib install <user>/<repo>
```

You can install more than one package at a time.

## Integrating with CLibs

Maybe you're convinced that CLibs is the package manager for C and you would like to get your project to become supported by CLibs.


The way CLibs was created in mind, this is extremely simple to do. Create a package.json file at the root directory of your project. A template would like something like the following:


```cpp
{
  "name": "term",
  "version": "0.0.1",
  "repo": "clibs/term",
  "description": "Terminal ansi escape goodies",
  "keywords": ["terminal", "term", "tty", "ansi", "escape", "colors", "console"],
  "license": "MIT",
  "src": ["src/term.c", "src/term.h"]
}
```

For more details on package.json: https://github.com/clibs/clib/wiki/Explanation-of-package.json

Now that you know a package manager exists for C, will you add support for CLibs?

Github repository for CLibs: https://github.com/clibs/clib
Basic Data Structures - Review
Tags: linkedlist, stack, queue, tree
Published: 2018-11-29 18:15:21

---
title: Basic Data Structures - Review
published: true
description: Crash course in Data Structures
tags: linked list, stack, queue, tree
cover_image: https://visualgo.net/img/gif/bst.gif
---
## This is recap of crash courses and blogs teaches you how to implement your basic data structures. We built these from scratch using C++.

You will learn the concept, trade offs, how to build and implement: single linked list, stacks, queues and trees.

Start from here:
[Single Linked List](https://dev.to/mkhy7/all-operations-and-algorithms-on-single-linked-lists-in-c-1h92) 
[Stacks](https://dev.to/mkhy7/stack---data-structure-59h1) 
[Queues](https://dev.to/mkhy7/queue---data-structure-2n8b) 
[Introduction to Trees - Part 1](https://dev.to/mkhy7/trees---data-structure---part-1--9n3) 
[Depth-first-Search (DFS) - Part 2](https://dev.to/mkhy7/depth-first-search-dfs-5573) 
[Breadth-First-Search (BFS) - Part 3](https://dev.to/mkhy7/breadth-first-search-bfs---part-3-4385) 
 

Next, In fact I have 3 options to continue talking about:
* Continue with data structure like Priority Queues, Heap, Hash Tables and etc.
* Or algorithms on Graphs.
* Or another topic which I prefer - Multimedia algorithms, Things like Lossless compression, Lossy compression algorithms, etc.

Last thing to say, Thanks for reading and I hope it would help and don’t hesitate to send your feedback and suggestions :))
Ruby Now Supported Natively on AWS Lambda
Tags: news, ruby, aws, serverless
Published: 2018-11-29 18:01:38

I don't have much more context than this:

{% tweet 1068200190971002880 %}

{% tweet 1068200104765513728 %}

{% tweet 1068200170771439617 %}

But... I'm very happy.

Ruby seems like a great fit for Lambda and anything non-natively supported is often just not worth it.

Ruby's benefits—simple and readable syntax, great for scripting through small problems—strike me as just right for a serverless environment. Ruby isn't exactly natively great at the kinds of things we ask it to do as a server-side language powering Rails etc.

Anyway, as a Rubyist, this is lovely to me. I'd love to hear others' takes.
Hosting Applications using DigitalOcean and Dokku
Tags: node, digitalocean, dokku, clouddevelopment
Published: 2018-11-29 17:36:39

---
title: Hosting Applications using DigitalOcean and Dokku
published: true
description: Let's create some simple Node applications, and host them on our own DigitalOcean server using Dokku
tags: #nodejs #digitalocean #dokku #clouddevelopment
canonical_url: https://auth0.com/blog/hosting-applications-using-digitalocean-and-dokku/
---

In this article, we're going to be creating a couple of very simple Node applications and hosting them on a DigitalOcean droplet using Dokku, an open-source PaaS. We'll also be looking at how to optimize the deployment using Docker.

[Read on ☁️](https://auth0.com/blog/hosting-applications-using-digitalocean-and-dokku/?utm_source=dev&utm_medium=sc&utm_campaign=host_dg_dokku)

![Hosting Applications using DigitalOcean and Dokku](https://thepracticaldev.s3.amazonaws.com/i/b4q7g8wi8wq1y3fuslww.png)