teleren/devto huggingface dataset:
Indiana Jones Refactoring
Tags: libraries, api, refactoring, juniordeveloper
Published: 2018-08-01 19:05:49

---
title: Indiana Jones Refactoring
published: true
description: Bushwacking into the jungle of a 3rd party library to get one artifact
tags: libraries, api, refactoring, junior developer
---

I remember as a kid the first time I watched Indiana Jones and the Temple of Doom. Exciting, adventurous, and terrifying at times. When I became a developer a few years ago, I felt the same way. In the films, Indiana is after a specific artifact, preventing bad guys and gals from destroying the world. He travels far and bushwacks through the jungle with his trusty bullwhip to defend himself and get out of danger.

As a new developer, unlike Indiana Jones, I didn't always keep my eyes on the prize. Often I was too timid to refactor methods and functions down to their basic needs. And I assumed the developers before me that took on dependencies were wise and using massive libraries for small benefit was the best choice.

I remember a specific project when I was connecting to a third party API, using their provided Java library. I only needed the authentication method to call their API. My code could handle the HTTP calls, error handling, retry logic, paging, throttling and all the rest. In my case, their method of API authentication was my Ark of the Covenant, or Mystical Stone, or Crystal Skull, for the younger crowd. In other words, I didn't need the jungle, the temple, the jeep, the local to lead me to the temple or anything else. I just needed one core piece. Yet, my code was using that core artifact, and also took on the temple, the jeep, the jungle and so on.

On a bold day I decided that I was tired of maintaining a whole library for one piece, and hacking around that dependency. I decided to grab a machete and bullwhip, and I would bushwack deep into the jungle of that library and extract the artifact I needed. When I stepped in to that breakpoint in my IDE, I knew there was no going back. And after some time finding the authentication classes, I extracted the logic to authenticate the API. It turned out to be one method, that I copied and pasted into my code.

I removed the dependent library and dropped a huge amount of weight on the server hosting it. I learned how to step out of my comfort zone, and gained confidence and felt powerful. I had ripped the heart out of the library, much like in that scary scene in Temple of Doom.

Dependencies aren't bad either. If you use a library for the core of your workflow, using someone else's maintained, secure library is a great way to save time and money. But if you only need one aspect of the library, don't be afraid to dive into their code and see how they did it, so you can do it better. You just have to accept that you're on the hook to update it when they update their API.
dev.to as a glyphicon
Tags: discuss, webdev, ux, design
Published: 2018-08-01 18:25:16

---
title: dev.to as a glyphicon
published: true
description: dev.to's icon integrated to icons sets
tags: discuss, webdev, ux, design
---

Would dev.to get its image to be a useable glyphicon/icon for font-awesome, material design icons and possibly other widely used icon sets by developers?

This thought came to my mind as I was working on a portfolio example and wanted to add my dev.to link among the others (e.g.: Facebook, Hashnode, Quora, Linkedin, GitHub, ...) but neither [font awesome](https://fontawesome.com/icons?d=gallery&q=keybase) nor [material design](https://material.io/tools/icons/) had anything close or representative to the icon of this fantastic communal website.
Mount Docker volume locally
Tags: docker
Published: 2018-08-01 15:24:00

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/y9hxcwi5y92j6zfcxbjx.jpg
title: Mount Docker volume locally
slug: mount-docker-volume-locally
date: 2018-08-01 15:24
published: true
tags:
  - docker
---

Edit 25 Oct 2021: Seems this no longer works. So much for a workaround.

Here is something that's cool.

You can have a docker volume, `docker volume create example`, and you can mount this volume to a container, `docker run -v example:/path image`. You can also mount local directories to containers, `docker run -v $(pwd)/local:/path image`. But something you can't do, is mount a local directory to volume.

Scenario: you have a volume, you have a container using that volume, and you have some software that needs to access that volume data locally, outside of docker.

🚫`docker run -v $(pwd)/local:example image` isn't going to work.

Nor can you mount two things to the same place.

🚫`docker run -v example:/example -v $(pwd)/local:/example image` isn't going to work either.

The solution is to use intermediate symlinked container.

I call this solution the map volume.

```
#
# map volume
#
FROM busybox
RUN mkdir /volume
RUN ln -s /local /volume
CMD tail -f /dev/null
```

In this dockerfile you can see that we create a directory (later to be used as a mount point), and then we create a symlink directory pointing to the same place.

```
$ docker build -t mapvolume .
$ docker volume create my_precious_data
$ docker run -d -v my_precious_data:/volume -v $(pwd)/my_precious_data:/local mapvolume
```

We create a volume `my_precious_data`, then we run the mapvolume, first mounting the volume `my_precious_data` to the container path `/volume`, and then mounting the local directory `$(pwd)/my_precious_data` to the container path `/local` which as we saw, is actually `/volume`.

Now you have mounted a docker volume to your local filesystem.

**Update:** I realised today that the original dockerfile wouldn't stay alive. I therefore changed the CMD to `CMD tail -f /dev/null` to keep the container alive. Thanks to [bigdatums.net](http://bigdatums.net/2017/11/07/how-to-keep-docker-containers-running/) for that snippet.
Need help in Integration testing ruby
Tags: ruby, testing, rails, help
Published: 2018-08-01 17:37:52

---
title: Need help in Integration testing ruby
published: true
description: Help needed!
tags: ruby, testing, rails, help
---


**Hello DEV.to community!**

I am a bit nervous to ask this question here. But I really need your help on this.
I am new to ruby and test driven development. I just wanted to know how you guys do *Integration testing* in your rails project. Integration test are too slow and sometime fails. I want to know how you guys do Integration testing in your projects and make them faster. Also how you manage to do testing for different screen sizes like mobile and tablets.

I am a beginner rubyist. If you can suggest any good platform/community to ask this ques please recommend that too. 😁
Build invoices based on Wunderlist
Tags: python, freelance
Published: 2018-08-01 04:13:21

---
title: Build invoices based on Wunderlist
published: true
description: 
tags: #python #freelance
---

The last 8 years I am working on contracts on remote and for the clients that are charging by hours, it would require to send invoices hourly every 2 weeks. I was trying to use the different applications for invoicing but then moved away and used google docs to build it. 

Then I found Wunderlist, nice todo list application. I created Shopping and TODO lists and started to use daily. as result it became like a habit for me to write there. I decided that it would be awesome to track my hours there as well.

Example format for task hours:

```
<hours> hours TASK-1
<minutes> minutes TASK-2
<days> days TASK-3
```

After month I decided to download this list and calculate hours that spent for the month. As result I did the script for downloading the hours report into csv file.


```python
import wunderpy2


from dateutil import parser
from datetime import date
from csv import writer


ACCESS_TOKEN = '<WUNDERLIST_ACCESS_TOKEN>'
CLIENT_ID = '<WUNDERLIST_CLIENT_ID>'
PROJECT_BOARD = 'LIST_TITLE'
HOUR_RATE = 1


def __build_hour(task):
    '''
    Example:
        dict(title='1 hour CORE-1234')
        dict(title='5 hours CORE-4321')
        dict(title='1 minute CORE-1234')
    '''
    columns = task['title'].strip().split(' ')
    time, measure, task_id = columns
    if measure == 'hour' or measure == 'hours':
        hours = float(time)
    elif measure == 'minute' or measure == 'minutes':
        hours = float(time) / 60
    elif measure == 'day' or measure == 'days':
        hours = 24 * float(time)
    else:
        raise 'unknown measure from the task title: ' + task['title']

    return dict(
        task_id=task_id,
        created_at=parser.parse(task['created_at']),
        hours=hours)


def __main__():
    api = wunderpy2.WunderApi()
    client = api.get_client(ACCESS_TOKEN, CLIENT_ID)
    board = [l for l in client.get_lists() if l['title'] == PROJECT_BOARD][0]
    active_tasks = [t for t in client.get_tasks(board['id']) if not t['completed']]
    report = [__build_hour(task) for task in active_tasks]

    estimated_earnings = sum([task['hours'] for task in report]) * HOUR_RATE
    print(estimated_earnings)

    with open(f"report-{date.today()}.csv", 'w+') as f:
        w = writer(f)
        rows = [[task['task_id'], task['hours'], task['created_at'].date()]
                for task in report]
        w.writerows(rows)

    for task in active_tasks:
        client.update_task(task['id'], task['revision'], completed=True)

    # TODO: make monthly output report to pdf file based on created_at field.


if __name__ == '__main__':
    __main__()

```
Firebase Functions で Node.js 8 使えるようになったぞ〜〜〜！！！
Tags: firebase, cloudfunctions, firebasefunctions, node
Published: 2018-08-01 16:22:08

---
title: Firebase Functions で Node.js 8 使えるようになったぞ〜〜〜！！！
published: true
description: Firebase Functions で Node.js 8 を使う方法
tags: Firebase, Cloud Functions, Firebase Functions, Node.js
---

# tldr

* `firebase-tools` をアップグレードする
* `functions/package.json` に `"engines": { "node": "8" }` を追加する
* `firebase deploy`

# 経緯

https://cloud.google.com/functions/docs/concepts/nodejs-8-runtime でしれっと（？） Cloud Functions で Node.js 8 が使えることが書いてあって(あと Python)小躍りしながら試しました。

じゃあ Firebase Functions でも使えるんじゃね...?と調べてみても、全く情報が出てきませんでした。ウェブのコンソールからランタイムを変更できる、と書いてる記事もあったのですが自分のプロジェクトにはそういう項目はなく...。

firebase-tools のリポジトリを `runtime` で検索すると対応しているっぽい雰囲気がありました。しばらくコード追ったりした後に、最初に気付けばよかったんですが、リリースノートにちゃんと書いてありました。

https://github.com/firebase/firebase-tools/releases/tag/v4.0.0

まずはちゃんとリリースノートを読もうな！

# 余談

しばらく見ない間に TypeScript にもオフィシャルに対応していて `firebase init` で対話的にプロジェクトを作成する際に TS でスキャッフォルドを作ってくれるのでお手軽に型を付けられるようになっていた。かなりマトモな環境の Node.js 8 で動かすものを TS で書けるとなるとだいぶ選択肢に入ってくるのでは...?というカンジがした。まだ beta っぽいけどガンバッテほしい...!
Boost LINE Bot development productivity by using LINE Client Simulator App
Tags: line, simulator, bot, visualstudiocode
Published: 2018-08-01 15:10:36

---
title: Boost LINE Bot development productivity by using LINE Client Simulator App
published: true
description: Boost LINE Bot development productivity by using LINE Client Simulator App
tags: Line,Simulator,bot,VisualStudioCode
cover_image: https://thepracticaldev.s3.amazonaws.com/i/s8ugmqq9vbbr5vcd6kei.png
---

[In this article](https://dev.to/kenakamu/boost-line-bot-development-productivity-by-using-line-client-simulator--12o2), I explain LINE Simulator for bot developer. It works okay, but it was a web application, which was not perfect for Mac or PC.

This time I moved the solution to Electron app so that it is native app on Mac and PC.

# Install

Go to [Release](https://github.com/kenakamu/LINESimulator/releases) of my GitHub repo and download the app. For Mac, download the zip file and unzip it. For Windows, download setup.exe and run the installer.

# How to use

It's super simple. 

1. Run the simulator once installed.
![image](https://thepracticaldev.s3.amazonaws.com/i/exlqxgi2m7lo07kt5yvk.png)

2. Enter UserId, ChannelSecret, ChannelToken and Bot API Server Address. The application uses these information to talk to your bot service.
![image](https://thepracticaldev.s3.amazonaws.com/i/n5aqoxcyyzsd8suc2bf9.png)

3. Check "always on top" if you want the simulator runs on top of everything.

4. Click Connect. (or POC if you want to do POC mode)

5. Run your bot by specifying http://localhost:8080 as LINE Platform address so that your bot talks to the simulator rather than actual platform.

6. Use it.
![image](https://thepracticaldev.s3.amazonaws.com/i/j9tmwprrzyax7dfl5iqk.png)

# Need your feedback

This application is far from completion and need your feedback. Please play with it and let me know any issues or suggestions.

Ken
Latest Mobile Application Testing you Need to Know in 2018
Tags: blog, apptesting, mobileapplicationt, testing
Published: 2018-10-04 11:51:53

---
title: Latest Mobile Application Testing you Need to Know in 2018
published: true
tags: Blog,App Testing,Mobile Application T,Testing
canonical_url: 
---
![](https://www.itfirms.co/wp-content/uploads/2018/08/latest-mobile-application-testing-you-need-to-know.jpg)

Although it is important to test the hardware, it is the software that unleashes the true potential drop of the mobile devices. The application market is the driving force behind the mobile market. Read full article [https://www.itfirms.co/latest-mobile-application-testing-you-need-to-know/](https://www.itfirms.co/latest-mobile-application-testing-you-need-to-know/)
How do you name your devices?
Tags: discuss, namingconvention
Published: 2018-08-01 12:42:39

---
title: How do you name your devices?
published: true
description: What's in a name? How do you name your devices?
tags: discuss, naming-convention
---

Names can be a powerful thing.  Each of my devices fall into a naming convention.  Some of you probably use practical names, but I'm interested in the fun ones.

My Windows machines are Dharma Stations from lost: Orchid and Tempest.

My wireless devices are astronomical bodies: Cepheus, Cassiopeia, Artemis

Or do you leave the default name?

Discuss below!😝
What do you wish you had learned when learning your first programming language?
Tags: discuss
Published: 2018-08-01 11:12:38

---
title: What do you wish you had learned when learning your first programming language?
published: true
description: 
tags: discuss
---

Maybe you learned how to code through a book, a tutorial, a bootcamp, your school. Whatever the case may be, this question applies to you: What do you wish you had been taught but weren't?

I have the impression many resources focus on syntax which is good, except they tend to do it at the expense of everything else. A lot of habits, methods, and strategies to write solid code, to debug, etc. seem to get left out.
How does Diffie-Hellman work?
Tags: communication, example, secret, encryption
Published: 2018-08-01 06:45:33

---
title: How does Diffie-Hellman work?
published: true
description: We look closer at an encryption algorithm used in communication today in order establish secrets at two endpoints.
tags: communication, example, secret, encryption
---

{% youtube yaWN1Xwj424 %}
Twitter Heart Button Animation Using CSS3
Tags: html, css, javascript, webdev
Published: 2018-08-01 03:52:40

---
title: Twitter Heart Button Animation Using CSS3
published: true
description: Twitter Heart Button Animation Using CSS3
tags: #html #css #javascript #webdev
---

Post Link : https://www.skptricks.com/2018/02/twitter-heart-button-animation-using-css3.html


In this tutorial we are going to discuss how to create Twitter Heart Button Animation Using CSS3. If you are user of twitter you may have been observed Twitter Heart Animation. All the animation effect is controlled by transition Property of CSS and it provides very smooth animation effect.
twitter heart animation, twitter like heart animation, twitter heart animation css

<a href="https://www.skptricks.com/2018/02/twitter-heart-button-animation-using-css3.html">Twitter Heart Animation Button</a>

<img src="https://3.bp.blogspot.com/-J2gNNrDic2M/WnWPQnUEQcI/AAAAAAAABQU/mqqgkZicfnc8JzleY-zgjPj9xpNMW5a3ACLcBGAs/s400/ezgif.com-video-to-gif.gif" />

We have tried our best to make this tutorial very simple and hope you will like this. Also transition property of CSS helps to display heart blast effects, when user click on heart button. Without wasting time lets get started.

{% youtube IR4ZxcMsksY %}
Why companies force people to switch - thoughts of a junior 'Indian IT' developer
Published: 2018-08-01 03:02:02

---
title: Why companies force people to switch - thoughts of a junior 'Indian IT' developer
published: true
description: One question that always intrigued me ever since I joined the industry is why companies force people with aspirations to be more, to switch to get what they want. Why not retain them? I am writing my theory. Please feel free to start a discussion.
tags: 
---

Okay, so you got campus placed. A major Indian service firm has hired you along with thousands of others. You get trained before they post you and is offered something like 3.5 LPA. But why we get hired in the first place? 2 reasons, growth and attrition. 
Let's take a look at attrition. Just like how you were hired, some years back, your seniors were hired. Post training and getting allocated to projects, they started contributing to the team in say 6 months (the eagerness of a fresher 😁). Let's assume 10 people who were hired like this for simplicity sake. Of these one is highly aspirational and is contributing big whereas 4 are pretty intelligent and dedicated although not as break neck dedicated as the first. Remaining 2 are not so bright but yet dedicated and lets think the last 3 have other plans (studies or so). After the initial 6 months, the first 5 gets more assignments which are more challenging and they learn more and more. This has a compounding effecy on their quality of work. In about 1 year and the first exceptional performer fellow catches up with the quality of work done by a similar 4 year experienced hire from a same tier college. And in 6 more months the remaining 4 catch up. Once it is almost 3 years the aspirational one gets another offer and switches while the remaining 4, has developed a comfort zone, attachment etc to their place of work and feel hesitant to leave because everything is fine. A lateral is brought in to replace the first guy who does similar work to the remaining 4 but he is paid 1.5 times more as he is a lateral. Our 4 friends take home, let's say 28000 per month while the lateral gets 45K. Now what do we have here? We have 4 good performers who are not rewarded for their work and a new guy who is equal comes in and gets paid more? Wth??
Let's look at from capitalist's perspective, how much it would have cost if they were rewarded. Let's assume that all of the 5 got a raise to 40K per month which is equal to the lateral hire pay in the market for their experience. Cost of keeping 5 developers is 40K * 5 which is 800K per month. This is definitely higher than handling an exception scenario of an exit by substitution with a higher paid lateral. By this time the last 3 have left company for their alternate plans and new freshers are brought in. They get to work with the 4 seniors who have right now some sort of attachment too with this working environment (contributes to building employee morale in the new guys). The freshers start contributing in 6 months and the cycle continues.
Thats my theory. If any one would like to add or discuss, please feel free to do so.
TIL: SVGs have additional pointer-events properties
Tags: css, svg
Published: 2018-08-02 11:14:58

---
title: TIL: SVGs have additional pointer-events properties
published: true
tags: css, svg
canonical_url: https://www.stefanjudis.com/today-i-learned/svgs-have-additional-pointer-events-properties/
---

Today I came across [this example](https://codepen.io/MartijnCuppens/pen/MBjqbM?editors=1100) about certain things you can do with `pointer-events` in CSS.

```css
.foo {
  pointer-events: visiblePainted;
}
```

`visiblePainted` is something I haven't seen before and it turns out that SVGs several other values for the `pointer-events` property:

- `visiblePainted`
- `visibleFill`
- `visibleStroke`
- `visible`
- `painted`
- `fill`
- `stroke`
- `all`

You can control very granular how elements in an SVG should behave and it's not bound to the typical "web development boxes". If you want to read more [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events) has you covered. :)
Different notations used for compound words
Tags: notation
Published: 2018-09-10 08:13:03

---
title: Different notations used for compound words
published: true
tags: notation
canonical_url: https://www.enriquemorenotent.com/post/different-notations-used-for-compount-words
---

Programmers usually have a problem when they have to use more than one word to describe something, but they are not allowed to use spaces or punctuation signs. An example of this would be to name files. If someone wants, for instance, to name a picture where 2 people are talking, he would like to write `John and Mike talking.jpg`, but since a filename cannot contain spaces, he may write something like `john-and-mike-talking.jpg`

To do this, there are many popular conventions, even though they are not standarized. Let’s take a look at some of them.

## Camel case

This system consists in writing compound words or phrases such that each word in the middle of the phrase begins with a capital letter.

`suchWonderfulBlog.txt`

`leaveCommentsBelow.pdf`

## Pascal case

This is a variation from camel case notation. The only difference is that the first letter of the first word is also capitalized. Also called `upper camel case`.

`SuchWonderfulBlog.txt`

`LeaveCommentsBelow.pdf`

## Snake case

In this notation each word will be joined together with a unique underscore.

`such_wonderful_blog.txt`

`leave_comments_below.pdf`

## Kebab case

This case is similar to snake case, but instead of using an underscore, an hyphen is used to join words together.

`such-wonderful-blog.txt`

`leave-comments-below.pdf`

* * *

Let me know if I have missed something!