teleren/devto huggingface dataset:
Cleaning Up Your Code: Consistent Formatting
Tags: programming, beginners, productivity, coding
Published: 2017-12-30 01:25:58

---
title: "Cleaning Up Your Code: Consistent Formatting"
published: true
description: Stop the debates on tabs vs. spaces!
tags: #programming, #beginners, #productivity, #coding
---

This is an excerpt from my article ["Cleaning Up Your Code" on Medium](https://medium.com/acm-ucr/cleaning-up-your-code-8c2a88cb47fc). I'll be publishing each section daily, read ahead on Medium!

An age-old debate: tabs or spaces? Braces on the same line or new line?

I’m not going to suggest any specific formatting, but I do want to expose you to some guidelines on deciding formatting for your project. First and foremost, once you’ve found a method of formatting to use, **stick to it**.

There’s two steps to getting most of the way to a perfect style guide for your project.

* **Pick a popular style guide for your language**. Picking a style guide that more people have been exposed to will reduce the time a new contributor focuses on syntax and more time on making meaningful contributions to your code. Examples are included below.
* **Make slight variations to it for your specific use cases**. If a certain point in your chosen style guide doesn’t make sense for your use case, document it. (Ideally in a CONTRIBUTING.md file!)

[Airbnb Style Guide for Javascript](https://github.com/airbnb/javascript)
[Google Style Guide for C++](https://google.github.io/styleguide/cppguide.html)
[PEP8 Style Guide for Python](https://www.python.org/dev/peps/pep-0008/)

If you're working in Javascript, I highly recommend using [Prettier](https://prettier.io/) to automatically handle the formatting for you! I use the [JsPrettier Package for Sublime Text](https://github.com/jonlabelle/SublimeJsPrettier).


Thanks for reading! How do you enforce consistent code-style in your projects?
create RestAPI for your python scripts using Flask with 15 line of code 😎
Tags: python3, flask, restapi, python
Published: 2017-12-30 00:45:54

---
title: create RestAPI for your python scripts using Flask with 15 line of code 😎
published: true
description: i'll create a simple script that sum two numbers and we will create rest api for that script cheers
tags: python3, flask, RestAPI, python
---
## Creating virtualenv for save working
-if you don't have virtualenv installed do it using `pip install virtualenv`
-execute the following :-
`mkdir flask-safe-env`
`virtualenv .`
`Scripts/activate` if you have any problem executing the activate script check this <a href="https://virtualenv.pypa.io/en/stable/userguide/#admonition note">LINK</a>
`mkdir rest-api`
`cd rest-api`
-install the required packages for this app by using 
`pip install flask`
`pip install flask-restful`
OR if you have the github repo run `pip install -r requirements.txt`
## Creating the project files
we can make all of the application in one script but for adding more reliability to the project we will create the sum function in a another script called sumTwoNumbers.py and import it in the app.py script to use it.

#### sumTwoNumbers.py
simple enough create a function that accepts two parameters and return the sum of the two numbers
```python
def sumTwo(a, b):
	return int(a)+int(b)

```
#### app.py
we create instance of the flask app and the api module and then we add the route that accepts two params in the url using GET request we will call the function from the sumTwoNumbers script
```python
import sumTwoNumbers
from flask import Flask, request
from flask_restful import Resource, Api

app = Flask(__name__)
api = Api(app)
 
class sumNumbers(Resource):
    def get(self, first_number, second_number):
        return {'data': sumTwoNumbers.sumTwo(first_number,second_number)}

api.add_resource(sumNumbers, '/sumtwonumbers/<first_number>/<second_number>')

if __name__ == '__main__':
     app.run()
```

-to run the app execute the command `python app.py`
-go to <a href="http://localhost:5000/sumtwonumbers/10/60">http://localhost:5000/sumtwonumbers/10/60</a> you can replace the numbers with the one you want

you can find the project files here : <a href="https://github.com/aa-ahmed-aa/Flask-RESTAPI">Sweet-github</a>
How to be a Front-End Superstar
Tags: webdev, discuss, beginners
Published: 2017-12-29 19:20:24

---
title: How to be a Front-End Superstar
published: true
description: A request for resources to be the best front-end developer you can be!
tags: #webdev, #discuss, #beginner
---

Hi! I'm Mackenzie, a web dev dedicated to getting better any way I can. I want to start of 2018 with a bang, so I'm here to ask for help with that! 

What are your favorite go-tos for front end development? Cheat sheets, references, a solid piece of documentation-- I want to know how a senior dev pursues a problem and fixes it. 

I'm looking for anything from a description of a thought process to a list of resources that you've found helpful in your work!
What's your favorite Editor theme? 
Tags: discuss, atom, theme, programming
Published: 2017-12-29 17:21:48

---
title: What's your favorite Editor theme? 
published: true
tags: discuss #atom #theme #programming
---
I'm an Atom fanatic even though it consumes a lot of RAM 😂. So what's your favorite Atom theme? 

I used atom-material-ui previously. 

I'm currently using GitHub light.
Webpack plugin to keep your bundle size in check
Tags: javascript, webpack, performance, development
Published: 2017-12-29 15:24:04

---
title: Webpack plugin to keep your bundle size in check
published: true
description: Webpack plugin to keep you bundle size in check. Visit https://github.com/HarshwardhanSingh/webpack-bundle-size-check-plugin for more info
tags: javascript, webpack, performance, development
---

Check out this webpack plugin to keep you bundle size in check. Visit https://github.com/HarshwardhanSingh/webpack-bundle-size-check-plugin for more info
Convert your existing web applications into native iOS & Android apps.
Tags: development, nativeapps, androidapps, iosapps
Published: 2017-12-29 15:04:08

---
title: Convert your existing web applications into native iOS & Android apps.
published: true
description: convert your existing web applications into native iOS & Android apps.
tags: development, native apps, android apps, IOS apps
---

[Zeroqode](https://zeroqode.com/) is about to present you an awesome way to convert your existing web applications into native iOS & Android apps. [Sign up to get early access](https://www.producthunt.com/upcoming/zeroqode-native-apps) before we launch on Product Hunt!
What I've learned about technical interviews and job search
Tags: interview, tips, career
Published: 2017-12-29 07:51:47

---
title: What I've learned about technical interviews and job search
published: true
description: This are some points what I've learned about the technical interviews
tags: interviews, tips, career
---

I've been working since 6 years ago and one of the things that I've suffered is being rejected from good job offers because my technical level. Now this is frustrating because you know that you can handle with the resposibilities of the job, but when you are on the technical interview is difficult to demonstrate. So here are some tricks that I've learned.

##Don't be afraid#
Everybody is always scared. And when you need to answer something that you don't know, or you feel no confidence of your skills, this is demonstrated in the way we talk. But don't be afraid to tell "I don't know" or talk about something you know. If you commit a mistake is not a proof of you lack of knowledge. Nobody can master 100% a technology.

##Write everything you don't know#
After a time, I started to do this trick. Why? Because sometimes this knowledge was frecuently asked by other interviewers. So I started to annotate any concept that I didn't know to research it later.

##Plan your interview#
When you're working, taking interviews is very difficult. Commonly I requested the interviews after my work time, but many times the interviewers can only during the work hours. So in those cases is necessary plan your schedule for the interview. Maybe during the lunch time or in the afternoon when you don't have too much meetings. Also find a place in your work where you can take the call with no problems.

##Always request the requirements of the job#
Many times I've received job offers that sound great, but when I was on the interview, I didn't know many of the questions and that was because I didn't know the technology. So always ask about the job requirements.

##Check your resume#
Your resume must be always the honest vision of your professional background. If you add that you know a technology, you must know that technology, or don't add that to you resume. What you add to your resume, are the weapons that you give to the interviewer for test your knowledge.

##And finally, see the current job offers#
In this times, you must be updated about the technologies that we must use. And with many technologies, we need to be sure that what we're learning is valuable in a company. The job offers gives you an idea of what you should be learning.

Finally, sorry for my english. I'm non-english-native speaker so if you have any comment, please help me to improve my language skills.
The ES6 way to make simple immutable Object hiding properties inside
Tags: javascript
Published: 2017-12-28 23:46:58

---
title: The ES6 way to make simple immutable Object hiding properties inside
published: true
description: The ES6 way to make simple immutable Object hiding properties inside
tags: javascript
---

It's basically good to keep objects immutable for FP and also to make some properties private as long as we are going to enjoy benefits of OOP. To make immutable dict encapsulating properties, now we have 2 options: Symbol and WeakMap which were introduced as new features of ES2015.

So, I made experimentally some models, without any thought of performance though. Would be glad to hear your comments!

{% gist https://gist.github.com/shqld/ba16551a67544ca6893149e5930f92b5 %}
How I build components in CraftCMS with Twig
Tags: craftcms
Published: 2017-12-28 21:56:49

---
title: How I build components in CraftCMS with Twig
published: true
description: In this screencast, I walk you through how I build components for my website in CraftCMS with Twig.
tags: craftcms
---

{% youtube FNIM8MvUL-Q %}

In this screencast, I walk you through how I build components for my website in CraftCMS with Twig.
Revisit old materials with new perspectives
Tags: career
Published: 2017-12-28 20:53:01

---
title: Revisit old materials with new perspectives
published: true
description: 
tags: career
---

I read Sandi Metz' popular book [Practical Object-Oriented Design in Ruby](https://www.amazon.com/Practical-Object-Oriented-Design-Ruby-Addison-Wesley/dp/0321721330) several years ago. While I took some things away, I was a bit too green to really draw a lot of value. I recently picked it back up and I'm glad I did. Old ideas are now so much more actionable. I found myself hanging on word for word this time instead of picking at an idea here and there.

Revisiting places you've been before is a great pattern for a software development career. The second time around is golden.

I had the same feeling when I revisited some old code in order to change a website I had not seen in years. It was all my code, but it was like it had been written by a different person.

I hope you too find an old place to visit this new year.

Happy coding ❤️
Cleaning Up Your Code: Abstracting Reused Code
Tags: coding, productivity, beginners, programming
Published: 2017-12-28 19:39:55

---
title: "Cleaning Up Your Code: Abstracting Reused Code"
published: true
description: "You can write clean code, but you shouldn't have to write it again!"
tags: #coding, #productivity, #beginners, #programming
---

This is an excerpt from my article ["Cleaning Up Your Code" on Medium](https://medium.com/acm-ucr/cleaning-up-your-code-8c2a88cb47fc). I'll be publishing each section daily, read ahead on Medium!

If you’ve found pieces of code in your codebase that are heavily duplicated or rely on the same logic, they are probably great contenders for abstraction.

Abstracting code into a separate function or class can help reduce code complexity. If your algorithm related to that block of code changes, you only have to change it in one place versus changing it in multiple places across your codebase.

What does a good abstraction look like? Well let’s take [our example from earlier](https://dev.to/aarohmankad/cleaning-up-your-code-good-names-2e0o). The `great_names.cpp` file is really easy to read! However, we would have to rewrite that code block if we ever wanted to find a cell based on a different `FLAG_CODE` or in a different `gameBoard`. So let’s move that code into an isolated function.

{% gist https://gist.github.com/aarohmankad/df3803b19d15c78df6333c49e0fb5df4 %}

Before you decide to start splitting your code apart, here are some things to keep in mind:

* **Keep your functions small**: A small function is easy to read, but also very easily reused. Your function should be able to be used for a wide variety of use cases, not just the one case it used to be in.

* **Limit the functionality**: If your code does more than one exact thing, it will be difficult to use it across your codebase. Continue splitting your code until your functions have only one purpose each.Then you can implement a function to call these smaller functions in any way you wish!

* **Ensure no side effects**: A function should be thought of as a walled off piece of code that you control. It should purely accept input and return output. A *pure* function is a function that does not affect any code it does not have direct access to. A simple example would be an impure add function that adds two variables outside of its scope. This is very hard to keep track of and should be avoided in most situations.

Thanks for reading! What are your approaches to breaking up reusable blocks of code?
Weird @extend side effects
Tags: css, sass, webdev
Published: 2017-12-28 18:56:33

---
title: Weird @extend side effects
published: true
description: Friends don’t let friends use @extend.
tags: #css #sass #webdev
---

I have this project that's using Bootstrap. Instead of importing the CSS and expanding the styles with my own, I'm importing the Sass styles and compiling to a single CSS file. It was upon doing so that I noticed something strange.

Bootstrap defines a button class like so (code snipped for brevity, because my focus is on the selectors):

```scss
.btn {
  // styles
}
```

Some of my own styles were using the Sass directive `@extend` for a form input button:

```scss
.search-form .search-submit {
  @extend .btn;
  @extend .btn-secondary;
}
```

Elsewhere, I had some link-specific styles that I wanted to make sure _didn't_ get applied to the `.btn` class:

```scss
a:not(.btn) {
  // styles
}
```

Once I compiled to CSS, however, I wasn't seeing those link-specific styles being applied. Instead, this is what was output to my stylesheet:

```css
a:not(.btn):not(.search-form .search-submit) {
  /* styles */
}
```

This was due to my use of `@extend` in on the submit button. So I copied Bootstrap's button class definitions into a mixin in my own stylesheet, and changed the input button's styles to this:

```scss
.search-form .search-submit {
  @include button;
  @include button-variant($secondary, $secondary);
}
```

Once I made that change, the output to my stylesheet was as I expected:

```css
a:not(.btn) {
  /* styles */
}
```

Note: the `button` mixin is mine. The `button-variant` mixin already exists within Bootstrap's code.

----

_This was originally published on [eichefam.net](https://eichefam.net/2017/12/28/weird-extend-side-effects/)._
Where is Bucky Roberts of TheNewBoston ?
Tags: discuss, bucky, programming, tutorials
Published: 2017-12-28 17:56:26

---
title: Where is Bucky Roberts of TheNewBoston ?
published: true
tags: discuss #bucky #programming #tutorials
---
Anyone know about Bucky's tutorials? He's so Cool and I always loved em. But he's missing for a long time now. Does anyone really know about it? I couldn't find anything on Google
Symfony Tutorial: Building a Blog (Part 1)
Tags: php, symfony
Published: 2017-12-28 17:15:01

---
title: "Symfony Tutorial: Building a Blog (Part 1)"
published: true
description: Let's create a secure blog engine with Symfony.
tags: #php, #symfony
canonical_url: https://auth0.com/blog/symfony-tutorial-building-a-blog-part-1/
---

Symfony is a PHP framework as well as a set of reusable PHP components and libraries. It uses the Model-View-Controller design pattern and can be scaled to be used in any requirement. It aims to speed up the creation and maintenance of web applications, replacing repetitive code.

In this tutorial, we’ll show you how to create your very own blog, with content stored in the database and authentication through [Auth0](https://auth0.com/).

[Read more 🎼](https://auth0.com/blog/symfony-tutorial-building-a-blog-part-1/?utm_source=dev&utm_medium=sc&utm_campaign=symfony_blog)
Celebrate this New Year with 30% discount on all no-code templates from Zeroqode!
Tags: webdev, apps, nocode, templates
Published: 2017-12-28 15:18:02

---
title: Celebrate this New Year with 30% discount on all no-code templates from Zeroqode!
published: true
description: 30% discount on all no-code templates from Zeroqode!
tags: web development, apps, no-code, templates
---

Starting today and until 8th of January 2018 we are offering [30% off all our templates](https://blog.zeroqode.com/celebrate-this-new-year-with-30-discount-on-all-no-code-templates-from-zeroqode-771af97ec066) to give your Big Idea a jumpstart in 2018!

Make sure you don’t miss it now! Enjoy 30% OFF all templates & [build your app](https://zeroqode.com/) in 2018.*
An automated API generation for the IntelliJ platform
Tags: allgemein
Published: 2018-11-16 20:57:40

---
title: An automated API generation for the IntelliJ platform
published: true
tags: Allgemein
canonical_url: 
---

If you haven’t noticed: I already [published a plugin for the IntelliJ platform](https://plugins.jetbrains.com/plugin/9958-shell-filter) of IDEs by [Jetbrains](https://www.jetbrains.com/). Developing for the IntelliJ platform is sometimes a bit hard, because I’m used to have a API-documentation for reference, but somehow Jetbrains didn’t provide one for the platform.

Looking at their [sources over at github](https://github.com/JetBrains/intellij-community), I found, that their code is actually quite well commented using [Javadoc](https://docs.oracle.com/javase/9/javadoc/) comments in most parts, so generating an API documentation shouldn’t be _that_ hard.

That’s what I thought at least.

But, well, Javadoc’s a b***. It comes along with the JDK, so there’s the first problem: What JDK? Oracle? OpenJDK? 8? 9? I started writing on a Mac with a recent Oracle JDK 8 and got everything running quite quickly. To automatically generate the doc every night, I thought that using [Travis](https://travis-ci.org) would be a great idea (hint: it is!). Travis, however, uses the same JDK, but on a linux agent, which somehow produced a different result.

To fix problems with different platforms, I wrapped all up in a docker container.

_But a good I/O performance for a fairly large group of files using Docker for Mac? Yeah, sure._

Docker for Mac, which is using [HyperKit](https://github.com/moby/hyperkit) for its Linux-Docker Host, is extremely bad when it comes to I/O performance (Docker really works best in an all-Linux environment). However, I wrapped something up using [docker-sync](http://docker-sync.io), but found out, that it’s really a niche solution for macOS. So, I ended writing a macOS-docker solution and a linux solution.

_But an up-to-date Oracle JDK as a docker container? Yeah, sure._

Automating the installation of an Oracle JDK is _hell_ and there’s no official or even up-to-date Docker image available. So instead, I used the nice [OpenJDK image](https://hub.docker.com/_/openjdk/). I used the Javadoc from that one, but couldn’t get it to produce an output, when there’s a library missing (the other javadoc simply skipped that missing library). So, finally, I ended up with telling the javadoc of OpenJDK 9 to use the old javadoc implementation using the -Xold

It works now and we have a [daily generated API doc](https://dploeger.github.io/intellij-api-doc/) (see the [generator code over at github](https://github.com/dploeger/intellij-api-doc)), although I’m not quite sure how stable the system is. So, keep your fingers crossed.
[Question] Are we still doing 'native' browser plugins in 2017/2018?
Tags: help, browser, plugin, discuss
Published: 2017-12-28 13:05:51

---
title: "[Question] Are we still doing 'native' browser plugins in 2017/2018?"
published: true
description: Back in the day, Unity3D had a Web Player browser plugin. Do these type of plugins still exist?
tags: help, browser, plugin, discuss
---
##### In this post I use the term _native browser plugin_ for lack of a better term in my vocabulary.

Today I was talking to someone about Unity, a popular game engine. I'm not into games but I remember Unity had a 'web player' plugin for the browser, probably extending the browser to do things it can not do by itself. 

I was asked if nowadays there is any recommended standard when it comes to creating plugins like that. Perhaps something consistently implemented by multiple browsers. I had no answer but figured there probably is such a thing so went to go look for one.

When I Googled this Unity web player I discovered that things have changed.

> The Unity Webplayer is no longer supported. We provide this download link to the last build for convenience, but be aware that the Unity Webplayer has been deprecated and will not get any further update.
> If you want to deliver Unity made content via web browser we recommend you use [Unity WebGL](https://docs.unity3d.com/Manual/webgl-building.html?_ga=2.248040711.126513079.1514464857-1018779806.1514464857).


#### Do we still create 'native' plugins for the browser or is this considered universally deprecated? Are there any standards? What do you call these type of plugins and where do I find more information? If 'native' plugins are indeed not the way to go, does that mean we are limited to using only functionality supported by browser extensions? 

I am very curious about this and am looking forward to reading your answers.