teleren/devto huggingface dataset:
Killing Procrastination
Tags: generalprogramming, management, projectmanagement, life
Published: 2021-06-17 08:28:52

---
title: Killing Procrastination
published: true
date: 2018-05-20 18:05:33 UTC
tags: GeneralProgramming,management,projectmanagement,life
canonical_url: https://hackberry.xyz/killing-procrastination
---

I am such a procrastinator that I often end up having multiple plans, todo lists and projects. I have used almost all to-do lists available on play store, maintained todo lists on a notebook, and even meditated to stay focused. I have read a lot of projects finding the reason for procrastination. But still, I don’t have any clue why I leave the projects in between. So today, I am trying to note down all my findings and reasonings. Maybe that will connect the dots and help me find the reasons for procrastination.

## Multitasking

![](https://media.giphy.com/media/3oriO7A7bt1wsEP4cw/giphy.gif)

I handle way too much work in a short time. Being at home and having no client work, I often end up doing chores, planning new projects and finding more clients. I also maintain two companies, (xPress Web Solutions and ikoumerce) with my friends and planning another one with two other friends as well. The problem starts when I have to work on all websites and do chores on the same day. I cannot do everything in such a short time. I usually do the chores first and then work for the companies. My own projects die well.

## Losing the track

![](https://media.giphy.com/media/ZjLABk52vHYmA/giphy.gif)

Another main reason for procrastination is maybe losing my flow. Needy friends and acquaintances, business and family often stop me from staying in a flow. Calling me every time I try to stay focused, they obstruct my workflow. To overcome this, I have stopped picking up the phone calls these days. Maybe that will help me out.

## Lack of knowledge

![](https://media.giphy.com/media/TI32JwHmWQEi4/giphy.gif)

Sometimes, it is not the others but I. Big projects often ask for more than I know. Due to lack of knowledge, I stop the project and start studying. Maybe this is a good thing? I don’t know but it does obstruct the project.

## Code changes

![](https://media.giphy.com/media/ukMiDlCmdv2og/giphy.gif)

When things are out of hand and I don’t have much knowledge, I take help of my brother. It is good for short projects but in last android project, it came out disastrous. I could not understand the changes and actions he took. To understand it, I have to read the whole code again or maybe revert to the last commit and start again.

## Losing interest

![](https://media.giphy.com/media/l4FGGTztu9zLHe31m/giphy.gif)

It is happening. I am being forced by the current issues of life to lose interest in programming. The financial problem at its extreme is asking me to stop focusing on next 5 years and start looking for tomorrow. Obviously, I have to leave the long-term projects today and start working on short profitable projects.
How do you help yourself fix bugs?
Tags: discuss
Published: 2018-05-20 16:20:18

---
title: How do you help yourself fix bugs?
published: true
description: Bugs, bugs, bugs and more bugs
tags: #Discuss
---

Bugs, bugs, bugs...and more bugs. Probably one of the most annoying parts of development in general is having a bug that is causing a lot if not the entire thing to malfunction. Sometimes its the simple things, like a missing comma or semicolon. Others its the more major things where you just have no idea why it's broken.

# How do you help yourself fix them?

Personally I like to step away from my machine and desk, either grab something to drink, eat, and the occasional scream outside in my back garden. As well as taking long (very long) stress walks to help clear my mind, I often find that half way through a track I'll come up with the solution in my head.

So, what do you do?
Simplest way to deploy a Flask app
Tags: help, flask, python
Published: 2018-05-20 11:22:47

---
title: Simplest way to deploy a Flask app
published: true
description: how to deploy a Flask app and its DB
tags: help, Flask, python
---
Hi !

I wrote a simple Flask app using flask and sqlalchemy which run pretty well on localhost but I would like to deploy it. The problem is that I don't have any clue on how to deploy it..

Could somebody explain me the simplest way to deploy my Flask app?

Thanks !

**EDIT**
I'm on Windows
My Development Setup
Tags: development, setup, tools
Published: 2018-05-20 10:49:32

---
title: My Development Setup
published: true
description: 
tags: development, setup, tools
---

In the past, I stumbled upon many interesting tools by investigating the development setups of other developers. Therefore, I thought I could also present you my setup.

I change up things sometimes, so this page will serve as a living document and a place to point curious developers to when I get asked.

# Editor + Terminal

* [Visual Studio Code](https://code.visualstudio.com/) as editor
* [Hyper](https://hyper.is/) as terminal including [Oh My Zsh](https://github.com/robbyrussell/oh-my-zsh) with [avit theme](https://github.com/robbyrussell/oh-my-zsh/wiki/themes#avit) and [Roboto Mono for Powerline](https://github.com/powerline/fonts) as font

# Desktop Apps

* [Firefox](https://www.mozilla.org/en-US/firefox/) as my main browser
* [Boostnote](https://boostnote.io) as my note-taking app. It is focused on markdown, snippets, and customization.
* [Trello](https://trello.com/) as my project management tool
* [Any.do](https://web.any.do/) to manage my tasks across devices
* [Enpass](https://enpass.io/) for password management
* [Franz](https://meetfranz.com/) as messaging app
* [Spotify](https://www.spotify.com/) for music streaming

# Notebook

I am using a MacBook Pro (Retina, 13-inch, Early 2015) for development and a custom-built desktop PC for gaming.
Geo Share
Tags: pushercontest
Published: 2018-05-16 14:36:24

---
title: Geo Share
published: true
description: A Geo Location PWA based on the Pusher Channels real-time API. 
tags: pushercontest
---

![map demo](https://thepracticaldev.s3.amazonaws.com/i/m1obqrp7ieb06c725f2k.png)

# What I built

Imagine you'd like to meet up with your friends, but you are in an open and maybe crowded space, so that beside sharing your own location, you'd love to also see where is everyone else, to eventually converge into a single place on a map without needing to install any native app.

This is Geo Share, a PWA where you can either be the host, or simply a guest of any other person that shared a unique URL with you.

## Demo Link

You can become a host simply visiting [geoshare.now.sh](https://geoshare.now.sh/).

Once you've found yourself on the map, and clicked on top right 👥 icon, you'll have in your device clipboard a unique URL you can paste to your friends.

That's it, anyone using that link will see everyone else aware of such link and, as long as you are using the app, also see you as host of the group (dark icon).

## Link to Code

https://github.com/WebReflection/geoshare

# How I built it

  * [Zeit now-cli](https://zeit.co/now) for the easiest deployment ever!
  * [Leaflet](https://leafletjs.com) library for the map on top of [OpenStreetmap](https://www.openstreetmap.org/) tiles
  * [Nominatim](https://nominatim.openstreetmap.org) for reverse geocoding on longpress (to share a tooltip from the host)
  * [Pusher Channels API](https://pusher.com/channels?utm_source=dev.to&utm_medium=referral&utm_campaign=Devtocontest) for real-time updates and communications
  * [NoSleep](https://github.com/richtr/NoSleep.js?utm_source=recordnotfound.com#nosleepjs) utility to (hopefully) prevent device from sleeping
  * [hyperHTML](https://github.com/WebReflection/hyperHTML#hyperhtml) for layout render and updates
  * [lightdown](https://github.com/WebReflection/lightdown#lightdown) to bring a fast, safe, and useful Markdown flavour to each message

# Additional Resources/Info 

The rest of the code is written by me and based on [ES Modules](https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/), bundled through [asbundle](https://github.com/WebReflection/asbundle#asbundle), sanitized via [Babel](https://babeljs.io), and minified via [UglifyJS](https://github.com/mishoo/UglifyJS#uglifyjs--a-javascript-parsercompressorbeautifier).

Common PWA techniques such [ServiceWorker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) and a `manifest.json` are in place too.
My First NPM Package: github-traffic-cli
Tags: npm, github, traffic, cli
Published: 2018-05-20 10:44:48

---
title: My First NPM Package: github-traffic-cli
published: true
description: My little journey developing my first npm package
tags: npm, github, traffic, cli
---

Since I published my first projects on [GitHub](https://github.com/Mokkapps) I really enjoyed viewing the traffic on my repositories. It is really interesting to see how many people visit or clone my repositories.

Unfortunately it costs a lot of time to click through all available repositories and I was looking for a more elegant way.

I stumpled upon the npm package [github-traffic](https://www.npmjs.com/package/github-traffic) which already provides an API to fetch the GitHub traffic. So I decided to write a command line interface (CLI) npm package which uses this API.

As a result I can check the traffic on all of my repositories with one CLI command:

!["github-traffic-cli" Screenshot](https://www.mokkapps.de/blog/img/github-traffic-cli.png)

# Develop & publish npm package

The process is very easy and documented in the [npm docs](https://docs.npmjs.com/getting-started/publishing-npm-packages).

# Used npm packages

* [chalk](https://www.npmjs.com/package/chalk): Terminal string styling done right
* [clui](https://www.npmjs.com/package/clui): Node.js toolkit for quickly building nice looking command line interfaces
* [commander](https://www.npmjs.com/package/commander): The complete solution for node.js command-line interfaces
* [figlet](https://www.npmjs.com/package/figlet): Terminal ASCII art from text
* [inquirer](https://www.npmjs.com/package/inquirer): A collection of common interactive command line user interfaces.

# Links

* [github-traffic-cli](https://www.npmjs.com/package/github-traffic-cli)
* [Source Code](https://github.com/Mokkapps/github-traffic-cli)
There's no "else if" in JS 
Tags: javascript, think, conditional
Published: 2018-05-20 10:12:21

---
title: There's no "else if" in JS 
published: true
description: think about It...
tags: javascript, think, conditional
cover_image: https://proxy.duckduckgo.com/iu/?u=https%3A%2F%2Fwww.ibm.com%2Fevents%2Fthink%2Fimages%2FLeadspace_static.png&f=1
---

#Grammar is not a joke...

Exactly, in Javascript's grammar **there's no** `else if` statement.

How many times have you used it before? **Why It's still working?**

We always code like this:

```js

function wow(arg){
  
  if(arg === "dog"){
  	return "LOVELY";
  }
  else if(arg === "cat"){
    return "CUTE";
  }
  else return "gimme an animal";
}

wow("cat");
//-> "CUTE"

```

But what's really happening is this:

```js

function wow(arg){
  
  if(arg === "dog"){
  	return "LOVELY";
  }
  else {
    if(arg === "cat"){
    	return "CUTE";
  	}
    else return "gimme an animal";
  }
}

wow("cat");

```
What's happening here?

Literally, we're using some implicit JS behavior about `{}` uses.

When we use the `else if` statement we're omitting the `{}` but Javascript It's still working because It does not requires the parentheses in that case, like in many other cases!

##...so what?

I'm not writing this post, just because It's something **really curious** to know.

I'm writing this to make you think about all the _good parts_ or _right ways_ to code, that forces you to write code in a way, that sometimes It's not really the **best way**.

There's a lot to discuss about _implicit_ and _explicit_ declaration of stuff like: coercion, parentheses, semicolon...

But the true always stands in the middle!.

If you just follow some specific rules on _how to..._ you're not understanding **why** those _rules_ were written, and this `else if` should make you think about It.

How many time have you written code, because someone told you _to do so_ but you were totally blind about It?

I bet, **a lot**.

I'm not saying that we should not care about **ALL** those rules, and that we should know **ALL** the JS documentation.

I'm just saying that right now, your duty is to write **good code that can be understood by someone else** and to go that way... _some_ rules are ok, but you should know **the why**.

Because someone is good at code, It does not mean that you **have to** follow his _golden rules_.

What's _implicit_ for him, maybe _explicit_ for you and many other people. 

If you don't have the same knowledge, about that specific argument (and It's not possible to have exactly the same level of _know about It_ in every single part of the code) you've two options:

1. Do what he's telling you to do... If It works.
2. Go out and check **the why**

Always care about _the good parts_ but first of all, always care about _your knowledge_ and don't code just by rules.

<center>Best-practices must be accepted by many people</center>
<center>![think](https://media.giphy.com/media/GD99jGJdGxgTS/giphy.gif)</center>
How does Laravel make methods available?
Tags: laravel, php, question
Published: 2018-05-20 08:38:36

---
title: How does Laravel make methods available?
published: true
description: 
tags: laravel, php, question
---

I'm relatively new to laravel and I have found that you have access to certain methods in the controllers e.g. `response()`, `auth()`, `view()` etc. I'd like to know how it does that.

Thanks
Why front end projects use template engines?
Tags: discuss, webdev, javascript
Published: 2018-05-20 08:17:20

---
title: Why front end projects use template engines? 
published: true
description: Discussion template engines used in front end projects. 
tags: #discuss #webdev #javascript
---

Why front end developers make use of the template engine? What's the benefit of using them? And also one more question, does every project needs to be done with template engine? Or projects that scale needs to use template engine?
ActionChat to start your day off right!
Tags: pushercontest, reactnative, react, javascript
Published: 2018-05-20 06:48:45

---
title: ActionChat to start your day off right!
published: true
description: A mobile app that fosters motivational conversations to help people take action for a productive day. An entry to #pushercontest.
tags: pushercontest, react-native, react, javascript
---

Announcing ActionChat, a mobile app where you are surrounded by like-minded people who inspire each other to make the most of the day!

I often hear that the key to a productive day is having a solid morning routine.  When people talk about morning routines, they usually mention exercising, a shower, meditation, a cup of coffee, and reviewing the day's tasks.  This is a great way to start the day, but many people struggle to get into their routine.  The goal of this app is to allow people to chat with each other first thing in the morning to motivate each other to take control of their day!

I think [Pusher Channels](https://pusher.com/channels) will be a great API for this app.  I've done some tutorials with Firebase in the past, but I'm always on the lookout for the best tools out there.  I'm looking forward to trying out Pusher Channels and making an awesome app! 

## Tech stack

* [Pusher Channels API](https://pusher.com/channels)
* [React-Native](https://facebook.github.io/react-native/)
* [Expo](https://expo.io/)
* [Create React Native App](https://github.com/react-community/create-react-native-app)

Stay tuned for updates!

Thanks for reading,

- Andrew
How to find nearby places using Latitude and longitude in Laravel 5
Tags: codesnippet, laravel
Published: 2020-02-14 14:38:27

---
title: How to find nearby places using Latitude and longitude in Laravel 5
published: true
date: 2018-05-19 22:23:15 UTC
tags: Code Snippet,Laravel
canonical_url: https://www.parthpatel.net/nearby-places-using-latitude-and-longitude-in-laravel-5/
---

Often, in real-estate , dating  and other similar websites, you might have noticed how they allow you to search nearby to any location. You can easily accomplish that in your laravel application using Haversine formula.

 ![nearby location in laravel](https://www.parthpatel.net/wp-content/uploads/2018/05/nearby-location-in-laravel-1024x512.png)

Source -- Tighten.co

Last year, I worked on real-estate project in my college as an capstone project and that's when I got to work on this query. Though haversine formula is easy to find but to use it in laravel through Eloquent was very difficult. I tried many solutions found in Stackoverflow, laracasts forum and other sources but couldn't make them work. Some of them did work but since they were using raw queries, I couldn't paginate the results which is what I needed.

After some trial and error, I finally make it working. So, here I am sharing the code snippet.

```
  $gr_circle_radius = 6371;
      $max_distance = 500;

      $distance_select = sprintf(
                                    "           
                                    ( %d * acos( cos( radians(%s) ) " .
                                            " * cos( radians( lat ) ) " .
                                            " * cos( radians( long ) - radians(%s) ) " .
                                            " + sin( radians(%s) ) * sin( radians( lat ) ) " .
                                        " ) " . 
                                    ")
                                     ",
                                    $gr_circle_radius,               
                                    $lat,
                                    $long,
                                    $lat
                                   );

        $properties = Property::select('*')
        ->having(DB::raw($distance_select), '<=', $max_distance)
        ->groupBy('properties.id')->paginate(1);
```

Here, I have set maximum distance = 500 Km so it will show all results within 500 Km of the given Latitude and Longitude (used $lat, $long as variables).

To see the Demo, Check out my real estate project -- [FirstFloor](http://firstfloor.parthweb.com/)

The post [How to find nearby places using Latitude and longitude in Laravel 5](https://www.parthpatel.net/nearby-places-using-latitude-and-longitude-in-laravel-5/) appeared first on [Parth Patel - a Web Developer](https://www.parthpatel.net).
The right way to implement authentication using cookies, according to you.
Tags: discuss
Published: 2018-05-20 03:52:20

---
title: The right way to implement authentication using cookies, according to you.
published: true
description: The internet is full of opinions when it comes to implementing authentication. What do you think is the right way?
tags: discuss
---

The internet is full of opinions when it comes to implementing authentication and the use of sessions/cookies. We all agree that storing passwords in cookies or setting a value like _admin = true_ is a very bad idea. We also have to deal with the prevention of XSS cookie stealing. (appending _document.cookie_ to an _&lt;IMG&gt;_ element _src_ attribute or whatever)
In many cases we also want to prevent that a 'saved' cookie will successfully authenticate a different client or device when copied.

In your experience, what is the right way to handle authentication? In PHP, JavaScript or whatever language / framework you happen to prefer?
Back to static
Tags: eleventy, static, indieweb
Published: 2018-05-14 15:16:58

---
title: Back to static
published: true
description: Towards the beginning of the year I had migrated my personal site setup from Jekyll over to Craft CMS.
tags: eleventy, static, indie-web
---
Towards the beginning of the year I had migrated my personal site setup from Jekyll over to Craft CMS.

Around that time I was interested in improving my Craft CMS development skills, so it made sense to use my website as a playground to learn.

Since then, I have learned a lot and made a few [screencasts](https://www.youtube.com/watch?v=VSXglzqJ2Z4&list=PLmv4wIIvTDgGX6bpR3cdVddTDTR8DbDmO) along the way. That time spent learning and experimenting has had a big influence on how I approach new Craft CMS builds these days, success!

Lately I have been feeling the itch to get back to something simpler and lighter. I had seen Zach Leatherman had released [Eleventy](https://github.com/11ty/eleventy) recently, which is an alternative to Jekyll built on Javascript.

After roughly a week of setup, design/development and content migration, I have a new site setup. I really like the flexibity <abbr title="Eleventy">11ty</abbr> offers in comparision to my previous Jekyll build. <abbr title="Eleventy">11ty</abbr> manages my content and templates and I bring my own styling and scripting layers.

Feel free to take a peak at the [source](https://github.com/alexcarpenter/alexcarpenter.github.io).

---

This post was originally featured on my [website](https://alexcarpenter.me/posts/2018/05/back-to-static).
Ethereum:New Solidity constructor
Tags: ethereum, solidity
Published: 2018-05-19 13:07:11

---
title: Ethereum:New Solidity constructor
published: true
description: 
tags: Ethereum, solidity
---


Since [Solidity v0.4.23](https://github.com/ethereum/solidity/releases/tag/v0.4.23), Solidity has new constructor notation.   
And The old one was deprecated.

# Old
```javascript
pragma solidity 0.4.23;

contract Foo {
  function Foo() public {
    // ...
  }
}
```



# New
```javascript
pragma solidity 0.4.23;

contract Foo {
  constructor() public {
    // ...
  }
}
```

# Note
The old one raise below.

```bash
Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
```