teleren/devto huggingface dataset:
The 7 Most Popular DEV Posts from the Past Week
Tags: top7
Published: 2018-04-23 18:01:42

---
title: The 7 Most Popular DEV Posts from the Past Week
published: true
description: A round up of the most-read and most-loved contributions from the community this past week.
tags: icymi
cover_image: https://thepracticaldev.s3.amazonaws.com/i/sfwcvweirpf2qka2lg2b.png
---

#1. This tutorial is no joke 😋

Learn how to build a joke listing app. This tutorial is designed to help you get started on building and adding authentication to a Golang app with the GIN framework.

{% link https://dev.to/codehakase/building-a-web-app-with-go-gin-and-react-5ke %}

#2. VS Code Extension Listicle ❤️

A list of must-have extensions for visual studio code users. 

{% link https://dev.to/fbnlsr/10-essential-extensions-for-vscode-174i %}

#3. Ask Christine Anything!

The community asked lots of thoughtful questions and got a bunch of insights only someone with Christine's experience could offer. She's still answering questions asynchronously so feel free to continue asking Qs!

{% link https://dev.to/spang/hi-im-christine-and-i-started-contributing-to-debian-when-i-was-15-now-im-the-cto-of-nylas-ask-me-anything-2hh0 %}

#4. There, I said it. 

Ben shares a personal story of how he overcame his insecurities of being a Rails developer. 

{% link https://dev.to/ben/im-ben-and-i-am-a-rails-developer-1j67 %}

#5. As close to production as possible

Why you might want to run SSL on localhost and step by step instructions on how to do it in Node. 

{% link https://dev.to/remotesynth/running-ssl-on-localhost-42ol %}

#6. You either hate it or love it

Actually, I'm don't think I know anyone who _loves_ to estimate but it appears to be a necessary evil in some organizations. Here's one dev's approach on they make it work.

{% link https://dev.to/lucpattyn/project-estimations-2ie9 %}

#7. A drastic decision

Five reasons why you might want to delete your IDE, and what to do next if you do!

{% link https://dev.to/overopshq/why-i-deleted-my-ide-and-how-it-changed-my-life-for-the-better-hli %}

_That's it for our weekly wrap up! Keep an eye on dev.to this week for daily content and discussions...and if you miss anything, we'll be sure to recap it next Monday!_
CakePHP Controller only for API use
Tags: php, showdev
Published: 2018-04-23 15:53:16

---
title: CakePHP Controller only for API use
published: true
description: A CakePHP 3 plugin for API controllers
tags: php, showdev
---

Hi,

I just wanted to leave this here in case if anyone works with CakePHP 3 framework. It's a plugin written by me, that allows you to "bake" (that means, generate code) a controller only for API use.
This stands for:

1) Left the standard index, view, add, edit and delete
2) Removed every redirect
3) Added the _serialize variable setting


This is the repository:

https://github.com/dcoturel/api_controller

Also, I'm open to contributions. One thing I want to investigate is OpenGl. I think it would be useful to have an endpoint that can work with that specification and retrieve results based on filters.

Saludos,
How to prevent an iOS App Crash?
Tags: blog, appcrash, iosapp, iosappcrash
Published: 2018-04-24 14:19:42

---
title: How to prevent an iOS App Crash?
published: true
tags: Blog,App Crash,iOS App,iOS App Crash
canonical_url: 
---
![](https://www.itfirms.co/wp-content/uploads/2018/04/iOS-App-Crash-7-reasons-why-an-app-crashes-and-how-to-prevent.jpg)
If you are facing the problem of iPad or iPhone apps crashing all the time. Here we have mentioned some tips that help you in preventing crash. You should try them before giving rating the app 1-star. See: [https://www.itfirms.co/check-the-7-reasons-that-fell-behind-an-ios-app-crash-how-to-prevent-them/](https://www.itfirms.co/check-the-7-reasons-that-fell-behind-an-ios-app-crash-how-to-prevent-them/)
How to build a reusable carousel component with Craft CMS
Tags: craftcms, frontenddevelopment
Published: 2018-04-23 12:44:59

---
title: How to build a reusable carousel component with Craft CMS
published: true
description: Learn how to build a reusable carousel component in Craft CMS by using an embed.
tags: Craft CMS, Front-end Development
---

{% youtube e-6bk2VnBCk %}


CONNECT WITH ME:

WEBSITE: https://alexcarpenter.me
GITHUB: https://github.com/alexcarpenter
CODEPEN: https://codepen.io/alexcarpenter
TWITTER: http://www.twitter.com/hybrid_alex
INSTAGRAM: http://instagram.com/alexcarp
Should bugs be discovered in a code review?
Tags: discuss, codereview
Published: 2018-04-23 12:40:13

---
title: Should bugs be discovered in a code review?
published: true
tags: discuss,codereview
---

On a project I've worked on, a lot of effort was put into verifying that the code in the merge request was bug free.
This meant that when doing code reviews one would not just review the code structure, class responsibilities, code readability etc, but also the correctness of the code logic.
In my opinion the code logic and code behavior should be described and documented in the automation tests making the code review all about the code, and not about the business.

I would appreciate your thoughts on this.
Are you aware of the performance capabilities of the system you build?
Tags: discuss, performance
Published: 2018-04-23 10:34:07

---
title: Are you aware of the performance capabilities of the system you build?
published: true
tags: discuss, performance
---

Working on different systems, more often than not I see that the performance capabilities of the system are either not clearly visible and defined or they are completely missing. 
A lot of the developers developing features are not aware of the impact their code does to performance. By Impact I mean visible numbers of the load the system can take that go together with every build.

So the question here is: 

Is performance testing your system a part of the continuous delivery pipeline or is it done as a periodical effort separated of the release process?
What was/is your daily routine to learn a language?
Tags: career, beginners, discuss
Published: 2018-04-23 10:31:45

---
title: What was/is your daily routine to learn a language?
published: true
description: What was/is your daily routine to learn a language?
tags: career, beginners, discuss
---

I trying to make a routine for learn python and django, take some courses online and want to know how you guys dedicate time for this things. Maybe 2hrs for personas projects and coding and 2hrs for courses, video tutorials.

You watch tv shows on your weeks or another hobby like reading books, fresh air, etc.

Thanks for the help
How do you structure your app?
Tags: webapp, discuss
Published: 2018-04-23 09:48:17

---
title: How do you structure your app?
published: true
description: file structure for large web apps
tags: web app, discuss
---

We have a fairly large app currently organized at a high level into view, logic, model, communication, and utils. All files are aliased and we have scripts to handle any moves. For the most part we follow grouping by purpose, but it's still a bear to find things sometimes.

This is the second time our team has taken a shot at reorganizing so I'd love to hear about everyone's experience with this.
###Example:

```
|-view
  |-engine
    |-core
    |-animation
   
  |-feature
    |-featureName
```
Explain Proof of Stake (PoS) like I'm five
Tags: explainlikeimfive, discuss, blockchain
Published: 2018-04-23 08:32:26

---
title: Explain Proof of Stake (PoS) like I'm five
published: true
description: Is Proof of Stake in cryptocurrency better or worse than the traditional  Proof of Work?
tags: explainlikeimfive, discuss, blockchain
---

Explain Proof of Stake...
Magento 2 Image Gallery Extension    
Tags: magento2imagegallery, magento2gallery, magento2photogallery
Published: 2018-04-23 07:57:42

---
title: Magento 2 Image Gallery Extension    
published: true
description: 
tags: Magento 2 image gallery, Magento 2 gallery, Magento 2 photo gallery
---

Magento 2 gallery extension allows you to create a dedicated Magento 2 photo gallery page. It also allows you to display attractive product images on product and category pages. Make use of a bunch of customization options this extension offers for Thumbnail, slider, and lightbox. 

[Magento 2 image gallery](https://marketplace.magento.com/fme-photogallery.html) by FME is fully responsive & multi-store supported. You can attach products to specific products to enhance the sales of those products. You can display images in an attractive slider and change the size of the thumbnail to make it look appealing. 

###Major Features - Magento 2 Image Gallery

Following are some of the features of Magento 2 photo gallery extension.

- Separate Magento 2 photo gallery page
- Photo galleries on product & category pages
- Display images in attractive lightbox.
- Fully responsive
- Multiple configuration options
Reducing stylesheet’s size by 55% and even more
Tags: css, discuss, webdev, react
Published: 2018-04-23 07:08:28

---
title: Reducing stylesheet’s size by 55% and even more
published: true
description: 
tags: css, discuss, webdev, react
---

I think reducing stylesheet's size is one of the top priority tasks we want to do in order to improve our website speed. I noted several approaches to achieve that which I found during this year.

https://medium.com/@MQuy90/how-to-reducing-stylesheets-size-by-55-and-even-more-1ccb944fe108

How do you reduce your stylesheet's size?
Weekly UI Challenge Week 3 Day 1: Design a Results Page
Tags: ui, weeklyui, challenge, design
Published: 2018-04-23 03:12:51

---
cover_image: https://thepracticaldev.s3.amazonaws.com/i/qtg310r1mrgjup6ql7da.png
title: "Weekly UI Challenge Week 3 Day 1: Design a Results Page"
published: true
description: "Week 3 Day 1 of my Weekly UI challenge: Design the component!"
tags: ui,weeklyui,challenge,design
---

Welcome to Week 3, Day 1 of my Weekly UI challenge! Week 3 will focus on a **results page** UI component; each day throughout this following week, I will pick one or two (usually related) subelements of the design to implement. For day one, our goal is to…

## Design the component

I personally used Sketch to design this week's component, but you can use Sketch, a similar UX/UI design program like Adobe XD, or really any other program (or just paper and pen/pencil!) to design your component.

If you decide you would rather not design your own component, you are more than welcome to follow along using my designs, but I think you'd really get the most of it if you designed your own. (plus I'd love to see what you all come up with!)

Here is what my results component will look like, including a number of the component's states:

![A result page component, with a list view and ancillary buttons present](https://thepracticaldev.s3.amazonaws.com/i/3d8rfrn8i29o8lomq7kv.jpg)

This is what the grid view of the component looks like:

![A result page component, with a grid view and ancillary buttons present](https://thepracticaldev.s3.amazonaws.com/i/jkzu0miy8adkolreczzn.jpg)

## Now it's your turn

Hop on those design programs (or get out that pen and paper pad) and design your own **results page**! Below is a calendar of what features I will be implementing on which day, as well as a few resources that may help you.

Also, please add your repos and/or images of your designs in the comments for inspiration! I would love to see what designs you all create.

Happy designing! 🎉

### Week 3 Calendar

1. (Sunday 4/22) Design component 🎯
2. Result entry, sponsored/best seller indicators
3. Grid/list view toggles
4. Sorting
5. Pagination/load more
6. 100% a11y score
7. Tweaks, refactors, fixes

### Resources

* [Best Practices for Search Results](https://uxplanet.org/best-practices-for-search-results-1bbed9d7a311)
* [The basic principles for designing search & results](https://www.deeson.co.uk/blog/ux-series-basic-principles-designing-search-results)
* [7 Rules for Creating Gorgeous UI](https://medium.com/@erikdkennedy/7-rules-for-creating-gorgeous-ui-part-1-559d4e805cda)
* [a11y Project](https://a11yproject.com/) (_great_ resources for creating
  accessible web sites/apps)
Introducing mmarkdown
Tags: javascript, webdev, showdev, productivity
Published: 2018-04-23 01:02:15

---
title: Introducing mmarkdown
published: true
description: Markdown on caffeine.
tags: javascript, webdev, showdev, productivity
---

<img src="https://thepracticaldev.s3.amazonaws.com/i/cj9imhfqpbj965ceysk0.png" />

# Markdown on caffeine.

Have you ever wanted a bit more from your markdown files?

Introducing [Markdown](https://github.com/albinotonnina/mmarkdown).

Mmarkdown takes a plain markdown file and generates a copy of it.

It starts to be less boring when you add [fenced code blocks](https://help.github.com/articles/creating-and-highlighting-code-blocks/) with the language identifier set to `mmd`.

For example:

<img src="https://thepracticaldev.s3.amazonaws.com/i/52pfcbjdc35e8zdhftsb.png" />

will output:

#### Hello Jessie

## How it works

Everything that is returned (as a string) from the code in a block will be interpreted and replaced to the block in the output file.

It's full async, which is cool, _lots of `awaits` are waiting for you_ there but soon enough you will face a problem: too much code to write in a markdown file! Terrible experience!

The solution in mmarkdown is in the `scripts` option. 
You can pass the path of a javascript module in your app to the mmarkdown command.
The module that the scripts file returns will be passed to the context of the fenced block, eg:

This block:

```javascript
//scripts is passed

const array = [1, 3, 5]

const something = await scripts.processMyArray(array)

const myFinalString = something.map(item => '#### ' + item.name)
  .join('\n\n')

return myFinalString
```

and this script file:

```javascript

module.exports = {
  processMyArray: async array =>
    new Promise(resolve => {
      setTimeout(() => {
        resolve(
          array.map(item => ({
            name: item + ' async'
          }))
        )
      }, 1000)
    })
}

```

will output:


#### 1 async

#### 3 async

#### 5 async

(The setTimeout is there just for demo purposes)

### Backup

The `backup` option, false by default, will make a copy of the current output file, postfix it with a timestamp and move it into `backupPath`.

### Can you imagine an use for this?

<img src="https://media.giphy.com/media/6heBQSjt2IoA8/giphy.gif" />

Share it in the comments!

Thanks for reading!

Don't forget to add me on [Twitter](https://twitter.com/albinotonnina) ok? :)
Sharing your Python code
Tags: python, setuptools, setup
Published: 2018-04-24 16:37:20

---
title: Sharing your Python code
published: true
tags: python,python,setuptools,setup
canonical_url: 
---

# Problem

The previous post was to show how I was able to help myself with inline pinyin-ization of text saved in file. But how to share that? I could tell to install requirements using `requirements.txt` file and then run correct script with `python script params`. But.. many of the Python tools are handy just because they are kind of independent tools, you can run in your Bash directly, f.e. `pip`, `pytest` to name just few. I decided to externalize my small module as a setup package. Later on I have hope to put it on the external website for Python modules, thus allowing it just to `pip install ..`.

# Solution

Python comes with `setuptools` package that gives you possibility to package whole folders with all the files needed to run the whole machinery. You can have tests and source files stored in different folders and tied by package. This is exemplary package definition.

```python
from setuptools import setup

setup(
        name='pinmix',
        version='0.1',
        packages=['pinmix'],
        install_requires=['jieba','xpinyin'],
        entry_points={
            'console_scripts':['pinmix=pinmix.cmdline:main']
        }
)
```

We have some of the options available:

- `name`
- `packages`: which folders to include in output package
- `install_requires`: what are required packages installed automatically when package is installed
- `entry_points`: what script will be installed on your Python path to make running of your module easier.

Having entrypoint defined we can run it directly from the command line.

There is one more option to define entrypoint, but this which I used here seems to be easier, and it is fully testable. You can just import the `cmdline` module and test it as you would do with any other module. Project is build and managed by Travis. We will come back to that nice CD tool soon.

# TL;DR

Using setuptools I was able to provide testable small module that you can easilyt integrate with your system and call using short command `pinmix`.
Whole repo is available [here at Github](https://github.com/lukaszkuczynski/pinmix)
Automating the activation / deactivation of Spotify's proxy settings
Tags: hack, spotify, bash
Published: 2019-06-29 15:57:21

---
title: Automating the activation / deactivation of Spotify's proxy settings
published: true
tags: hack,spotify,bash
canonical_url: https://lengrand.fr/automating-spotify-proxy-settings/
---

 ![Automating the activation / deactivation of Spotify's proxy settings](https://images.unsplash.com/photo-1504509546545-e000b4a62425?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjExNzczfQ)

I'm a **BIG** fan of **[Spotify](https://www.spotify.com/)**. I use it every day, hours on end.  
I like the fat client though, I find the web version way too buggy and unstable.  
  
  
  
At ING, we use a HTTP proxy and I have configured Spotify to go through the proxy. At home, I don't use anything.  
This means that every day, I have to go back to my settings, disable / enable the proxy and restart Spotify. This is very annoying.  
  
  
  
So annoying in fact that I started using the web player at home, to my disappointment.  
  
  
  
Finally, it go me tired enough so I decided to dig deeper into the issue and find a solution. **It had to be possible to automate this.**  
  
  
  
The first step was to find the location of the config file. On my Macbook, it is located in **$HOME/Library/Application Support/Spotify/prefs**.  
In this file, I saw the line : **network.proxy.mode=1**.  
The rest is child's play  
  
  
  
Here is the final script I came out with to enable/disable spotify's proxy settings. I called it **spotiProxy**

```
#!/bin/sh

ON_OFF=$1
SPOTIFY_PREFS="$HOME/Library/Application Support/Spotify/prefs"
PROXY_ON="network.proxy.mode=2" #HTTP Proxy
PROXY_OFF="network.proxy.mode=1" #No proxy

if [! -f "$SPOTIFY_PREFS"]; then
    echo "Spotify preference file not found. Exiting"
    exit 1
fi

if ["$ON_OFF" = "on"]
then
    echo "Activating Spotify proxy settings"
    sed -i -e "s/$PROXY_OFF/$PROXY_ON/g" "$SPOTIFY_PREFS"
elif ["$ON_OFF" = "off"]
then
    echo "Deactivating Spotify proxy settings"
    sed -i -e "s/$PROXY_ON/$PROXY_OFF/g" "$SPOTIFY_PREFS"
elif ["$ON_OFF" = "show"]
then
    cat "$SPOTIFY_PREFS"
    exit 1
else
    echo "Invalid command entered. Please use 'spotiProxy on' or 'spotiProxy off'"
    exit 1
fi

number_processes=$(pgrep Spotify | wc -l)
if [$number_processes -gt 1] 
then
    echo "Restarting Spotify"
    osascript -e 'quit app "Spotify"'
    sleep 1
    open -a Spotify
fi
```

It's usage is very simple :

- Call it with `spotiProxy on` (or off)
- It will set you settings accordingly, and restart Spotify if it was already running.
- Enjoy!

This script is run automatically every time I arrive at home or at the office. Nothing to do any more. Joy!

If you want more info, you can check out the related [Spotify forum post](https://community.spotify.com/t5/Desktop-Mac/Script-to-change-settings/m-p/4446246#M531825) or [the gist on github](https://gist.github.com/jlengrand/ec2fff0f741ae0a59a7f203d9ffee348).  
  
  
  
See you next time!

<!--kg-card-end: markdown--><!--kg-card-end: markdown-->
The Cool Kids Write Tests
Tags: test, sqa, web, development
Published: 2018-04-22 20:54:40

---
title: The Cool Kids Write Tests
published: true
description: Why is writing tests still being undermined in practice?
tags: test, sqa, web, development
---

![why does code work](https://i.pinimg.com/736x/ca/47/94/ca4794cfada458717c7aa99093a1f425--computer-humor-computer-science.jpg)

There is a bad stigma to software testing in general. Many developers associate it with [SQA/SDET][1]. They think they have no business writing tests, for that should be left to the goalkeepers. I even know an SQA engineer who reduced himself to not being a real engineer, and there are people who consider applying to SDET positions as easier entry into a prestigious company. These contribute to a false belief that real engineers only build stuff while those who test it are inferior.

The reality cannot be more different. In the open source world, tested code indicates quality and seriousness. Tests can be used as heuristics for the author of the code and everyone else involved. They can be the best documentation to a project and a great overview to the intent or design of a particular code. Moreover, writing test before you write any code (TDD) forcing you to think hard about writing clean, [DOT][2] functions. It also gives the author more sense of ownership than a throwaway code without a single test to back it.

I was asked before why I enjoy writing test (sometime in feigning bewilderment). I do because writing test is an act of hacking. It's a systematic hack to find the optimal solution to a problem and record it efficiently. We do this all the time! We write code, run it, go back to fix some error, run it again, and return to writing more code. Thing is we do this countless times without structuring our approach or automating it. For example, we may have fixed a bug and successfully run our code after great effort, but months later we might get ourselves into the same situation again and we will have to go at it like before--brute-force debugging--because we did not bother to write any test case to record the finding the first time. Writing tests is liberating. It's the real cool.



This is not to say we are required to write test for every function in our code or have to become obsessed with test coverage. But you should certainly not refrain from writing test because you don't have time or you want to [move fast and break things][3]. Because when things break they often take much more time and energy and make you feel terrible and enjoy coding much less.


[1]: https://en.wikipedia.org/wiki/Software_Development_Engineer_in_Test
[2]: https://blog.codinghorror.com/curlys-law-do-one-thing/
[3]: https://mashable.com/2014/04/30/facebooks-new-mantra-move-fast-with-stability/#6UkgK3l0rPqj