teleren/devto huggingface dataset:
Why is our source code so boring?
Tags: discuss, design, healthydebate
Published: 2019-11-04 12:03:29

Last year, I was privileged enough to see [Peter Hilton](https://twitter.com/PeterHilton) give [a presentation about source code typography](https://hilton.org.uk/presentations/beautiful-code) at [geeCON 2018](https://2018.geecon.org/), and the main points of that talk still roll around in my head pretty regularly. In a nutshell:

# source code is boring

Most developers write ASCII source code into plain text files using a fixed-width font, often trying to keep line length under 80 characters out of habit or "best practices":

```
public class MyClass {
  public static void main (String[] args) {
    System.out.println("oh god it's so boring");
  }
}
```

Fixed-width fonts and 80-column limits are a throwback to the [IBM 80-column punch card](https://en.wikipedia.org/wiki/Punched_card#IBM_80-column_punched_card_format_and_character_codes) which dominated the industry for decades until it was slowly phased out in the latter half of the twentieth century:

![FORTRAN program on 80-column punch card](https://upload.wikimedia.org/wikipedia/commons/5/58/FortranCardPROJ039.agr.jpg)

When colour terminals became popular, we could add things like syntax highlighting:

```java
public class MyClass {
  public static void main (String[] args) {
    System.out.println("boring, but in colour");
  }
}
```

And what Hilton calls "the most recent innovation in source code", [ligatures, which burst onto the source code scene around 2012](https://github.com/i-tu/Hasklig), have been in common use in print typography for hundreds of years:

![ligatures with "t" and "h" as well as "f" and "j"](https://thepracticaldev.s3.amazonaws.com/i/5zkr0odn4lpuhzfwaqid.png)

This begs the question...

# Why is source code stuck in the past?

In a best-case scenario, [modern users will define different fonts or styles](https://medium.com/@rzvdaniel_71068/customize-visual-studio-code-for-multiple-fonts-and-styles-96f83562af58) for different keywords in VS Code in order to construct some kind of visual hierarchy within their programs:

![source code with syntax highlighting, ligatures, and multiple fonts](https://miro.medium.com/max/701/1*XZog5jntWrEDxbA1irnQ9A.png)

...but we're not reaching the full potential of what's possible. Why not drag-and-drop modules? Why not AI-powered automatic code generation? Why not graphical coding like [Scratch](https://scratch.mit.edu/) or [Flowgorithm](http://www.flowgorithm.org/)?

Why has there not been a single revolution in the way source code is written in nearly a hundred years?
From a Windows 10 clean installation to a Dev Environment in 30 minutes with Boxstarter
Tags: windows, productivity
Published: 2019-11-04 11:52:05

Setting up a development machine is always a big time-consuming task and every developer hates this activity.
But sometimes you have to do it because as a developer you have to install third-party software, beta releases, and other unstable pieces of stuff.

With Boxstarter I found a solution to solve this issue.
In almost one hour I have a dev machine up and running from a clean Windows installation.
It is also useful if you want to set up some virtual dev environment on the cloud.

## Install Boxstarter

PowerShell is installed by default on a clean installation of Windows 10, so you can easily open a new instance in a terminal and type this command:

```powershell
. { iwr -useb https://boxstarter.org/bootstrapper.ps1 } | iex; Get-Boxstarter -Force
```

This command will install Boxstarter directly from the web.

If you have some issues to run remote script from PowerShell, you can run the command below to enabling remote script on your machine:

```powershell
Set-ExecutionPolicy Unrestricted -Force
```

## Install your software from a gist

You have the best results with Boxstarter if you use a gist to store your machine setup.
For my purpose, I have this script below stored on gist.
The syntax is very simple.
The word "cinst" means "install this package" and you can find your favorite packages directly from the Chocolatey packages repository [https://chocolatey.org/packages](https://chocolatey.org/packages).
You have to use the Chocolatey packages because Boxstarter is built on top of it.

{% gist https://gist.github.com/kasuken/d5e2ce84a9108002e81603fc3d42e492 %}

To run this gist, you have to use this command in a PowerShell terminal window:

```powershell
Install-BoxstarterPackage -PackageName https://gist.githubusercontent.com/kasuken/d5e2ce84a9108002e81603fc3d42e492/raw/b5c5175ffa90c7665200a061db739a051abf0f74/devmachine.ps1 -DisableReboots
```

## Advanced settings

There are many advanced commands to customize Windows or install Windows features.
For example you can use these two commands below:

```powershell
cinst Microsoft-Hyper-V-All -source windowsFeatures
Install-ChocolateyPinnedTaskBarItem "$env:windir\system32\mstsc.exe"
```

The first one, install Hyper-V and you have to specify the source.
By default the source is Chocolatey but in this case, you force Boxstarter to use the source WindowsFeatures.
With the second one, you can pinned some apps or files to the taskbar directly.
I don't use this command because I like to do it manually after the overall installation.

Have a good Boxstarting!!!
Digital Citizenship Pillers
Tags: digitalcitizenship, gamify, data
Published: 2019-11-04 11:38:19

> A digital citizen refers to a person utilizing information technology (IT) in order to engage in society, politics, and government.

Any successful Digital Citizenship and Engagement initiative should focus on these FIVE pillers:  

1. **EMPOWER CITIZENS IN THE DECISION MAKING PROCESS** - Provide visibility and transparency and empower citizens in the decision-making process on key local governments priorities. Not will it only make citizens feel involved but trusted, leading to a positive partnership.


2. **DESIGN EASY-TO-USE PLATFORMS FOR INNOVATION AND ENGAGEMENT** - Digital Interaction between local authorities and citizens must be intuitive. Platforms must be designed to enable more agile and responsive ways, with a greater understanding of citizens' wants and needs.


3. **DEVELOP A COMPREHENSIVE COMMUNICATIONS STRATEGY** - Communication is key and for it to truly work, authorities must create a comprehensive and targeted communications strategy, making use of all available platform like website, email, social media, advertisements & door visits.


4. **GAMIFY AND PROVIDE INCENTIVES** - A recognition and rewards will go along way. A program based on giving tangible gifts such as discount on service like council tax, is a great starting point. Also, employees should be rewarded for driving adoption of any initiative.


5. **ALLOCATE SUFFICIENT RESOURCES AND SUCCESS METRICS** - Any initiative must have a set of identifiable goals, objectives and measurements, to help track citizen engagement, monitor changes and allocate proper resources.
Couple words about static factory methods naming.
Tags: java, lang
Published: 2019-11-04 11:38:07

---
title: Couple words about static factory methods naming.
published: true
description: Not a holy war, just observations.
tags: #java #lang
---

There are few widely used approaches for naming of these types of methods, especially in general purpose classes.
 - `getInstance()` and alike
 - `of()`
 - `with()`

There are a lot of other variants, but they not so ubiquitous.

From my point of view these naming conventions looking so:

 - `getInstance()` is just plain ugly and verbose.

 - `of()`and `with()` are modern ones, widely used and for quite some time were my main approaches.

Recently I've hit one inconvenience with `of()`and `with()`: if I'm using them with static imports (for brevity) they loose clarity (hard to decide which `of()` or `with()` belongs to which class). 

This is less an issue if there is only one such static import. But often I need in code several classes with such factory methods. In such case I can't do static import for both of them, so I ought to either use qualified name for all of them (and loose brevity) or use static import for one of them and qualified names for others (and loose clarity and brevity).

To resolve this issue I've decided to change approach and use lowercase name of class as a static factory method name. This enables me to use static imports for all such classes and preserve clarity and brevity:

```java
   ...
   final var entries = map(1, "First", 2, "Second");
   ...
   final var topicList = list("One", "Two", "Three");
   ...
   final Promise<List<User>> friends = promise();
   ...
```
All within the same file, clear and brief.


I'd like to know your opinion about this approach.
How would the perfect productivity app look like for you?
Tags: productivity, discuss
Published: 2019-11-04 11:10:15

---
title: How would the perfect productivity app look like for you?
description: How does the perfect to do app look like for you and how would you use it?
published: true
tags: productivity, discussion
cover_image: https://thepracticaldev.s3.amazonaws.com/i/iy0u36ic6k0rf729v485.jpg
---

How would the perfect to-do/productivity app look like to you (desktop or mobile)? What would be it's features? And how would you use it?



---
*The background is that I am developing [this to-do app for programmers](http://super-productivity.com) and I want to make it better!*
I wrote a Jekyll theme that helps you to write down diary.
Tags: jekyll, theme, diary
Published: 2019-11-04 08:17:22

---
title: I wrote a Jekyll theme that helps you to write down diary.
published: true
description: 
tags: jekyll,theme,diary
---
![](https://raw.githubusercontent.com/soyaine/jekyll-theme-diary/master/assets/img/jekyll-theme-diary-screenshot-light.jpg)

When I first tried to write this theme two years ago, I just started my learning on JS and CSS. So it could be more emotional to call it my first baby. To do my best to design a simple and beautiful one, I had read The Non-Designer’s Design Book before I started to draft by PS in my clumsy hands. Thank goodness, the result is not bad. I still love the colorless page even now.

That’s not the whole story. Another reason why I put the diary element here, is the desire to develop a habit of keeping a diary. Through all of my Soyaine Daily (My diaries name) life, it just has a little reader. When I began to write, I only sent one friend the URL. Although it always surprises me when she mentioned something in my diaries during chatting. I told myself, I just write to myself, for myself, other than anyone else.

After around 100 posts, I closed my site. Then I started to write in my local folder with no style.

The diary helped me to start writing down, and the journal lasts a long time beyond my expectation. It’s my beginning to jag my life fragments down, in the bytes. I’m not good at memorizing. I always forgot lots of details after the time passed. The words take a lot of pictures of my life. It’s a romantic way to listen to myself as an older me by words.

So I rewrite the theme, I’ll be happy if it can help you also.

Project address: https://github.com/soyaine/jekyll-theme-diary
Tips for continuous integration, deployment & delivery
Tags: todayilearned, devops
Published: 2019-11-04 11:00:11

*TL;DR style notes from articles I read today.*

### [Automated continuous deployment at Heroku](http://bit.ly/2PIbrOd)

- When adding new automation, start small.
- Make it easy to onboard. Configuring pipelines and listing alerts to monitor should be easier than manually deploying.
- If a manual process was working fine apart from speed, let the automated process use the same model. 
- Isolate early pipeline stages by team environment to avoid affecting other teams right away.
- Teach deployers to use context the way a human would - scan for open incidents, check whether changes have been merged (or it might use incomplete work). 
- Use internal feature flags to separate the deployment of changes and the enabling of features.

*[Full post here](http://bit.ly/2PIbrOd), 8 mins read*

---


### [Benefits of continuous delivery](http://bit.ly/2PHaPZl)

- Small, frequent deploys contain less code and hence less risk of introducing bugs. Recovery is easier too.
- Troubleshooting is easier because there is a single change (or just very few) to check and it is fresh in your mind.
- Customers prefer quick access to new features. It ensures quick feedback from customers for every feature which can guide you to your next version.
- You need a DevOps culture where the developer is also the deployer. Automate build and deployment to be quick and easy.
- Set up the system for rolling upgrades, deploying server by server to avoid service interruption.
- Make it easy to revert to an earlier version if there are problems with a new deploy.

*[Full post here](http://bit.ly/2PHaPZl), 5 mins read*

--- 

### [Tips and tricks for scalable CI/CD flow](http://bit.ly/2JHCe9x)

Tips to help you scale up CI/CD flows for big projects if you are using Docker and Kubernetes:
- Define your VCS (version control system) flow, with help from Git Flow or Github Flow. 
- When using a complicated manual release process, use tags to trigger production releases.
- Adapt your Git flow for the number of environments you have.
- Set up notification channels to track all CI flow processes.
- Keep Docker images simple. Avoid passing env variables. Use the Run command or let Kubernetes handle this.
- Define a Docker image naming convention - for development and UAT, where there is no rollback, you can use branch names as tags so the previous image is overridden; for production, tag with the release version number.
- Execute database migrations as a separate step outside the Dockerfile.
- Avoid private libraries and submodules.

*[Full post here](http://bit.ly/2JHCe9x), 5 mins read*

---

*[Get these notes directly to your inbox every weekday by signing up for my newsletter, in.snippets(), here.](https://mailchi.mp/appsmith/insnippets?utm_source=devto&utm_medium=post08&utm_campaign=is)*
Autocomplete WordPress Hooks in Vim
Tags: vim, php, wordpress
Published: 2019-11-15 11:15:55

---
title: Autocomplete WordPress Hooks in Vim
published: true
date: 2019-11-04 10:02:53 UTC
tags: vim,PHP,Wordpress
canonical_url: https://daniele.tech/2019/11/autocomplete-wordpress-hooks-in-vim/
---

WordPress is not so supported in Vim, let's try to improve that.

Few days ago [John Blackbourn released a new project](https://github.com/johnbillion/wp-hooks) that basically is a list of hooks in JSON files from WordPress.

Check the complete post [Autocomplete WordPress Hooks in Vim](https://daniele.tech/2019/11/autocomplete-wordpress-hooks-in-vim/) appeared first on [Daniele Mte90 Scasciafratte](https://daniele.tech/eng).
Vim の gj と gk を VSCode で実現する
Tags: vim, vscode
Published: 2019-11-04 09:43:37


https://superuser.com/questions/1290030/vs-code-how-can-i-move-the-cursor-by-display-line-when-wrapping-in-vs-code


```json
"vim.normalModeKeyBindingsNonRecursive": [
    {
        "before": ["j"],
        "after": ["g", "j"]
    },
    {
        "before": ["k"],
        "after": ["g", "k"]
    }
]
```
Git log filtering and how to show a better history tree
Published: 2020-05-29 03:49:09

---
title: Git log filtering and how to show a better history tree
published: true
date: 2019-11-04 09:00:00 UTC
tags: 
canonical_url: http://arturo.linar.es/en/blog/git-log-filtering-and-how-show-better-history-tree
---


Some useful commands to find commits using Git:

**Filter by content**

Filter by the contents of a commit. Think of it as if you do a `git log -p` (shows the diff of each commit) and then you search the output.

`git log -S var_dump`

**Filter by commit message**

`git log --grep "FRB-666"`

**Filter by author**

`git log --author "Arturo"`

You can use emails and several values:

`git log --author "outlook.com|hotmail.com"`

**Filter by date**

Conveniently accepts `--before` and `--after`

`git log --before "2017-06-11"`

## Git log format

I've found that `git log` is powerful, but sometimes difficult to read. Normally I use this git alias to show a nice tree in the console:

```
$ git config --global alias.lg
log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)%Creset' --abbrev-commit

```

This will show a tree like this when you type `git lg`

![Terminal with git log tree](http://arturo.linar.es/sites/default/files/2019-11/git-log.png)
Pós-piscina: madrugando outra vez (git)
Tags: git, github, piscine, borntocode
Published: 2019-11-04 08:58:56

As viradas de noite durante a piscina foram memoráveis: raramente eu sentia sono.
O cansaço ameaçava chegar junto com a alvorada.
Hoje tive um desafio: ajudar uma amiga a resolver problema de autenticação com a github (Permission denied, error 403).

Descobrimos, a duras penas, que o Windows guarda o usuário e senha da github como credencial genérica, por isso ele não pede a senha a cada push. Ela não conseguia autenticar pois estava usando o computador de uma outra amiga, e esse tinha o usuário da dona salvo. O caminho para resolver esse problema é indo no painel de controle, em contas de usuário, gerenciamento de credenciais, e procurar ali as credenciais genéricas. Voilá! edite o usuário e senha da github por ali. Se o computador não for seu, lembre de recolocar a credencial antiga de volta.

Outro problema que encontramos: ao dar git add, o terminal avisava que iria mudar no arquivo de configuração sobre a final do arquivo.
No Unix, o final de linha é identificado como "LF", mas no Windows o final de linha é identificado como "CRLF". Uma forma é ignorar esse alerta, principalmente se ele quiser mudar de LF para CRLF. O comando é:
``` git config --global core.safecrlf true ```
Um último problema: alguns arquivos não estavam subindo para a github.
A madrugada foi longa. A primeira atitude que tive foi conferir pasta por pasta para ver os arquivos faltantes. Descobri depois que era culpa dos arquivos .gitignore contidos em algumas pastas. A solução para conseguir subir todos os arquivos sem ter nenhum ignorado é adicionar o comando -f, ficando assim:
```git add -f <arquivos aqui>```
E mais uma vez, passei uma noite hiper focada, fazendo o que amo duas vezes: codando e ajudando uma amiga; e o mais legal, aprendendo coisas novas.
Create components with native HTML tags’ attributes by using “inheritAttrs” in Vue 2.4.0+
Tags: javascript, vue, html, attributes
Published: 2019-11-04 08:32:37

# Scenario
When we want to pass some custom value to other components in Vue, passing “`props`” would be the first chose. However, when it comes to common attributes in HTML tags like `autocomplete`, `maxlength`, etc. We also want a “native HTML like” develop experience.

For example, we create a `CustomInput` component which contains `input` tag wrapped by a `div` with a class for styling.

```
// my custom input CustomInput
<template>
    <div class="myClass">
        <input attributes />
    </div>
</template>

// parent component import CustomInput 
<template>
    <div class="wrapper">
        ...
        <custom-input maxlength="5" autocomplete="hello" />
    </div>
</template>
```

What we want to do is that passing down attributes from parent component to `CustomInput` without using `props`.

---

# Practice
By default, when attributes are passed down to a child component, the root HTML tag in child component will inherit those attributes.

```
// the output HTML from the above example
<div class="wrapper">
    <div class="myClass" maxlength="5" autocomplete="hello">
        <input />
    <div/>
<div/>
```

However, what we expected is that attributes can be inherited by `<input/>`. 

Since Vue 2.4.0, there’s an option called “`inheritAttrs`”. By setting this option `inheritAttrs: false`, the default action will not be executed. 

Finaly, we can use `v-bind` & `$attrs` to setup the attributes manually.

```
<script>
export default {
    inheritAttrs: false,
    data(){
        return {
            myLength:0,
        }
    },
    created(){
        this.myLength = this.$attrs.maxlength
    }
}
</script>
<template>
    <div class="myClass">
        <input v-bind="{...$attrs, maxlength:undefined}" />
    </div>
</template>
```

Besides of “Destructuring Assignment” the `$attr` object and attaching it by using `v-bind` , we can also replace the attribute’s value to `undefined` and manipulate it by ourself in `data` option for other usage.

---

It’s only a little trick for building custom components. Hope you are enjoy the article, and keep following me for the next sharing.
17 Special Characters in the Shell That You Should Know
Tags: bash, linux
Published: 2019-11-04 08:14:36

Check out my latest post!

It is a list of the most popular BASH conditional expressions that everyone should know!

Link to the post:

https://bobbyiliev.com/blog/linux-17-special-characters-in-the-shell-that-you-should-know

I hope that this helps and let me know if you have any questions!
Using Google Chrome's Socks5 Proxy With SSH Tunnels
Tags: ssh, chrome, aws, vpc
Published: 2019-11-04 08:06:38

---
title: Using Google Chrome's Socks5 Proxy With SSH Tunnels
published: true
description: Using SSH tunnels and Google Chrome's socks proxy to access services within a secure virtual private cloud.
tags: SSH, Chrome, AWS, VPC
canonical_url: https://paulbradley.org/chrome-socks5/
cover_image: https://thepracticaldev.s3.amazonaws.com/i/niwqwhzx117iyznk039z.jpg
---

# Using Google Chrome's Socks5 Proxy With SSH Tunnels

At work we're migrating our core infrastructure to Amazon's AWS service. We have a pretty standard set-up with an infrastructure account hosting our bastion servers, allowing suppliers to connect to our different environments. Currently we have three Virtual Private Clouds (VPC) - production, pre-production and development.

On premise access to these environments is provided via a Direct Connect pipe provided by our WAN supplier.


```
   INTERNET
      |
+-------------+       +----------------------+
|     |       |       |                      |
|  +--v-----+ |       | +--------+ +-------+ |
|  | Bastion| |       | | App    | |DB     | |
|  | Server |-----------> Server | |Server | |
|  +--------+ |       | |        | |       | |
|             |       | +--------+ +-------+ |
+-------------+       +----------------------+

INFRASTRUCTURE                     PRODUCTION
VPC                                       VPC
```

Accessing the web interfaces of the applications running on our application servers is fine while working on premise. However, when I work from home I need to create an SSH tunnel through the bastion server and then use Chromes socks5 proxy to direct requests through the SSH tunnel.

## Creating the SSH tunnel

SSH into your bastion server using the `-D` option to bind an addressing port from the local machine to the connection. I tend to use port 1080

 
```bash
ssh ec2-user@bastion -D1080
```

Launching Chrome to use the binding
Launch Chrome and pass in the `--proxy-server` option to use the socks5 proxy on your localhost. All traffic/requests will be directed to the port number you used in the SSH connection.

    
```bash
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
    --user-data-dir="$HOMEproxy-profile"
    --proxy-server="socks5://localhost:1080"
```

Using this Chrome session you should be able to connect to the web interfaces or applications running on servers within your VPC's

---

Also posted @ [https://paulbradley.org/chrome-socks5/](https://paulbradley.org/chrome-socks5/)