# How you can use data to discover the secrets of baseball

2018-02-27 00:00:00 +0000

Data can tell lots of stories, and finding the hidden secrets is like finding a needle in a haystack. After finishing my first data analysis course on Udacity, it was time for a real-world project. In this project, I’m going to explore baseball data. To be more specific: batting data for every player that played between 1871 and 2016. You can download the entire dataset here. My process:

1. Have a first look at the data
2. Come up with a question
3. Wrangle the data
4. Explore the data
5. Draw conclusions/predictions
6. Communicate my findings

My goal is to find the secrets of baseball in the data and share it with you, so that you can learn something and improve your game.

### First look at the data

The first step is to import a dataset. For the first look, I am going to display the first five entries to get an idea of what I’m dealing with.

``````import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
%matplotlib inline
filename = 'Batting.csv'
# Printing the first five entries
``````

``````# Getting some metrics on the home runs, number of games, runs batted in and the number of strikeouts
batting_df[['HR','G', 'RBI', 'SO']].describe()
``````

Looking at the table above, it seems batters hit an average of 2.8 home runs in a season with an average of 51 games.

``````batting_df_groupedby_year = batting_df.groupby(['yearID']).sum()
homeruns_per_year = batting_df_groupedby_year[['HR']]
# Plotting the heatmap in reverse order to make it easier to see the increase
sns.heatmap(homeruns_per_year.iloc[::-1])
``````

Above you can see the number of home runs increase as the years pass. On the left y-axis you can see the year, and on the right y-axis you can see the number of home runs.

### Questions

Before the data will reveal its secrets, I have to ask it a few questions. Here are some examples of questions I can ask the data:

1. Which teams have the most effective batters?
2. Is there a correlation between Strikeouts and Home Runs?
3. Who is the best stealer in history (Caught Stealing vs. Stolen Bases)?
4. Which region produces the best batters (need to merge with another table for that)?
5. What is the relationship between different performance metrics? Do any have a strong negative or positive relationship?
6. What are the characteristics of baseball players with the highest salaries?

The question I am going to focus on is: which metrics correlate and which metrics do not?

### Wrangling

``````# Displaying the batting data for the last ten years
batting_last_ten_years
``````

The dataset I am using is already very clean. I don’t have to do a lot of wrangling to get to the data I need. Above you can see batting data from the last 10 years.

### Exploring

In the next code block, I will calculate the correlations between Home runs and all the other metrics. This way we can see which metrics contribute to home runs and which metrics are bad for scoring home runs. For example, I expect batters who play more games to score more home runs. I also expect batters with a high RBI to score the most home runs. A correlation of 1 between two values is a perfect positive correlation. This means that when one of the two values increases, the other increases as well. A correlation of -1 is a negative correlation. This means that when one value increases the other decreases. As the value of a correlation goes to 0, the correlation is very small or non-existent. I will call a positive correlation ++, + or +- depending on the strength of the correlation. No correlation will be 0, and negative correlations will range from -+, — , or — — being a strong negative correlation.

``````def standardize(data):
return (data - data.mean()) / data.std(ddof=0)
def pearsons_r(x, y):
return (standardize(x) * standardize(y)).mean()
# It doesn't make sense to calculate the correlation between these values and home runs
leave_out = ['playerID', 'yearID', 'teamID', 'lgID', 'HR']
# Meaning of the column names in the data
dictionary = {'playerID':'Player', 'yearID':'Year', 'teamID':'Team', 'lgID':'League', 'HR':'Home Runs','stint':'Stints', 'G':'Games', 'AB': 'At Bats', 'R': 'Runs', 'H':'Hits', '2B':'Doubles', '3B':'Triples', 'RBI':'Runs Batted In', 'SB':'Stolen Bases', 'CS':'Caught Stealing', 'BB':'Base on Balls', 'SO':'Strikeouts', 'IBB':'Intentional Walks', 'HBP':'Hit by pitch', 'SH':'Sacrifice hits', 'SF':'Sacrifice flies', 'GIDP':'Grounded into double plays'}
strong_positive_correlation = []
strong_negative_correlation = []
def correlations_for_hr(df):
columns = list(df)
for x in columns:
if x not in leave_out:
name_of_metric = dictionary[x]
r = pearsons_r(df['HR'], df[x])

# Calculating the strenth of the correlation
correlation = ''
if r > 0.7:
correlation = '++'
strong_positive_correlation.append(name_of_metric)
elif r > 0.5:
correlation = '+ '
elif r > 0.3:
correlation = '+-'
elif r >= -0.3:
correlation = 'O '
elif r > -0.5:
correlation = '-+'
elif r > -0.7:
correlation = '- '
elif r > -1:
correlation = '--'
strong_negative_correlation.append(name_of_metric)

print('{} Correlation between Home runs and {}:{}'.format(correlation, name_of_metric, "%.3f"%r))
print('-----------------------------------------')

print('Correlations:')
print('-----------------------------------------------------')
print(correlations_for_hr(batting_df))
print('\n')
print('Positive correlations: {}'.format(strong_positive_correlation))
print('\n')
print('Negative correlations: {}'.format(strong_negative_correlation))
``````

Output:

``````Correlations:
--------------------------------------------------------------------
O  Correlation between Home runs and Stints: -0.065
--------------------------------------------------------------------
+  Correlation between Home runs and Games: 0.668
--------------------------------------------------------------------
+  Correlation between Home runs and At Bats: 0.695
--------------------------------------------------------------------
++ Correlation between Home runs and Runs: 0.729
--------------------------------------------------------------------
++ Correlation between Home runs and Hits: 0.703
--------------------------------------------------------------------
++ Correlation between Home runs and Doubles: 0.725
--------------------------------------------------------------------
+- Correlation between Home runs and Triples: 0.348
--------------------------------------------------------------------
++ Correlation between Home runs and Runs Batted In: 0.837
--------------------------------------------------------------------
O  Correlation between Home runs and Stolen Bases: 0.265
--------------------------------------------------------------------
+- Correlation between Home runs and Caught Stealing: 0.409
--------------------------------------------------------------------
++ Correlation between Home runs and Base on Balls: 0.731
--------------------------------------------------------------------
++ Correlation between Home runs and Strikeouts: 0.822
--------------------------------------------------------------------
++ Correlation between Home runs and Intentional Walks: 0.753
--------------------------------------------------------------------
+- Correlation between Home runs and Hit by pitch: 0.497
--------------------------------------------------------------------
O  Correlation between Home runs and Sacrifice hits: 0.064
--------------------------------------------------------------------
++ Correlation between Home runs and Sacrifice flies: 0.792
--------------------------------------------------------------------
++ Correlation between Home runs and Grounded into double plays: 0.767
--------------------------------------------------------------------
Positive correlations: ['Runs', 'Hits', 'Doubles', 'Runs Batted In', 'Base on Balls', 'Strikeouts', 'Intentional Walks', 'Sacrifice flies', 'Grounded into double plays']
Negative correlations: []
``````

### Reviewing first expectations

Remember my expectations? I expected the number of games and the RBI score to have a positive correlation with home runs. According to my calculations above, the number of games has a positive correlation with a Pearson’s R of .668. So players who played more games in a season have a higher number of home runs. This sounds very logical, since batters who play more games have more chances of scoring a home run. My other expectation was that a high RBI would mean a high number of home runs. The correlation between home runs and RBI is big with .837! This again is quite logical, because home runs are able to reward the player with the most RBI points. Another interesting fact is that there are no negative correlations. So, there is no metric that decreases when the number of home runs increases.

``````# HOME RUNS vs. RUNS BATTED IN
sns.lmplot(size=10, data=batting_df[['HR', 'RBI']], x='HR', y='RBI', x_estimator=np.mean)
``````

The chart above shows how home runs correlate to RBI. You can see the number of home runs of the x-axis and the number of RBI points on the y-axis.

``````# HOME RUNS vs. STRIKEOUTS
sns.lmplot(size=10, data=batting_df[['HR', 'SO']], x='HR', y='SO', x_estimator=np.mean)
``````

The plot above returns an interesting correlation. It’s the correlation between home runs and strikeouts. The Pearson’s R correlation is .822, being almost as high as the correlation between home runs and RBI. This correlation was more interesting to me because RBI’s are a direct result of home runs. Strikeouts, on the other hand, have a direct correlation to losing your chance at a home run. How on earth would strikeouts result in more home runs?

To solve this mystery, I started thinking… Maybe the batters who take more risk are more likely to score a home run. Because they swing even on balls that seem hard to hit. So, if taking more risks gives you more home runs, I took a look at risky metrics. Risky metrics are metrics that involve risk-taking, like stealing bases. Let’s have a look at the correlation.

``````# HOME RUNS vs. CAUGHT STEALING
sns.lmplot(size=10, data=batting_df[['HR', 'CS']], x='HR', y='CS', x_estimator=np.mean)hr_vs_
``````

Above you can see the correlation (.409) between home runs (x-axis) and the number of times a runner gets caught stealing (y-axis). There is a vague correlation, but it’s not enough to make a conclusion. Maybe the risk takers have gotten very good at stealing bases and don’t get caught stealing? Let’s look at stolen bases.

``````# HOME RUNS vs. STOLEN BASES
sns.lmplot(size=10, data=batting_df[['HR', 'SB']], x='HR', y='SB', x_estimator=np.mean)
``````

Above you can see the correlation of .265 between home runs (x-axis) and stolen bases (y-axis). This correlation is non-existent. So, taking risks has nothing to do with scoring a home run. The data alone is not going to reveal the secret of scoring a home run. I need to learn more about baseball to solve this mystery. My next plan of attack was watching YouTube videos to see how high scoring batters behave. As it turns out, scoring a home run has more to do with fine calculations than taking risks. I saw batters waiting for the right pitch. They’d rather get a strike, hoping the next throw will serve them batter, eh better. An added benefit is that the pitcher tires faster as he has to throw more balls.

### Conclusions/Predictions

To batters trying to improve their home run stats, I have a few suggestions. Step one in getting more home runs is: play more games, no excuses — play! Step two: get some strikeouts. It sounds counter-intuitive, but it increases your number of home runs. The way this works: it blows out the pitcher and gives the batter more time to wait for the best pitch to hit that GRAND SLAM.

Or this one about risks of a tired pitcher.

If you liked this, please send me a message via the form below and subscribe to my newsletter!

# How I built an app in a week and how you can too

2017-12-19 00:00:00 +0000

## Creating apps takes time but focus on the right parts and get the first version of your app ready in one week!

Sometimes I envy artists. Musicians, for example, they can write a new song and record it, all in the same day. If I were a musician I’d know how to get famous: write one song every day. Are you a writer? Crank out 12 novels a year by writing 1666 words a day. Put in the work and you’ll get there. Unfortunately, I don’t have that kind of skills. I am only an average programmer. That’s what I used to think at least. Until it hit me: “Wait… What did I say? I’m a programmer, right? What am I fuzzing about? Why don’t I crank out an app every day?” What happened is that I lost perspective. I could envision how someone else should advance their careers. But in my own career, I was lost. I knew how others should do stuff, but I only realized recently I could do the same thing. So, I set myself up for a challenge. Build an app in one week, one app in a day seemed a bit too gushy. 168 Hours on the clock, let’s do this.

# “Those who say, ‘It can’t be done,’ are usually interrupted by others doing it.” ― Joel A. Barker

### Hours remaining: 168

My background in writing apps is very limited. To be honest, I had written one or two Android apps by following a tutorial. Experience with iOS: zero, as in a Tesla’s emission. By today’s standards supporting one operating system is like trying to walk on one leg. So, how will I ever be able to write an app in one week without experience? I had to cheat. A lot of people and companies nowadays also cheat this way. Examples of these cheats are Facebook, Instagram, Tesla, AirBnB… You will know how I am going to cheat when I tell you about my web experience. I’ve built a few web apps with a JavaScript framework called React developed by Facebook. That same company also created React Native. React Native runs your JavaScript code like a native Android or iOS app. I figured since the React and React Native are similar I could build an iOS and Android app in record time. On the backend, I also need something fast. So, I’ll use Firebase, because it’s quick and easy. The title of this article suggests it all worked out… But did I finish my app in one week? You’ll find out later.

### Hours remaining: 167

The first step picking the tech stack: done! Next up: THE BIG APP IDEA. This step usually is the hardest part for me. I can come up with lots of ideas. But half of them end up being already done by others and the other half of my ideas are never ‘it’. My app doesn’t have to be unique. It doesn’t have to be disrupting, but whenever I build something I want it to serve a purpose. Stupid idealism… Why do I want it to have a purpose? Because I feel like I’m wasting my time otherwise. But by debating over what to build I’m burning my remaining 167 hours. I was about to lower my standards when out of the blue a colleague approached me. He remembered I once told him I like to code. I don’t work for a tech company so I am the only one who could discern Java from JavaScript there. He said: ‘Hey, you can build apps right? Why not build an app as a replacement for the narrowcasting system’. At our company, we have a lot of screens displaying information for all employees. This system is quite expensive and we’d often stare at black screens. So, I said to him: ‘Give me a week’. Lady Luck threw the idea I was looking for right into my lap. The idea was to build a simple app that would display relevant information to employees. That’s a purpose, right?!

### Hours remaining: 162

I’m on a roll. Now it’s time to get clacking on the keyboard! Wait, wait, wait, not yet. First, we have to make a plan. So far, I got the tech stack and the idea. Since it’s a simple app I thought it would be enough to draw a few wireframes. On those sketches, you can see the look and functionality of the app. Although I’m not design-oriented I like this step. By sketching on a piece of paper I can come up with cool results fast. I tried a few ideas but went with the simplest option. I could always change the design later. The most important part for me was getting the core functionality on paper. Those functions were:

• User has the ability to login
• Home screen shows the following tabs: news, events, info, logout button
• The ‘news’ tab shows current news items
• The ‘events’ tab shows upcoming event
• The ‘info’ tab shows basic stuff like important phone numbers

A few simple user stories and some sketches later I was ready for the real work.

### Hours remaining: 144

Day one was a success. I now have a rough idea what I’m going to build. To build it all from scratch didn’t seem like a good idea. I went out to find the best React Native boilerplate that would connect to Firebase. On my search, I found amazing stuff. For example, I found a boilerplate that uses CodePush by Microsoft to push updates of the app Over The Air (OTA). No need for going through the App Store again. That would make updates very easy. I found more! I found a boilerplate that was almost too good to be true. It could connect to Firebase, push updates OTA and deliver remote notifications (OneSignal). This boilerplate seemed like heaven, it could do everything I wanted and more. I envisioned it all, my app will be in the top of the stores in no time. Once I started using the boilerplate it all seemed to work. Yes, it seemed to work. You can hear the ‘but’ coming. The boilerplate was so big and so awesome. But whenever I tried to make changes I kept breaking something. Boilerplates can get cramped with features, which is cool, but sometimes it’s too much. The boilerplate I fell in love with so much became my biggest frustration. My life flashed by in front of my eyes… I saw the remaining hours tick by… That’s when I decided the boilerplate full of features wasn’t for me. We parted ways, the boilerplate ran towards the real pros, I went on the search again for a simpler plate.

### Hours remaining: 135

Working with all those boilerplates took way too long. I was well behind schedule. The thing I decided to do, is something you should do too. It’s easy to get overwhelmed when you are no Apple/Google/AirBnB pro. I decided to start from a standard boilerplate. The React community offers one called Create React Native App. By starting fresh I had to put in place the Firebase connection myself. That was actually a piece of cake with the help of an official Firebase tutorial. By following this tutorial, I made great headway on the basic functionality of the app. Because without a way to get the news items from the database the app wouldn’t be useful. Getting the connection to this database was a welcome morale boost.

# “I’ve missed more than 9000 shots in my career. I’ve lost almost 300 games. 26 times, I’ve been trusted to take the game winning shot and missed. I’ve failed over and over and over again in my life. And that is why I succeed.” — Michael Jordan

### Hours remaining: 120

The company I was building this app for isn’t very keen on sharing data with strangers. So, I had to figure out a way to protect it. After setting up the right rules, I trusted the security of Firebase. But the app was still displaying news freely. To protect the data from malicious onlookers I figured a login system would be what I needed. To signup for the app you had to enter a company email address and you had to verify the address. That way only real employees could get an account to get past the login page. I wasn’t sure this was going to work. I was afraid the spam filters would think the verification message was dangerous. Luckily, this wasn’t the case. Firebase doesn’t let you change the verification message itself. This way spam filters will recognize it as a safe message.

### Hours remaining: 96

The basic functionality: check. I was back on schedule, which felt good, but looking at the app made me vomit because of its ugliness. It wasn’t user-friendly or even useful at all yet. The next couple of hours I set out to polish the design and connect the features I’d built so far together. Like I said before; designing isn’t my strongest asset, but I’ll give it my all. While coding I ran into a few problems. For example, figuring out the right way to set up navigation. Also, too much time went into finding the right files in my directory and in which folder I should store what. While looking for a way to make my directory look clean I stumbled on Organizing a React Native Project. This helped a great deal in the time I spent looking for files. I also found a useful post on separating your screen in components. The idea is that every component on the screen should be a separate component in your code.

### Hours remaining: 72

Halfway through this project and it’s starting to look like something! After three days of relentless coding, I felt a little dent in my motivation. I can only focus for so long. I decided to do something else for a bit. A few months ago I took part in the email course #dailysvgimages by Coding Artist. During this course, I learned to create fun images. This app needed something to please the eye, so I used the free SVG editor Vectr to create an icon for the app. Pretty fun to do.

### Hours remaining: 48

Taking a short break from programming helped. It renewed my energy, drive and passion to finish the code for this app. I finished the basics, but it was still buggy. The last 10% of a project always takes the longest. If you don’t believe me read this article. Like the article mentions, I put off all the boring parts to the end. I also came up with lots of changes during development. Because fo this finishing the minimum viable product (MVP) was kind of boring. Sometimes it was even frustrating so I don’t have a lot to say about that part. Remember you have to get through this part to create a good product.

# “If there is no struggle, there is no progress. “— Frederick Douglass

### Hours remaining: 24

The last day started, it’s a Sunday so I’ll have lots of time to work on the app right? I still have to fix a lot of bugs, for example, the app forgot how to load data from my backend. So I could use a full day to finish it. Even though I had a whole day to work out the last kinks I didn’t spend it all on the app. The problem with having a lot of time is that you also have a lot of time to procrastinate. When I have 20 hours left on the clock I have time to watch a funny video on YouTube right? It’s only 3 minutes and 15 seconds, that shouldn’t be a problem. After finishing the video I look at the clock again and it shows I have 13 hours left. Okay… That was quick… Losing those hours sounds like a waste, but it’s actually my way of making a deadline. I know a lot of college students can relate. Getting closer to a deadline makes all the creative juices start to flow. Those juices need some stirring to achieve greatness. A deadline far in the future doesn’t stir the juices at all. It’s like the juices freeze on hearing of a deadline more than 3 hours away. So with the juices flowing and the renewed energy I set out to hammer down the bugs.

### Hours remaining: 0

It’s the end of the week, 168 hours later. Of course, I didn’t spend all those hours on the app, I still need to work during the day and sleep during the night. It’s always hard to say whether I achieve a goal related to programming. Programming is never done. This is definitely not the latest version of the app, I’m sure you won’t even recognize it in a few weeks. But I think I achieved my goal since the app does what it’s supposed to do and it doesn’t look too ugly. The makers of WhatsApp or Instagram or whatever would laugh out loud when I show them my work. I have a lot to learn on the design side of programming, that’s what I’ll focus on next. But the result of this week’s hard work makes me very proud. This was a first time building an app for both Android and iOS. A huge milestone in my programming journey.

Thanks for reading my story about how I built an Android and iOS app in one week. You can find the code on my GitHub. Before you head off, there’s one more thing I want to tell you. It’s the main reason I wrote this post:

You can do this too. Hereby I challenge you to build an app in one week!

If you liked this, please send me a message via the form below and subscribe to my newsletter!

# This is what you need to know about Socially Responsible Programming

2017-10-16 00:00:00 +0000

## Your talent is worth more than lots of zeroes in your bank account

Lately, I have seen a lot of stories about people getting their first developer job. Like this one or this one or this one. This is great news, but…

Their focus seems to be about getting the good paying jobs in IT after they learned how to code. I don’t think they realize the potential of what they learned. Programming is so much more than an income provider. Code can make or break the world. But why should you care what I have to say?

I’ve tried helping society in different ways. I volunteered my time for causes like the Red Cross or the local athletics club. I’ve donated money to charities. But it’s time to take a different approach. The reason for this is that I don’t have a talent for generating a lot of money. Thus, donating money is not the most effective method for me. I also don’t have a particular talent for folding camp beds with Red Cross volunteers.

The difference with earlier attempts to give back to society is that I now focus on my talents. I got these talents from studying computer science a few years back. I don’t work for a tech company. But in my free time I love to work on small projects. So, my new approach is to use my programming skills to code socially responsible.

### What is Socially Responsible Programming?

Let’s start by abbreviating it to SRP. By doing SRP you don’t donate your money to society, you donate your programming skills.

#### “If I have the means, I have the responsibility to employ them.” ― Terry Brooks

All programmers have this amazing skillset to turn nothing into something valuable. They build things out of thin air. I’ve always found it super rewarding to create something. Working for a tech company must be even more rewarding because the things you create are being used by many.

What if I tell you there is an even more rewarding way to use your fingers? And what if you don’t even have to work for a big tech firm? What can be more rewarding than disrupting the world with your code?

The answer is: disrupting the world with your code and making it a better place at the same time. This is what I call Socially Responsible Programming (SRP). In this article, I’ll tell you everything about it and I’ll explain why you should care.

![https://cdn-images-1.medium.com/max/2000/1GFYrdvpzVecpY6IYQ4Kc5w.jpeg](https://cdn-images-1.medium.com/max/2000/1GFYrdvpzVecpY6IYQ4Kc5w.jpeg)

You don’t have to be a renowned programmer to start reaching for the high levels of SRP. A few years ago I studied computer science. After my degree I didn’t see how I could improve the world with coding. So, I decided to do something else. A few months into the new adventure I missed programming. So I started a few projects from the freeCodeCamp curriculum.

These projects reignited my love for programming and I haven’t lost it since. I don’t see myself as a particularly talented programmer. I like to code and JavaScript makes it super easy to build awesome stuff that runs on phones and desktops.

Currently, I am working on a project with a friend that will connect elderly with youngsters. The goal of this project is to reduce the loneliness of elderly people.

• I’ve built a website at least once
• I’ve built an Android/iOS app at least once
• I’ve studied computer science
• Other coding experience

If you don’t have any programming experience, don’t sweat it. Start with the freeCodeCamp curriculum and come back here in a few months.

Also, feel free to substitute programming with any other skills you might have. If you do have coding experience you meet all the requirements for this article, keep reading.

### The Goal

The goal of SRP is to create value for your users. Value is usually created by helping users with a problem. With SRP it is the same, it also focuses on a problem. But not every problem qualifies.

The problem of not being able to find a cab doesn’t qualify. The problem of not having enough time to cook doesn’t qualify. Also, the problem of being too damn lazy to get off the couch doesn’t qualify. Of course, I’m exaggerating.

When a game gets kids from all over the world to go outside it definitely is a socially responsible game. Well done Pokemon GO!

#### “The world howls for social justice, but when it comes to social responsibility, you sometimes can’t even hear crickets chirping.” ― Dean Koontz

It’s impossible to write down a list of qualifying issues. Different individuals or societies will have different perceptions of the severity of issues. When in doubt, ask yourself if you could argue that you have a moral obligation to help on a particular issue. When the answer is yes, most of the time it’s a good issue to start a project around.

For example, it is possible you feel a moral obligation to give to charity or to help elderly people cross the road. Issues that do qualify don’t have to be global issues.

Your solutions can also be very simple like customizing a free website template. At the end of this article, I’ll list a few examples of socially responsible projects. For inspiration see this link of typical social issues that live in society.

The goal of SRP is to build something that helps any number of people, animals, trees, or… basically anything. But why is it so important to help society?

### Why SRP is important

Now I’m going to bombard you with moral statements…

Wouldn’t you want help if you needed it?

Wouldn’t you want people to use their skills to make something that is actually beneficial to the world?

Should the primary motivation to work be generating digits on a bank account?

#### “Successful people have a social responsibility to make the world a better place and not just take from it.” — Carrie Underwood

You have a talent. I know you do because you qualified for this article! You have the ability to change lives for the better.

We are all stuck on this planet together (for now at least), so instead of donating money, donate your time. This method is much more effective, especially if you put your talents to work.

If you are reading this article you speak English, have internet access and a little free time. By these metrics, I dare to say that you have a better life than at least half of the population on earth. That’s almost 4 billion people! Which means there are enough people that could enjoy your help. These people deserve a little bit of your attention. Programmers especially have the ability to help them, I’ll explain how you can do that in a little bit.

The cool thing is that SRP doesn’t just help others, it also benefits you. For me the most important reasons I code responsible are the following:

1. I feel great about myself
2. It adds a sense of purpose and meaning to my life
3. I can help others in need and make a difference

Now it’s time to get into how you can start with SRP.

![https://cdn-images-1.medium.com/max/1600/1gjwuVd_6mYWLYJa3Rk1p4Q.jpeg](https://cdn-images-1.medium.com/max/1600/1gjwuVd_6mYWLYJa3Rk1p4Q.jpeg)

### How to code for society

It all starts with opening your eyes to the people around you to find a qualifying issue. The best way to do this is by changing your routine. Go to places you’ve never been before.

For example, visit a local Meetup. Meetups are my new way of opening my eyes. I even sent in a 5-minute lightning talk proposal to the AmsterdamJS Meetup and it got accepted!

Once you’ve opened your eyes, you’ll start to notice things that could benefit from a few lines of code. Start with simple projects to get experience, and keep upgrading your projects.

Time is scarce, but to make a difference you will have to invest time in your project. Make sure you put at least a set number of hours in it each week. I put at least 2 hours a week into my SRP projects, most of the time a lot more. Set any goal for yourself and stick to it.

If you want a fun and easy way to track how much time you spend on different projects try WakaTime. Your free time has its limits of course, but there’s a solution for this. Ask your boss if he will grant you a few hours a week to work on a socially responsible project. Smart bosses accept this so they can show to clients how good they are for society.

Are you ready for some examples?

### Examples of social projects

There are a lot of cool examples of people who’ve built apps or websites that make the world a better place. The examples listed below are pretty advanced. Don’t get intimidated, instead look at it to get inspired. ####Teaching Khan Academy has a mission to provide a free, world-class education to anyone, anywhere. It teaches a range of topics, from math to history.

freeCodeCamp is a community that helps you learn to code. Once you learned to code you can get experience by contributing to open source projects. Non-profits actually use these programs.

#### Guides

Ankommen App is a guide for refugees to get to know Germany in their first few weeks in the country.

iRecycle can tell you how, where and when to recycle anything.

#### Games

Tree Planet 2 turns virtual trees into real ones. The aim of the app is to grow a virtual tree. The game will need its users to fertilize, water and defend it from loggers. While users are growing a tree on their phones, a real life tree is also planted and tended to. Tree Planet 2 claims to have planted 500,000 real trees in 10 different countries.

Save the Children Earthquake Response is a simulation game about disasters. It has the goal to spread awareness about disaster relief.

### Final thoughts

I’m not saying you should quit your job and go all philanthropic. What I am saying is: start thinking about how you can solve issues that you see in your environment. It could be a personal issue and that’s fine, as long as you can help someone or something with your talent! What can you come up with?

# Nobody is safe on the internet

2017-08-17 00:00:00 +0000

Often I hear people say: “I don’t have much to hide, why would I bother keeping my data safe?”, a lot of companies would agree with you. Data is like gold, 1 MB of (potential) customer data can be worth 1 kilo of gold. But still, you ask: “So, what?”. In this post, I’ll tell you why you should care…

It will start out harmless, let’s look at this example of a fictive company and call it The Diaper Company (DC). DC has a web shop where it wants to sell as many diapers as they can possibly make. They recently opened a new position for a Diaper Data Manager (DDM), the DDM will be responsible for maximizing profits by looking at the data. DC has been collecting data about:

• Production (1000 diapers a week)
• Customers (young parents)
• Costs (15 euro per pack)

The Diaper Data Manager pays services like Google AdWords to display ads only to the targeted customers. Only young parents will know about the existence of DC. You can argue that this approach is helpful to potential customers who don’t have to look for a diaper supplier anymore because DC will find them instead.

But, let’s look at two examples of the near future and say that DC profits when they sell the diapers for 15 euros or more.

Young parent Michelle is looking for diapers for her 1-year-old son, she sees a lot of ads about diapers and they all display a price of around 25 euros. At the same time, Chris is looking for diapers, he has a 4-year-old son. Most kids are potty trained by the age of 3, but Chris’ son is taking a little longer. When Chris looks online he has to look a little harder but he also finds an ad for diapers which shows a price of 20 euros. The ads advertise different prices to different target audiences.

In the example of Michelle, DC knows she will buy diapers, every 1-year-old needs diapers. Even when DC increases the price, Michelle will buy the diapers. In the case of Chris and his 4-year-old, DC is not so sure that he will keep buying diapers since his son is outside of the diaper range. Maybe if DC keeps the price low for Chris, he will keep buying them for a little while longer before potty training his son. When the price is low, Chris won’t have an incentive to stop with the diapers. This example was based on data that can be legally acquired and although it is very blunt, maybe it will open your eyes. If you used to think you don’t have anything to hide, maybe now you start to wonder about what your personal data actually means to others and how it helps YOU if you keep it private.

### Be aware of what you share!

Next up is a list of things you should probably not share. This will be common sense, but I want to list it just for completeness. Every time you share something run over this checklist to make sure you don’t send anything you are going to regret later. Make sure your post is free of:

• School/job name
• Phone number
• Location
• Personal conversations
• Passwords`*`

And don’t post in the heat of the moment!

`*`Short note on passwords: I use LastPass, it’s a free password manager that stores all of your passwords for you. It works like a charm, when I open a website, LastPass fills in my credentials and logs me in automatically. I don’t have to remember all of my passwords anymore, I only know my LastPass password.

### How to keep your data safe

The next important step in online privacy is keeping your data safe. It starts with knowing who owns your data, after that find out what data they have and finally make sure you know exactly what happens to your data in the future. In this post, I’m going to focus on online companies to keep it simple for now, but be aware that companies who mostly operate offline, like supermarkets, also collect vast amounts of data.

#### Step One: Who owns my data

Let’s look at Facebook because that company is one of the biggest hoarders of data and most people will have an account there.

#### Step Two: What data do they own

After entering your profile link on stalkscan.com, it shows every thing about you. Click on ‘pictures’ for example and I bet you will be surprised when you scroll down the list, I hope you won’t feel embarrassed though.

#### Step Three: Gain control of your (future) data

The best way to gain control of your future data is to set your privacy settings correctly. In your privacy settings, you can tell Facebook if you want to share your posts with the world or only with your close friends. If you want to know more about privacy settings (which I highly recommend), then I suggest The Complete Guide to Facebook Privacy Settings. These settings are only applicable to future posts, to regain control of old data you’ll have to delete or untag yourself from posts. This can be a very time-consuming job and you can trust Facebook to keep a copy… But, at least it doesn’t show up anymore.

So, this is how you get your Facebook data in control, now it is your turn to do the same for other social media accounts you probably have. Follow the three steps listed above for all your social media accounts, that way you will be aware of who (or which company) has your data and how to regain control of it.

I’ll show you another neat trick, following all the way through these steps will take some time but it will be worth it in the end. So, what you want to do is the following:

• Click the downward arrow in the top right corner of a post
• Click ‘Hide all from X’ or ‘Unfollow X’

Repeat this for everybody in your timeline and your are done! This way you are still friends with everybody and you can still see their posts on their walls, but they just don’t appear in your timeline anymore. That way whenever you open Facebook it will be empty and boring, you will likely leave very soon. This is how I overcame my addiction.

### Conclusion

It’s up to you to decide whether your data is important to you or not. I am still debating for my self how far I am willing to go when it comes to keeping my data private. When I first understood the value of my data I started deleting everything I had ever posted to Facebook, including all my pictures and posts, I changed my name and I enabled all privacy settings. My current settings are a little less paranoid, now at least my friends can find my profile and I added one simple picture. I even posted a few things, mostly blog updates though, so nothing very interesting. Educate yourself on privacy, be aware of the risks and decide how paranoid you want to be. For more detailed info check out this TED playlist, it’s a playlist consisting of 8 talks about what your data reveals about you.

# Bearded Dragon Digest vol. 02

2017-06-23 00:00:00 +0000

## The projects are starting to take shape!

### News & Random

Something disturbing is going on, there’s a disease running in the cohort… A few dragons are showing signs of the digital disease called ‘Data Hoarder’. Further investigation should tell us if this disease is infectious, for the time being, you can seek counsel with @drguildo, Scott Spence or this Subreddit.

Maybe it’s because there is a lot of talking going on in our cohort. So far 6k messages have been sent by you guys; 31% in public channels, 40% in private channels and 30% of the messages were DMs. We also hit our limit of integrations, so if you want to test your bot, you will have to open a slack yourself (which is pretty easy to do) and install your bot there to test it.

Today @piotr posted the first poll in the #poll channel, more questions will follow, so be sure to visit the channel in the coming days. The first question was: How do you rate the activities (build-to-learn, pair programming, buddies) so far? (1: I expected more … 5; met my expectations). The results so far:

1. 0%
2. 0%
3. 40%
4. 40%
5. 20%

### Shout-Out & Showcase

@tlannoye11 finished the Simon Game project, check it out. Rumor has it that @tlannoye11 will earn the first certificate very soon.

Check out @jsrco’s new portfolio!

@leofis passed his IELTS, so now he has proof of his proficiency in English which means he can go to London to study!

Pankajashree R wrote an article about the #100DaysOfCode challenge. If you’ve never participated in this challenge be sure to check it out! Looking back after a 100 days

### Dragon Of The Week

freeCodeCamp teaches developers to learn by themselves and not just follow instructions or tutorials. This weeks dragon is doing just that by going the route fCC isn’t going, which is testing. Testing is very important, but unfortunately, fCC doesn’t focus on testing at all. It is up to the programmer if she/he wants to implement a test suite for her/his projects. The Dragon of the Week is Jason Boxman, he started writing tests for ReForum, click here if you want to help him out and learn more about testing.

# Bearded Dragon Digest vol. 01

2017-06-16 00:00:00 +0000

## It’s amazing to see so much collaboration and discussions already in the very first week!

### News + Random

A lot happened during this first week, we welcomed 42 coders! Out of them, 30 members wrote an intro story about themselves (if you haven’t yet, it is never too late). Later that same week we started with Pair-Programming, FCC Speedrun, Build-to-Learn and Accountability Buddies. Shout out to Chance Taken for setting it all up and good luck to all the teams!

Some awesome open project ideas:

Don’t worry if you can’t come up with an idea right away, your team should just get going, don’t focus on the details. I struggled with that on my last B2L project and wrote about the experience here.

HACKATHON!! @ranewallin put together a sign-up sheet to gauge interest in the ReactRiot hackathon. If you want to work with a remote dev team on a real world app and potentially win prizes, put your name on the signup sheet!

For anyone interested in trying out VS Code, (I know I am!) Scott Spence is going to write a medium post about it very soon.

### Shout-Out & Showcase

Our friend @leofis received his Front End Development Certificate on Monday!

Are @sandra-d and Scott Spence gonna have a bake off soon?

Check out @chiamaka, she is learning Redux on the beach!

Check out Scott Spence’s logs from last week. He seems to be a JavaScript fan. If you want these awesome charts too, head over to WakaTime.

### Dragon of the week

The Chingu we want to set in the spotlight this week is @leofis. Leonard, at only 19 years old, is one of our youngest members. He has been part of freeCodeCamp for two years now, but didn’t have a lot of time to code while going to school, the gym, CrossFit and applying for College. His decision to switch from fitness trainer to coding will certainly pay off. Check out his Simon Game here.

### Meme To Go

Do you have a funny meme or gif?? Shoot me a message!

# How my site loads in 1.25s

2017-06-05 00:00:00 +0000

Last week I received a shocking message from Google. I forgot how it happened but Google asked me if I wanted to test how mobile friendly my site is. After entering my URL I got results I didn’t expect. My site ditisAnton is a very small and simple site, it has only one picture and a few lines of text. Nonetheless, the results opened my eyes.

As you can see, the first metric has a good score of 93/100. But the loading speeds are way lower than I expected for a site with a total size of 450 KB.

If you look closely at the list of files my site loads you see a few Bootstrap downloads, jQuery and a font I’m not even using. I was using jQuery and Bootstrap only to display a modal when you click a certain button. I decided to build this functionality myself, it took a little more time than just using jQuery and Bootstrap but it saved me almost 100 KB. Another tool to see your site’s performance is Lighthouse, a Chrome plugin. They gave me some more tips to improve my site. See the result for yourself…

I not only managed to get good results from Google’s test but most importantly my site went from 450 KB to 91.7 KB while maintaining the same functionality. This took me one afternoon in total. If you haven’t already, test your site with Google and install the Lighthouse plugin.

# Keep Moving Your Fucking Fingers

2017-06-01 00:00:00 +0000

In this post, I’m going to talk about how a project I was trying to do with two dudes I never met before totally failed. First I’ll start with my favorite way to learn to code and have fun and feel really content. If you’re learning web development you should check out freeCodeCamp. I really love their way of teaching, their aim is to get you to contribute to a non-profit foundation and eventually get a job as a developer. FCC doesn’t just teach you how to code, it also gives you a way to build a portfolio which you can show to future employers. FCC offers multiple certificates and in order to get these certificates, you have to do projects. For example, I’m working on a book trading app for the backend certificate. These are the user stories the app has to tick off:

• User Story: I can view all books posted by every user.
• User Story: I can add a new book.
• User Story: I can update my settings to store my full name, city, and state.
• User Story: I can propose a trade and wait for the other user to accept the trade.

It’s real good practice to build an app like this from scratch. So, that’s step one… Are you ready for the next level? I mean really ready… I mean dedicated as Trump… If you think you are ready for it read on… The next level I’m talking about is called Chingu Cohorts. It has its origin from FreeCodeCamp, it shares a similar goal and the community is just as motivated and filled with kind people. I think the people in this community are the coolest people on earth. Like I said, the goal of Chingu Cohorts is similar to FCC which is to learn how to code. The difference with FCC is instead of coding on your own you can collaborate with other aspiring devs. These devs are literally from all around the world. If you want to do a project with a few random people from random places you can sign up for a Build.To.Learn project and the Cohort sets you up with a team to collaborate with and create cool stuff.

With these two I got into web programming. That’s it. You can find hundreds of sites which teach coding, but none like this. Hands down the best. What you just read was an intro to what I really wanted to share with you… Read the rest of the article real careful, get your shit together, throw your phone out the window and focus. Right now I am part of the Walrus cohort, a cohort takes a little over a month. This one is a mix of part-time and full-ime coders, like always you can sign up for events and projects. The project I signed up for is called Build.To.Learn normally you sign up for a specific project like building a slack bot or a landing page or whatever, but this time it was a little different. The creator of Chingu Cohorts is always trying out new things to see what works best. This time the thing to build was not specified, it could be anything. This interested me so I applied, got assigned a group of two other coders, one from Greece and the other from Turkey. Awesome guys.

So what can we build…? We can build a fucking time machine, we are JavaScript ninjas! The problem wasn’t generating ideas, we had loads of weird ideas. But we did have a problem. We knew we had like a month to build a small app, so we’d better hurry, but that’s the thing with JavaScript you can build something really quick and share it with everyone. All you need is an internet connection, who doesn’t have that in the year 2017, right? Are you wondering what we decided to build? We decided on nothing… We screwed up. We wasted time on trying to come up with a project everybody would like, not just everybody in our group but everybody like in everybody on our planet. I struggle sometimes with thinking about what others might think of me when I share something. So, this project actually opened my eyes, I was reminded that taking action is more important than pleasing everybody. I know a lot of people aren’t going to care if I write about coding, most don’t even care whether I write at all. By this project, I got even more inspired to keep building and keep sharing and Keep moving my fucking fingers. If you are struggling with deciding what to build or just with starting in general… Hit me up.

# Nodemailer Struggles

2017-05-29 00:00:00 +0000

Have any of you used Nodemailer before? Until this afternoon I hadn’t, but hey, it’s just another package can’t be too hard. On this site, I wanted the ability to send messages to… myself (I hope one day someone else sends me a message). Nodemailer doesn’t send the message itself but tells Gmail to send the email. The tutorials I found online were all straightforward just 35 lines of code, including nice spacing.

You’ve got mail!