teleren/devto huggingface dataset:
Looking for feedback - A React component that will function as a "heartbeat", or timer, for an application.
Tags: timerheartbeat, showdev
Published: 2018-08-13 14:52:58

---
title: Looking for feedback - A React component that will function as a "heartbeat", or timer, for an application.
published: true
description: 
tags: timer heartbeat, showdev
---

I have never seen React used like this before so I am curious what other developers will think about it.

Here is the gist: https://gist.github.com/sayes2x/72d884c415662701e38c08b0d696c768

This component is a React implementation of 'accurate interval' developed by @Squeegy which can be found here: https://gist.github.com/Squeegy/1d99b3cd81d610ac7351. Here is how Squeegy's function works: after each setTimeout call, a function compares when setTimeout was called with when setTimeout should have been called. The next call to setTimeout is adjusted to keep it as close as possible to the desired interval.

This component accepts two props:
1. heartbeatInterval: provides an interval in milliseconds, The Heartbeat component will call a function repeatedly at this timer interval as long as it is rendered. The default value for this interval is 1000 milliseconds.
2. heartbeatFunction: a function that will be called every time the heartbeatInterval expires.

This component does not render anything, all the render function returns is a Fragment. The only thing this component does is call a function in a parent component at the set interval.

Here is how I use it:
1. In the parent component I have a state that is a boolean, in this case the state is called paused:
```javascript
this.state = {
  paused: true
}
```
2. In the render function of the parent component, before the return, I have a ternary operator that sets a variable to null if paused is true and sets the variable to the Heartbeat component if paused is false. In this case I used the default value of 1000 milliseconds for the heartbeatInterval prop:
```javascript
const timer = this.state.paused === true ? 
  null : 
  <Heartbeat heartbeatFunction={this.countdown} />;
```
3. In the return part of the render function of the parent component I render the variable defined in step 2, along with whatever else I want this component to render:
```javascript
return (
  <Fragment>
  {timer}
  <OtherComponents or HTML tags />
  </Fragment>
)
```

I like this implementation because all I have to do is change a boolean in the state of my component to turn the timer on or off. Since I have not seen a Componant implemented in this way before, I am looking for feedback from other developers.

To see this componenant used in a project go to https://github.com/sayes2x/pomodoro-clock/tree/master/src/components
This component is in the heartBeat.js file and it is used in the timer.js file
My GitHub Graveyard
Tags: graveyard
Published: 2018-08-13 14:22:48

---
title: My GitHub Graveyard
published: true
description: 
tags: graveyard
cover_image: https://images.unsplash.com/photo-1464753636159-34a03ff9cb02?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=9ef0e9368bf3d7e1154545aac1770fa7&auto=format&fit=crop&w=2550&q=80
---

Following [Isaac](https://dev.to/isaacandsuch/github-graveyards-ill-show-you-mine-49lh) and [K](https://dev.to/kayis/my-github-graveyards-2l95), I've decided to post some of my old projects on GitHub.

# [Task List](https://github.com/Avalander/task-list)

This is a project that I actually completed. It is a simple todo list and the goal was to experiment with progressive web apps. It works entirely offline (it doesn't even have a backend) and it uses a service worker and IndexedDB to store source files and data.

# [Restventures](https://github.com/Avalander/restventures)

The idea behind Restventures was to build a classic text adventure game but instead of text commands, the player would interact with the game through REST endpoints. It never took off, but I still think that the concept is cool. I might continue it some day.

# [GoBot](https://github.com/Avalander/GoBot)

This was my first and last attempt at building something with Go. It is a discord bot and the plan was to implement several text commands that would do cool things. The only command I ever got around implementing was `uptime`, which writes how long the bot has been up. Even though I didn't get very far, I learned how to build and deploy a Go server.

# [Strawberry Alarm](https://github.com/Avalander/strawberry-alarm)

This is another completed project. It is a game that I submitted to [Game Dev's week of awesome](https://www.gamedev.net/calendar/event/95-week-of-awesome-v/) contest. The interesting part is that I built it using functional reactive programming (well, sorta, it's still hackathon code). I wrote a few posts on [my blog on Game Dev](https://www.gamedev.net/blogs/blog/2227-avalanders-journal/) about the process and a post-mortem.

# [Gandalf](https://github.com/Avalander/Gandalf)

Gandalf is a wizard (hence the name) to manage shell scripts. Basically, instead of typing `nano /usr/local/bin/my-script`, I type `gandalf create my-script -e nano` (any editor can be specified via the `-e` parameter). It allows creating templates and including templates in scripts, a template being a file or directory to which the script has access.

Originally I wanted to be able to use it to write customisable boilerplates for my projects, but I never made it sophisticated enough for that. I still use it for simpler scripts though, because it helps me distinguish the scripts that I have created from the scripts that third party packages have installed in my `/usr/local/bin` directory, which is convenient when cleaning up old stuff.

# [Elm Boilerplate](https://github.com/Avalander/elm-boilerplate)

This is a template project for Elm projects with webpack. Nothing very fancy, I just got tired of typing the same webpack config files every time I started a new project.
Share your editor's colorscheme!
Tags: style, colorscheme, editor, discuss
Published: 2018-08-13 13:46:47

---
title: Share your editor's colorscheme!
published: true
description: We all have our own choice of colorscheme, dark, light whatever.
tags: style, colorscheme, editor, discuss
---

![vim](https://thepracticaldev.s3.amazonaws.com/i/yic94k0igpjgjrqxrouq.png)

Mine is `base16-material-palenight`, from the amazing [base16 project](https://github.com/chriskempson/base16). What's yours?
How to compile non-go file into your binary
Tags: go
Published: 2018-08-13 13:19:57

---
title: How to compile non-go file into your binary
published: true
description: I'm going to show you how to compile other files than go into the binary.
cover_image: https://pbs.twimg.com/media/Dke_2uAX4AAFRfq?format=jpg
tags: go
---

 If you're new to compiled languages then you probably wondered "Will my .html or .png files compile into my binary", well to answer that it's not possible but there is a little 'hack' to do it, and im going to show you how to do it!

 First thing, make you sure that you already have **Go** installed and also you'll have to install/download the software called **"GoFiles"** made by me.
 
 *to install GoFiles, follow these steps:*

{% gist https://gist.github.com/OGFris/3431a911093ae25c6e5cd61a8f93e3b6 %}
 
 Now that you've installed *GoFiles*, we can continue. Let's say you created a new go project stored at *$HOME/go/src/TestGoFiles*, in your directory there is a file called *'test.txt'* and you want to include it in your *'main.go'* binary code. You'll have to add the following lines to your *'main.go'* file:

{% gist https://gist.github.com/OGFris/3ea029227c017b7883d22a3a402b2e01 %}

 Then when you want to compile your code, you won't use the command *'go build'* or *'go run'* but instead you'll use **'gofiles compile ./'** !
 
 Now try it by yourself and you'll see that the file got compiled, if you want more examples on how to host the file on a web server for example, see the examples at https://github.com/OGFris/GoFiles/tree/master/example.

 If you got any problem with the software, feel free to open an issue at https://github.com/OGFris/GoFiles/.
Do we need standup?
Tags: agile, discuss, productivity
Published: 2018-08-13 12:45:31

---
title: Do we need standup?
published: true
description: Do we need standup? Adopting Agile methodology to our needs.
tags: #agile #discussion #productivity
cover_image: https://raw.githubusercontent.com/rafalpienkowski/resources/master/do-you-need-standup/background.png
---

Some time ago I read [an interesting article](https://medium.com/@jsonpify/you-dont-need-standup-9a74782517c1) about agile methodology made by an engineering lead at Spotify. As we know, agile is a tool which should suit needs of a team. The author of the article has run a six-month experiment and has reduced number of meetings in his agile team. 

He has introduced, let's call it "minimal meeting" rule which covers:
-	No stand-ups
-	No planning at regular intervals
-	No retros
-	All meetings are optional

[The article](https://medium.com/@jsonpify/you-dont-need-standup-9a74782517c1) describes the author's motivation which was standing behind his decision, so I don't like to repeat his arguments.  You can read it of our own.

### My opinion

"Minimal meeting" rule is too extreme for me because I'm working in teams which are located in offices across various locations. In my opinion, enforcing team members to communicate with each other is essential in daily work, and I can't imagine such a free approach to team meetings.

On the other hand, this experiment is an excellent example of how agile the Agile methodology is and how it could be adapted to current team needs.

### Let's discuss

I'm extremely curious what is your opinion. Do you think will the "minimal meeting" rule work in your teams? Would you like to perform such an experiment in your organizations?
How to deploy a Python app to Heroku
Tags: heroku, python, beginners
Published: 2018-08-13 12:01:36

---
title: How to deploy a Python app to Heroku
published: true
description: 
tags: heroku, python, beginner
---

##### This post is intended to help those learning Python. It will help you deploy your new app to the web so you can test and share it with others. Heroku's own instructions leave out a couple of steps for beginners and so this article gives you everything to get up and running.
---

### Prerequisites:
- Git, if you need help with this, check out my other article [here](https://medium.com/@davedodea/git-commands-you-need-to-git-going-b98adc42182e).
- Sign up for a  [Heroku account](https://signup.heroku.com/signup/dc).
- Python version > 3.6 installed on your machine.
- Pipenv installed: `pip install pipenv`.

### Heroku CLI:
Install the Heroku CLI(command line interface) so that you can deploy/manage your apps/projects from the command line.
`' $ ' preceeds commands to be entered in the terminal/shell`
- MacOS: `$ brew install heroku/brew/heroku`
- Windows: [Download installer](https://cli-assets.heroku.com/heroku-x64.exe) .
- Ubuntu: `$ sudo snap install heroku --classic`

---

#### Step 1:
If you have a ready-to-use Python app, good and well! If not, let's use one that Heroku provide for testing purposes so we can learn the process:
- `$ git clone https://github.com/heroku/python-getting-started.git`

Move into the directory of your app or: 
- ` $ cd python-getting-started`

Install a web server called [Gunicorn](http://gunicorn.org/) within your app:
- `$ pip install gunicorn`

Add your app requirements:
- `$ pip freeze > requirements.txt`

Create a new file with the name: `Procfile` no file extension. Read more on [Procfile](https://devcenter.heroku.com/articles/procfile).
Add to the Procfile, for this particular app:
- `$ web: gunicorn gettingstarted.wsgi`

Your app will have a different setup i.e:
- `$ web: gunicorn app:app`

The above command tells Heroku to start the web server along with the module and application names.


Install the requirements for your app:
- `$ pip install -r requirements.txt`

Now we can deploy our app:
- `$ heroku create`

Push our code to Heroku:
- `$ git push heroku master`

You may need to ensure that at least one instance of your app is up and live:
- `$ heroku ps:scale web=1`

The URL where your app is lve will be displayed or else you can open it in your browser:
- `$ heroku open`

If you'd like to debug some issues, you can view the logs for your app in the CLI:
- `$ heroku logs --tail`

#### Your app is now live on Heroku for you to test and share with others!

If you have any questions or additions to make, please let me know in the comments below or get in touch on [Twitter](https://twitter.com/DaveDODea).

~ Dave.
Custom Object Iterators in JavaScript
Tags: javascript, metaprogramming
Published: 2018-08-13 04:06:24

---
title: Custom Object Iterators in JavaScript
published: true
description: 
tags: javascript, metaprogramming
---

_Originally published on stevebrownlee.com_

Imagine that you have an object in JavaScript that maintains a list of items, and you want the object itself to be iterable, but the object also has other important properties - such as metadata about the list of items.

Here's a fun and completely original example.

```js
const se7enDwarves = {
    employment: "Miners",
    output: "Diamonds",
    members: new Map()
}
```


```js
se7enDwarves.members.set(1, "Sleepy")
se7enDwarves.members.set(2, "Grumpy")
se7enDwarves.members.set(3, "Happy")
se7enDwarves.members.set(4, "Bashful")
se7enDwarves.members.set(5, "Sneezy")
se7enDwarves.members.set(6, "Doc")
se7enDwarves.members.set(7, "Dopey")
```

I now have an object that represents the seven dwarves. It holds their names in an iterable collection, but also other relevent data about them. I would love to be able to iterate over the object itself, instead of having to type in that horrible, troublesome property namespace of `members`.

I want to see the names of all the dwarves, so I use the spread syntax to iterate the object and place the items in an array.

```js
[...se7enDwarves]

VM2417:1 Uncaught TypeError: se7enDwarves is not iterable
    at <anonymous>:1:5
```

JavaScript, in all kinds of holy righteousness, tells me that I can't iterate an object like that.

Hmph.

Luckily, JavaScript allows developers to perform what is called metaprogramming. It's a feature of the language that allows us to modify some of the default behaviors of the underlying data structures available to us. I can make an object iterable.


```js
se7enDwarves[Symbol.iterator] = function* () {
  const states = se7enDwarves.members.values()
  let state = null
  do {
    state = states.next().value
    if (typeof state !== "undefined") yield state
  } while (typeof state !== "undefined")
}
```

High level overview... I made the object iterable. Thought I'd point that out in case it wasn't obvious from that "self-documenting code".


```js
[...se7enDwarves]

(7) ["Sleepy", "Grumpy", "Happy", "Bashful", "Sneezy", "Doc", "Dopey"]
```

## Try it Out on jsfiddle

I create a [JSFiddle for you](http://jsfiddle.net/chortlehoort/fhey7qdm) to play around with this code yourself.
I'm a Salesforce Technical Lead, Ask Me Anything!
Tags: ama
Published: 2018-08-13 11:15:05

---
title: I'm a Salesforce Technical Lead, Ask Me Anything!
published: true
tags: ama
---

I'm currently working for a Swiss company leading the development of their in-house Salesforce platform.

Since Salesforce is a stranger for most developers, I thought it could be interesting to do an AMA about it. Feel free to ask anything :)
The often overlooked consideration when choosing Ruby as your next programming language
Tags: ruby
Published: 2018-08-13 06:42:27

---
title: The often overlooked consideration when choosing Ruby as your next programming language
published: true
description: 
tags: ruby
---

When faced with the choice if Ruby should be your next programming language there is a lot to consider depending on your perspective. If you are new to the industry you might be looking for the fastest way to get a job, for example by checking how many companies are hiring Ruby developers. If you are an experienced engineer you might be looking for a way to solve a technical problem, for example, you might be considering Rails or Hanami to build your next web application.

The point I want to make here is that even though job market and technical considerations are definitely important, making sure that your values align with the ones of the community you will help you stay motivated and keep improving even when faced with hard challenges. Ruby is not just a beautifully designed language (which turned out to be great for building web applications) but it also has a great community around it which will inspire and help you constantly improve your engineering skills.

Everything that follows in this article is anecdotal and based on my own personal experience, so handle with care. Despite that, I think it is worth sharing as an invitation to reflect on what values are important to you and if your community is helping you let them flourish. So, what are the values of the Ruby community? While I can’t speak for the community itself this is what I think best describes the Rubyists out there.

<a href="http://www.alfredo.motta.name/the-often-overlooked-consideration-when-choosing-ruby-as-your-next-programming-language/">Read full story here</a>
Project Enmeti
Tags: vscode, extension, javascript, 100daysofcode
Published: 2018-08-13 06:24:14

---
title: Project Enmeti
published: true
description: A simple extension for Visual Studio Code to help insert links.
tags: vscode, extension, JavaScript, 100DaysOfCode
cover_image: https://i.imgur.com/ldKDy7A.png
---

_Cover Photo by [Derick Anies][6] on [Unsplash][7]_

## My First Real VSCode Extension

In [my post][0] where I talk about starting the #100DaysOfCode challenge, I mentioned one of the potential things I'd work on would be an extension for Visual Studio Code that would help me with inserting links into my Markdown files. This is particularly useful when writing posts such as this one where I do all the writing in a Markdown file on my machine and then copy/paste the content to [dev.to][1] or any other site I'm posting it to.

This is something I found particularly annoying to do, considering how simple and repetitive the process is:

1. Select the text to turn into a link.
2. Add the `[` brackets around it.
3. Add a [x + 1] reference where x is number of the _last_ link I added to the post.
4. Add the reference to the bottom of the file with the link next to it.

While not overly difficult, if you've ever automated/simplified a mundane task then you know the feeling I'm talking about.

## Enter Enmeti

Which leads me to today, where I've actually posted the code online in a [GitHub repo][2]. So far, the extension has nothing more than an `extension.insertLink` command that will surround your selected text with brackets and add a `[0]` reference to the end of it. Nothing fancy to say the least 😅 However, it's a good start as far as I can tell, since I've got the basis for making edits to the currently selected text, and I had _no_ idea how to do that when starting this.

So far, the work I've managed to complete was largely thanks to the [yo generator][3] for Visual Studio Code extensions, the [MDTools example][4], and the [VSCode API documentation][5]. So, a massive thank you to those who took part in those projects.

That's all I've got for today, and I'll be sure to post more updates as I get further along 😊

[0]: https://dev.to/hf-solutions/100-days-of-code-challenge-3j5h
[1]: https://dev.to
[2]: https://github.com/HF-Solutions/Enmeti
[3]: https://code.visualstudio.com/docs/extensions/yocode
[4]: https://github.com/Microsoft/vscode-MDTools
[5]: https://code.visualstudio.com/docs/extensionAPI/overview
[6]: https://unsplash.com/@dcanies
[7]: https://unsplash.com
Have any tips to transition to a software developer? 
Tags: junior, advice, career
Published: 2018-08-13 09:44:22

---
title: Have any tips to transition to a software developer? 
published: true
description: 
tags: #junior,#advice,#career
---
I'm a college grad with a bachelor's degree in software development, but have not been able to land a job since 2016. I applied to a few companies only to get an email reply that the company has decided to pursue other candidates or that I do not have the skills they are looking for in the position. I get on average about 3-4 emails a day with job opportunities, however, most of them are for senior positions. I consider myself at the junior level never having held a professional software development job before. I feel that rejection is a part of trying to get on with a company and that I have not applied to enough places. But after having been turned down quite a few times, I eventually had to resort to a job outside of that field so that I can still afford to pay bills and take care of myself.
How to use square‘s picasso library with firebase storage
Tags: android, java, picasso, firebase
Published: 2018-08-13 08:34:01

---
title: How to use square‘s picasso library with firebase storage
published: true
description: 
tags: android, java, picasso, firebase
---
Recently i was migrating an app’s backend from parse to firebase. The move to firebase’s real-time database was a breeze with minor re-factoring. I hit a block when i wanted to load images stored in firebase storage into an android Imageview. The existing code had used the excellent picasso from square for image caching and the likes. Earlier i had stored the images as blobs inside my parse database. Firebase storage has image location coming in this format. gs://appname.appspot.com/Images/1.jpg.

One option was to load the image location (http based)inside a field in the real time database and access it using picasso. This particular app had lot of images and i didn’t want to go that route. Reading through picasso’s documentation i came across picasso’s request handler. https://square.github.io/picasso/2.x/picasso/com/squareup/picasso/RequestHandler.html.

Actually the implementation was easy to code and simple enough. Below is the gist
{% gist https://gist.github.com/premithk/7311a47e9ee848829ad86595c39878a0#file-firebaserequesthandler-java %}

The changes while actual loading is that you need to create a picasso instance using the builder while passing our custom request handler. Eg:

```picassoInstance= new  Picasso.Builder(this.activityContext.getApplicationContext())
.addRequestHandler(new FireBaseRequestHandler())
.build();```

Then to load image into the imageview

`picassoInstance.load(<firebasestorageurl>)
.into(imageview);`
I just published my first Vim plugin, import-js-from-history
Tags: vim, plugin, showdev, javascript
Published: 2018-08-13 07:17:41

---
title: I just published my first Vim plugin, import-js-from-history
published: true
description: 
tags: vim, plugin, showdev, javascript
---

I am Vim lover, but I have never created nor published my Vim plugin.

This time I created my first plugin, `import-js-from-history`.

https://github.com/acro5piano/import-js-from-history

# What is `import-js-from-history`

![image](https://thepracticaldev.s3.amazonaws.com/i/8xk0fj59psegudks5mq1.gif)

`import-js-from-history` helps write JS & TS `import` statement.
It reads `import` statement in all of git files, and suggest `import` statement.

# Why

I have been tired to write `import` statement at the top of file. I have been repeated writing `import React from 'react'` again and again.

When I used Visual Studio Code (VSCode), I was surprised that it can suggest `import` when I type package name to be imported.

After going back to Vim (technically Neovim), I missed the feature. So I created the Vim plugin.

You might wonder why I don't use VScode.

Actually, I attempted to switch to VSCode. I installed major VSCode extensions, including `Visual Studio Vim`. However, I couldn't accept some small different from Vim, such as I cannot use `zz` in file explore.

# Why not use other plugins

I know there are some Vim plugins to import js programmatically, but all of plugins I tried does not work well. 
So I created this solution, as well as my Vim training.