teleren/devto huggingface dataset:
How often do you do informal retrospectives?
Tags: discuss
Published: 2019-12-29 23:02:57

Recently I've been doing informal retrospectives at the end of each 'development' session. (Just keeping the notes in Google docs for now)

Usually it's just writing down what I've done, what I'd like to do next and the things I hacked and need to fix. (or reminders to do something that I've been meaning to do for a while)

Does any one do anything similar? Or maybe with a different format?
Playsome: playlist democracy
Tags: showdev, spotify, pwa
Published: 2019-12-29 22:18:06

Do your friends fight about the playlist at parties?

I've made Playsome, an app that fixes the music anarchy. Playsome lets everyone create their own playlist and then merges them to one playlist, where every participant gets one track at a time in an equal and democratic manner.

Guests don't need Spotify, only the host. Playsome is a progressive web app, so no one needs to download and install an app. Just go to playsome.net or share a party address from the app. It also supports Spotify Connect and various ways of keeping that one guy playing 30 minute mixes of Darude's Sandstorm over and over.

Feel free to try it out and send me ideas, criticism or questions about how I've made it. The app is just out of beta and has almost all basic functionality. More is on the way.

https://playsome.net

![Playsome playlist democracy](https://i.imgur.com/d7BdAZH.jpg)
F# Tip 2: Use the pipe operator
Tags: fsharp, functional, design, dotnet
Published: 2019-12-29 22:15:53

F#'s pipe operator `|>` lets you chain function calls together easily:

```fsharp
let car =
    Car.create Red
        |> Car.drive 10000
        |> Car.paint White
```

This creates a red car, drives it 10000 miles, and then paints it white. If you're familiar with "fluent" coding in C#, you'll see a strong similarity:

```csharp
// C#
var car =
    new Car(Color.Red)
        .Drive(10000)
        .Paint(Color.White);
```

Note that the pipe operator leverages partial function application. For example, the `Car.drive` function takes two arguments:

```fsharp
let drive miles car =
    { car with Mileage = car.Mileage + miles }
```

When we call it using the pipe operator, we specify all the arguments except the last one, and then invoke the resulting "curried" function with the pipe operator:

```fsharp
car |> Car.drive 50
```

When designing an F# API, it's important to put the "primary" argument last in the function signatures. For example, we collect all `Car`-oriented functions in a `Car` module, and list the `car` argument last in each one:

```fsharp
module Car =

    let create color =
        { Mileage = 0; Color = color }

    let drive miles car =
        { car with Mileage = car.Mileage + miles }

    let paint color car =
        { car with Color = color }
```
Beginner Git Essentials
Tags: beginners, git, tutorial
Published: 2019-12-29 21:05:11

This video is first published on [YouTube](https://youtu.be/mUT1hax4g7w)
Please [subscribe](https://www.youtube.com/channel/UCBRX8VfhAp7FJ_13uzpI_pQ?sub_confirmation=1) to my channel for tutorials
In this video, we will be looking into 20 git essential commands.

{% youtube mUT1hax4g7w %}
Hexadecimal addition in a MAC address context
Tags: javascript
Published: 2019-12-29 17:56:19

---
title: Hexadecimal addition in a MAC address context
published: true
description: 
tags: Javascript
---

I don't answer a lot of StackOverflow questions any more, they are mostly so specialized, or when they are something I can answer a lot of the time while I'm composing my answer, two or three new answers are posted all similar to my intended answer.  On the other hand sometimes when I truly do want to answer I cannot do so at that very moment, for I'm at work, or, as was the case last night, was out with my wife for the evening with only my tablet which IMO is hardly sufficient for writing a properly tested SO answer with, though your experience may be different.

In any case, I often mark such questions as favorites and then review later at a more convenient time, which is what I did with last night's.  I won't go into the details here, it's all in the StackOverflow post, so the link follows.  My answer doesn't do a *lot* that's different from the others though, biased as I am, I like to think of it as a clean synthesis of those ideas that uses some more modern Javascript techniques than the others.

https://stackoverflow.com/questions/59515305/incrementing-hexadecimal-string-from-mac-address/59521438#59521438

Actually for the sake of being more complete and not forcing readers to follow the above link, here's my code, though you may still need to refer to the question for the requirements.

    const macAddrs = [
      '84:1D:A2:B9:A3:D0',
      '84:1D:A2:B9:A3:99',
      '84:1D:A2:B9:A3:AF',
      '84:1D:A2:B9:A3:FF'
    ];
    
    const addrsIncr = macAddrs.map(addr => {
      let addrPrefix = addr.slice(0, 15); // everything up to and including last colon
      let modulusIncrLastOctet = (parseInt(addr.slice(15), 16) + 1) % 256; // converts FF to 01
      return addrPrefix + modulusIncrLastOctet.toString(16).padStart(2, 0).toUpperCase();
    });
Dotfile management on Linux with Git
Tags: productivity, workflow, git
Published: 2019-12-29 20:25:52

---
series: How I Manage My Dotfiles Cross Platform
title: Dotfile management on Linux with Git
published: true
description: Part 2 outlines the porting of my dotfiles from the initial Mac OS set up in part 1 over to Windows Subsystem for Linux (WSL).
tags: productivity, workflow, git
cover_image: https://thepracticaldev.s3.amazonaws.com/i/rk5nnpz79exzvdyodfx9.jpg
---

So, now that I've got my initial dotfiles sync setup done on Mac, it's time to try porting it over to WSL! You might notice this is a super short snippet of a post, which in this case is a good thing. Homebrew is able to run on linux, so I just needed to follow these instructions to get it running. Since I also wanted to use my same set of dotfiles cross platform, I did need to make a few small changes to those.

First, in my `.zshrc` I needed to alias brew to the linux install when the operating system is linux. I added the lines below to achieve this.

```bash
if [[ $OSTYPE == "gnu-linux" ]]; then
        eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
fi
```

Other than that I did need to update a few aliases to no longer reference file paths specifically and instead use `$HOME` which, since we're on linux, works well enough.

What about files that are for Mac specific apps? I mentioned using iTerm scripting in my first post, and I do version control those scripts. How should I ignore them on platforms that don't need to be concerned with them?

For these files I ran  git `update-index --assume-unchanged` and then deleted the local file. This is pretty manual still, but there are very few incompatible files that I needed to run it for. I’ll probably try to automate things a bit more in the next part when we move to Windows!
Why You Should Make Your Own Create React App Template
Tags: react, webdev, productivity, bash
Published: 2019-12-29 20:09:19

## Because it's cool!

If React is the main tool you use to express your passion, you should create your own create react app template. Not because it's cool (BECAUSE IT IS!), but for reasons much deeper then that. 

### It will make starting up projects a much more DRY experience.

Don't repeat yourself. Aren't your tiered of setting up the same dependencies over and over? Tired of deleting the exact same files, again and again. Stop repeating yourself today and make your own react app template!

### It will save you a TON of time!

Imagine how long it takes to set up all that boiler plate just so you can finally start working on your project. Just cut that time out by making your own react app template. Make create react app work for you! Not the other way around. How do you wish it was set up? Would you like to have Material UI already set up? How about having redux and middle-ware set up and hooked up already? Pre-setup react router? I think, YES!

### But, how???

At this point, you might be saying to yourself, "Well, Jimmy. Creating your own react app template seems nice and all. But, how do I do it? Seem's easier said then done."

#### Surprise, surprise!

Setting up your own create react app template is easier than you think! [I wrote a blog about how to do it from scratch, here!](https://dev.to/jimmymcbride/create-your-own-react-template-49p7) I had trouble finding resources when I did it, so I documented my process so that anybody who knows how to use create react app and has an email verified npm account can make their own template. For personal use, or for use in team environments. Creating your own react app template will pay you back in dividends.

### But don't stop there!

Why not take it to the next level and write your own bash script! How would you like to type in a command like; `create app-name` and have it create a react app with your custom template, change into the project directory, open the project in your favorite text editor, and spin up the server on local host, all in one easy command! Sounds pretty cool right?

### Do you want to be more DRY as a human?

[Check out my custom react app template bash script here!](https://dev.to/jimmymcbride/create-react-app-bash-script-update-49da) Just like creating your own react app template, it's easier than it might seem! If you want to learn the basics of creating bash scripts, [check out my blog on How To Write A Bash Script 101](https://dev.to/jimmymcbride/write-a-bash-script-101-4n2p). To take a deeper look into bash scripts, you can also [check out my Bash Script Tool Kit, blog.](https://dev.to/jimmymcbride/bash-script-tool-kit-56i7)
3 Ways I Improved My Remote Work
Tags: productivity, remote, life, advice
Published: 2019-12-29 20:06:25

### Boost your productivity and balance with 3 simple things

_This post was originally posted on my personal blog at [jwbaldwin.com](jwbaldwin.com)_

Remote work is awesome. Remote work is growing. Remote work is deceptively tough. At first it seems like the dream, but it can be a lot harder than it first appears if you don't take it seriously.

##1. Transition In/Out of Work

One thing that makes remote work tough, mentally, is that there is no physical transition period. There is no commute where you get ready for work, or get ready to be home and spend time with your family. 
Remote makes it easier and easier to blur the work/life lines, and soon enough you start bringing work with you wherever you go. Here's the fix: *don't remove the commute, change it.*

Instead of a 30 minute drive, setup a routine of doing something (gym, coffee + book, meditate, etc.) before hitting the day's work. Turn what was your unproductive commute time, into a productive slice of time where you transition from home to work and back. Even if that means commuting to your favorite coffee shop for an hour of emails. This breaks the day into specific chunks and turns a blurry, unhealthy mix of work + life, into a clear time for work and home.

##2. Take Breaks

This one is simple. Breaks are necessary - but when you're working from home it's easy to just grind for hours and hours - after all, there's no one there to interrupt you!

Taking breaks lets you organize your mind, and improve your mental health.

Here are some things I do for breaks:
1. 5 minute walk with my dog
2. Make a snack
3. Do 10 minutes of an exercise
4. Read some articles
5. GET COFFEE :) (I do this a lot)

##3. Make Time for Focus

The biggest boon for me when I work from home, is the amount of focused time I can create. So when you have that one task that needs your attention - plan your breaks and your work day around this. Schedule your meetings on either end of this block of time.

Set time aside so that you can enter flow.

Remove distractions. Disable notifications. Take the dog out to pee. Then get to it!

##Conclusion

There are tons of little hack and tricks that help boost your remote work life. Hopefully these ideas, fresh or just reiterated, can allow you to lead a more balanced and productive work day!

Thanks for reading :) Catch me on twitter [@jwbaldwin_](https://twitter.com/jwbaldwin_)
Currying in JS 🤠
Tags: javascript, todayilearned
Published: 2019-12-29 20:02:17

# Cooking with javascript? What? 🤷‍♂️
![](https://media0.giphy.com/media/QE8hREXIgRXeo/giphy.gif?cid=790b76117d4bd74b58d4a4526cf883d61b9965bdb65509f6&rid=giphy.gif)
Currying is a technique, where a function takes several parameters as input and returns a function with exactly one parameter.

Currying is a fundamental tool in functional programming, a programming pattern that tries to minimize the number of changes to a program’s state (known as side effects) by using immutable data and pure (no side effects) functions.

##### Now, let's cut to the chase. Check this code example:

```javascript
const isDivisible = (divider, number) => !(number % divider);
const divider = 2;

console.log(isDivisible(divider, 40)); // true
console.log(isDivisible(divider, 33)); // false
```

In the previous code, `isDivisible` is a function expression that checks whether one number is divisible by another, returning **true** or **false**, as simple as that.


##### If my intention in the three `isDivisible` calls is to use the same divisor, isn't it tedious and tedious having to pass the divisor as a parameter every time I want to know if a number is divisible by two?


Just changing the `isDivisible` function and making the divisor a fixed value. 
But we would have a **gigantic coupling impacting a non-reusable and fully cast function**

And now is the time for our game star to step in

![](https://media2.giphy.com/media/1rRkosgBYUL018uCOb/giphy.gif?cid=790b7611a063840685b7557ef6f87a7bc24fbcc5ef1bc77c&rid=giphy.gif)

## Currying 🤓

```javascript
const isDivisible = divider => number => !(number % divider);

console.log(isDivisible(2)(40)); // true
console.log(isDivisible(2)(33)); // false
console.log(isDivisible(3)(40)); // false
console.log(isDivisible(3)(33)); // true
```

![](https://media2.giphy.com/media/YCM6aRw2Chenu/giphy.gif?cid=790b761170f70a1a71877f744c75be008b8121d982e0b720&rid=giphy.gif)
Therefore now we have a decoupled and flexible function, not only dependent on number two and can be used in any situation we want to know if a number is divisible or not 🧐


🍻
How to design a Real-Time Typing feature with Jquery
Tags: jquery, realtime, typing, reactorjs
Published: 2019-12-29 19:42:54

<h1>What is Real-Time typing?</h1>
<p>Real time typing is inputting text in an html input field and seeing the output printed inside another element anywhere on our page, all in real time.
This can be useful for social media sites or blogs/articles sites where a user types text and seeing its output in real time. Other common applications for real time typing could be chat and messaging apps.

Now that we understand the idea, let's delve into the code.
Since we will code this in jquery we need to insert the jquery library script inside our head tag: https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js

Then we can write our jquery code. Let's create a new file called index.js


<strong>index.js:</strong>

```javascript
function liveWrite() {
    var name; 
    var read = $('[re-read]');
    var write = $('[re-write]');    
    read.on('input', function() {
        name = $(this).val();         
        write.html(name);    
    });
}
liveWrite();
```

<strong>Explanation:</strong>
<p>On the first line let's declare a name variable.
Next, e have a variable called read, which is instantiated from the html element with attribute "re-read".
Then another variable called write, which has the same concept as read.
The last line of code enables us to detect input on our "read" html element in real time. We then  pull the value (or text in this case) within our read variable and assign it to our first variable called name. We then insert that variable inside the html element "write", where it will consequently be outputted, also in real time.

<p>Now we will implement our jquery code with some html.
We'll create very simple input and an output html elements for this demo.

We can have a textarea element as input and assign it the attribute "re-read".
Then we can have an h2 tag as our output element and assign it the attribute "re-write".

And voila.
As we type inside our textarea, the output will be reflected in real time inside our h2 element. We can then style that h2 element of course, like we want.

<strong>HTML Designing With Reactor's Live Writer</strong>
Reactor's Live Writer also allows us to simulate a html markup design. This means that we can design an html page using the live writer.
All we need to do is change out output element from h2 to a div, give it a class name so we can style markup inside of it and write our html within this div.
Jquery also helps to make styling of elements apply in real time when we define styles in the style tag (in head section of html document).
Of course, javascript and jquery are also possible to add in our simulated html document.

The possibilities are endless.  

<strong>Check out the demo in my website:</strong>
http://reactor-js.com/advanced.html#sticky3

Thanks for reading and enjoy!

Webstite: https://scorpionedge.com
Email: info@scorpionedge.com

If you would like to discover more about Reactor JS, check it out here: http://reactor-js.com
Python: Specify Python versions with virtualenvwrapper
Tags: python, virtualenv, virtualenvwrapper, learning
Published: 2019-12-29 19:16:27

---
Description: How to specify a Python version with virtualenvwrapper
---


If you're using `virtualenvwrapper` to manage your Python environments, it's easy to create environments that use specific versions of Python.

First, [download the version of Python](https://www.python.org/downloads/) you need. On a Mac, the Python installer defaults to installing Python versions in the `/usr/local/bin/` directory.

Then, use this command when creating a new environment:
```
$ mkvirtualenv -p [path/to/python/version] [name-of-environment]
```

The `-p` flag allows us to specify what version of Python we would like to use. For example, if we want to create an environment called `polls-tutorial` using Python 3.6.x, we would do so like this:
```
$ mkvirtualenv -p /usr/local/bin/python3.6 polls-tutorial
```

NOTE: The Python installer does not overwrite major versions — we can have 3.6.x and 3.7.x installed and use them in different environments. However! The installer [_does_ overwrite minor versions](https://stackoverflow.com/a/4583421). So, if we have environments using Python 3.7.4 and then we install 3.7.6, any environments that were using 3.7.4 will now use 3.7.6.
Inner Peace Blockstack App -
Tags: startup, mentalhealth, android, womenintech
Published: 2019-12-29 19:12:23


Inner Peace app is a gratitude journal built on blockstack platform that allows user to own their data. It encourages the users to express gratitude about various things in their lives and stores it in Gaia storage developed by Blockstack. 

Its basic version doesn't have much innovative features that other gratitude journals from the centralized platforms enjoy, but Inner Peace app certainly promises foolproof security and much needed privacy to the users with respect to their data. 

You can know more about Inner Peace app by visiting https://theinnerpeace.me/
React Form Submission Handling - anyone got advice?
Tags: react, help
Published: 2019-12-29 18:55:13

<p>I keep finding myself rewritting the same ol' submission logic for each form, with slight changes depending on the contents - however, each time, I write my logic into a separate script that looks really similar to the previous. Something along these lines:</p>
<ul>
 <li>Disable the submission button  </li>
  <li>Check and validate all the inputs </li>
  <li>Dispatch a post request </li>
  <li>Display the server errors if there was mistake,otherwise  redirect/create a notification  </li>
</ul>
<p>Anyone able to help me out by sharing their solutions? Form submission patterns or frameworks to help me keep this a bit more dry are much appreciated 😄</p>
Algorithms in Go: Insertion Sort
Tags: go, algorithms, insertion, sort
Published: 2019-12-29 18:34:20

---
title: Algorithms in Go: Insertion Sort
published: true
description: An implementations of the Insertion Sort algorithm
tags: go, algorithms, insertion, sort
cover_image: https://thepracticaldev.s3.amazonaws.com/i/xcg9meq20q2w9n7ylsyt.jpg
canonical_url: https://fodor.org/blog/go-insertion-sort/
series: Algorithms in Go
---

# Introduction
One of the most basic sorting algorithms is the **insertion sort**. It is also relatively easy to understand as it closely mimics a common sorting strategy that humans normally use when sorting playing cards in their hand.
Even though its time complexity is O(n<sup>2</sup>) for the worst case, it still performs well for small input sizes.
Below is an illustration of the steps taken to perform a insertion sort:
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/p0vgnuh6wbiv6g0mzpjn.jpg)

# Implementation

The main two parts of the code below are the two `for` loops. In the first one, we go through every element of the initial slice, starting with the second (see (a) above) and we compare it iteratively backwards with the previous elements. Whenever the previous element is greater than the current one, we move it one position forward. Once the inner loop reaches the condition to stop, we assign the value of the current element to precede the last element that was moved forward. By doing this, we end up with a sorted slice.

```go
func Sort(a []int) []int {
	// creating a new slice of a size equal to the original
	result := make([]int, len(a))
	// copying elements from the original slice to the new slice
	copy(result, a)
	// iterating through all elements of the slice starting with the second
	for i := 1; i < len(result); i++ {
		// key holds the current value 
		key := result[i]
		// j holds the index of the previous value
		j := i - 1
		// we iterate backwards starting with the previous value and compare it with the current value
		for j >= 0 && result[j] > key {
			// if the previous value is greater then we move it forward one position
			result[j+1] = result[j]
			// we decrement the index for the previous value so that we check the next value backwards
			j--
		}
		// at the end of the inner loop we want to potentially move the current value of the main loop to a new position (if anything was shifted above)
		result[j+1] = key
	}
	// returning the sorted slice
	return result
}
```

# Go specific decisions
As Go does not make a copy of the slice after it has been passed into a function, we had to make sure that we are no mutating the underlying array of the original slice and therefore had to create a new slice of the size of the original and copy into it the numbers.

# Source code
{% github github.com/dorin131/go-algorithms no-readme %}

Please feel free to make PRs with improvements

More algorithms are coming soon!

# Video
{% youtube w3J_9rN4H78 %}