teleren/devto huggingface dataset:
Use the Source Luke! How to Write Clean Code for Interviews
Tags: opensource, beginners, computerscience
Published: 2019-06-14 22:40:06

---
title: Use the Source Luke! How to Write Clean Code for Interviews
published: true
description: Interview Prep.  Getting answers from Source. 
tags: opensource , beginners, computerscience
---


I'm helping a friend prepare for interviews, and there are a lot of resources to practice algorithms & data structures. 

Eventually it's just you and the board, and you have to write clean code. 

Often you know the algo well, but while on the board you stumble iterating a pointer -- a little detail that undermines your confidence. 

The question for me was : "when doing binary search, do you set the pivot to the ceil or floor of the midpoint?"

My answer, as usual: "use the source!"

Here's `bsearch` from [linux src](https://github.com/torvalds/linux/blob/master/lib/bsearch.c).  (I first recommended glibc -- but this one is easier to read--i don't judge)

```
// SPDX-License-Identifier: GPL-2.0-only
/*
 * A generic implementation of binary search for the Linux kernel
 *
 * Copyright (C) 2008-2009 Ksplice, Inc.
 * Author: Tim Abbott <tabbott@ksplice.com>
 */

#include <linux/export.h>
#include <linux/bsearch.h>
#include <linux/kprobes.h>

/*
 * bsearch - binary search an array of elements
 * @key: pointer to item being searched for
 * @base: pointer to first element to search
 * @num: number of elements
 * @size: size of each element
 * @cmp: pointer to comparison function
 *
 * This function does a binary search on the given array.  The
 * contents of the array should already be in ascending sorted order
 * under the provided comparison function.
 *
 * Note that the key need not have the same type as the elements in
 * the array, e.g. key could be a string and the comparison function
 * could compare the string with the struct's name field.  However, if
 * the key and elements in the array are of the same type, you can use
 * the same comparison function for both sort() and bsearch().
 */
void *bsearch(const void *key, const void *base, size_t num, size_t size,
	      int (*cmp)(const void *key, const void *elt))
{
	const char *pivot;
	int result;

	while (num > 0) {
		pivot = base + (num >> 1) * size;
		result = cmp(key, pivot);

		if (result == 0)
			return (void *)pivot;

		if (result > 0) {
			base = pivot + size;
			num--;
		}
		num >>= 1;
	}

	return NULL;
}
EXPORT_SYMBOL(bsearch);
NOKPROBE_SYMBOL(bsearch);

```

`num>=1` -- a bitshift equivalent to floor(1/2 * n) -- faster and cleaner!


When searching for answers to these little details, use the source: stable mature repos used by millions.  

* [linux sources](https://github.com/torvalds/linux/blob/master/lib/bsearch.c)
* [glibc](https://code.woboq.org/userspace/glibc/bits/stdlib-bsearch.h.html)
* [boost c++](https://github.com/boostorg/core)
* the standard lib for your platform e.g. [python](https://github.com/python/cpython/tree/master/Modules), nodejs, etc


Each one of these is a goldmine for thousands of tricks when writing code.  Clone them locally and `ack` them before you google.
I used to be an engineer on the railroad, now I engineer software, Ask Me Anything!
Tags: ama
Published: 2019-06-14 21:59:23

---
title: I used to be an engineer on the railroad, now I engineer software, Ask Me Anything!
published: true
tags: ama
---
Hi! I am Sam. I have had the dream of being in tech since I was little, but different life events happened and I didn't pursue my dream until what I consider late. I tried multiple times to learn to code and failed, I even dropped out of college while I was enrolled for CS. 

I eventually went to work for BNSF (the big orange trains) as a conductor, and then became an engineer (the one who drives the train, not the same type of engineer). After 4 years, I got laid off. I decided while I was unemployed that it was time for a change. So I learned to code, and now three plus years later, I am an engineer with the R&D team at RE/MAX.

![Train air gauge, railroad spike, pocket watch, BNSF award, and three locomotive reversers](https://thepracticaldev.s3.amazonaws.com/i/kbm6hd3l92tknwedr3rm.jpeg)

I keep these in the window above my desk at home. They are there to remind me of where I came from. To remind me that complacency is not ok. To remind me to keep pushing forward every day. I have a motto and it is cliche, but if I can do it, so can you.

I want to be an advocate for others trying to break into our industry. I have been so blessed by this move, and I want nothing more than to see others reach the same goal. So please ask me anything, I would love to get to know you!
ISO a Great JS Book from Browser Perspective (not frameworks or Node JS/Express
Tags: javascript, browseronly
Published: 2019-06-14 21:55:00

What is a great book recently published (since at least 2017) that covers ins and outs of Javascript from a browser perspective?

I'm not looking for books on JS frameworks or how to program with NodeJS necessarily but something that might help me how to understand the DOM better for example. I realize there are also some old books on this subject but I am looking for something from the last 2 years or so.

Thanks for the help!

-JN
Always Be a Beginner! Cultivating a Beginner's Mindset
Tags: development, selfimprovement, growthmindset, productivity
Published: 2019-06-14 20:38:07

---
title: Always Be a Beginner! Cultivating a Beginner's Mindset
published: true
description: Shoshin (初心), the Japanese word for a beginner’s mind, comes from Zen Buddhism. A beginner’s mind is a psychological mindset where you open yourself to new ideas by letting go of all preconceived notions. When a beginner’s mind sees a subject, it’s as if it is experiencing the subject for the first time.   
tags: development, self-improvement, growth-mindset, productivity
canonical_url: https://rizwan-javaid.squarespace.com/blog/2019/6/14/always-be-a-beginner-cultivating-a-beginners-mind
cover_image: https://static1.squarespace.com/static/53bf1d9ce4b0974b49e0da7f/t/5d03ff6a546f150001b322be/1560543087839/med-badr-chemmaoui-630239-unsplash.jpg
---

#Always be a beginner! Cultivating a Beginner’s Mind

>“It is not difficult 
>to keep a beginner’s mind. 
>There are many possibilities in a beginner’s mind, 
>but in the expert few. ”
>— Suski Roshi

Shoshin (初心), the Japanese word for a beginner’s mind, comes from Zen Buddhism. A beginner’s mind is a psychological mindset where you open yourself to new ideas by letting go of all preconceived notions. When a beginner’s mind sees a subject, it’s as if it is experiencing the subject for the first time.   

Let go of self-centered thoughts. 
Let go of limiting beliefs.
Let go of achievement.
Let go of expertise.

Begin to see things with an eagerness to understand.
Begin to see things with compassion.
Begin to see things with curiosity.
Begin to see things with wonder.

How can you apply a beginner’s mind to a task?
- Be present in the moment. Don’t think about your past experiences, instead focus on what you see at that very moment.
- Pretend you are a student learning for the very first time.
- Be curious about every small detail. Take the time to be present with the task and simply observe.
- Stop judging! Look for the positive instead of pointing to what is wrong. Stay in exploration mode and consider all options no matter how simple or difficult they are.

**Want to learn more?**
Here are some resources to help you as you adopt a beginner’s mind.

[Zen Mind, Beginner’s Mind](https://amzn.to/2RhBzOS) by Shunryu Suzuki
[How to Adopt a Beginner’s Mind to Accelerate Learning and Increase Creativity](https://scottjeffrey.com/beginners-mind/) by Scott Jeffrey
The hurry to learn and the self-learning process
Tags: beginners, css, html, javascript
Published: 2019-06-14 20:28:32

I started learning to code not long ago, at sometime in October last year. That means that I have been studying for 8 months.
Now, I must confess that I often feel hopeless. 
My dream to become a developer and start working in the area feels far away and just a dream.
At the moment, I know my way around HTML and CSS pretty well and I am in the very first steps of real programming with JavaScript. 
Nothing as cool as all the code I see in my favorite TV show lol (Mr. Robot <3)
But also, a college student usually takes 4 years to graduate... 4 years!
Why in the 7 kingdoms would I believe to be ready for the market in 8 months of self-study?
[ANN] Global Day of Coderetreat 2019 en español.
Tags: spanish, event, announcement, gdcr
Published: 2019-06-14 20:18:12

---
title: [ANN] Global Day of Coderetreat 2019 en español. 
published: true 
description: ¿Quieres participar en el mayor evento de desarrolladores del mundo? 
tags:
- spanish
- event
- announcement 
- gdcr
---

El coderetreat consiste en pasar todo un día mejorando nuestras habilidades técnicas, sin tener que preocuparse de la presión y la rutina diaria. En 2019 hace 10 años del primer coderetreat y en estos años miles y miles de personas han participado. 

Como parte de los preparativos del Global Day of Coderetreat (coderetreat.org) este año vamos a organizar una sesión de Q&A en español sobre el coderetreat en general y sobre el Global Day of Coderetreat 2019 en particular. 

Cualquier persona que quiera participar es  bienvenida, sin importar el nivel técnico o el conocimiento previo. Cuanto más variado sea el grupo en un coderetreat mejor será la experiencia.

Ya sabes, si quieres aprender más sobre coderetreat, o quieres participar en el Global Day of Coderetreat junto a miles de personas a lo largo de más de 100 ciudades en todo el mundo. Te espero el martes (18/06) para charlar sobre lo fácil que es participar. 

https://www.meetup.com/Coderetreat-Training/events/262230523/
Advanced Bundler
Tags: ruby, bundler, jruby
Published: 2019-06-14 18:56:15

The following will be a (hopefully often) updated article with tricks to help utilize Bundler to its fullest.

### DRY multi-platform gemspecs (2019-06-14)

- Note the `.dup` call after loading the common specification.  This is important as Bundler actually loads all (`*.gemspec`) files and Rubygems caches the results of `eval`ing a `Gem::Specification.load` call.  Without the `.dup` this means you'll end up modifying the same spec instance for every custom gemspec you want to have.

##### gemname.gemspec.common
```ruby
Gem::Specification.new do |gem|
  gem.authors     = ["Phil Schalm"]
  gem.email       = ["notmyrealemail@nowhere.com"]
  gem.description = "Sample"
  gem.summary     = "Longer sample"
  gem.files       = %w[gemname.gemspec gemname-java.gemspec gemname.gemspec.common Gemfile]

  # Common dependencies here
end
```

##### gemname.gemspec
```ruby
Gem::Specification.load(File.expand_path("gemname.gemspec.common", __dir__)).dup.tap do |gem|
  gem.instance_exec do
    self.name = "gemname"
    # 'Everything else' specific dependencies here
  end
end
```

##### gemname-java.gemspec
```ruby
Gem::Specification.load(File.expand_path("gemname.gemspec.common", __dir__)).dup.tap do |gem|
  gem.instance_exec do
    self.name = "gemname-java"
    # Java specific dependencies here
  end
end
```

##### Gemfile
```ruby
source 'https://rubygems.org'

gemspec name: RUBY_PLATFORM == "java" ? "gemname-java" : "gemname"
```
Introducing CodeThat.today 🙌🍾
Tags: showdev, coding, webdev
Published: 2019-06-14 18:50:07

---
title: Introducing CodeThat.today 🙌🍾
published: true
description: Introducing my technical tutorial site.
tags: showdev, coding, webdev
---

I would like to introduce CodeThat.today, a site that hosts, a variety of coding and developer tutorials, articles and series that consists of more than one related content. I have been working on this project for a while as I always wanted to have my own tech space where I can share my articles. I'm super excited about that. Allow me to explain why I did it and how.

# Why I built the site

I started authoring articles on Medium about 2 years ago, mainly with Codeburst.io. In the beginning it was OK, as I had some successes with the [SOLID Principles series](https://codeburst.io/understanding-solid-principles-dependency-injection-d570c15560ab). However, I did't like that model that Medium offered. You don't really have control of anything. It's a cauldron of articles that get mixed up in a soup.

In addition, I started writing articles with Fixate and PhraseApp and have them listed in various places around the Web. At some point I wanted to consolidate them in one place, so I can reference them better. Incidentally, I forgot to mention I authored a [Video Course in Go](https://www.packtpub.com/application-development/advanced-go-programming-7-days-video) also.

So migrating them in one platform so I can promote my content I think it's the best choice.

# Cool, What do you plan to write?

I have a trunk-load of topics that I want to write, but I wanted to create this site first and then start writing content. Also, I will be crossposting it here on dev.to for reference.

# How did you build it?

I used Hugo and for a good reason. It's more straightforward to convert a HTML theme (jQuery etc.) from plain files to Hugo templates than using Gatsby. I started with Gatsby but I couldn't barely make jQuery work. I squandered so much time with this I thought it was not worth it. I wanted convention over configuration. Sorry Gatsby...

# About the platform

The site is located at [codethat.today](https://codethat.today). I have the whole site hosted on [Github](https://github.com/theodesp/codethat) however it's a little bit rough right now. I would need to write a readme and polish it up a little bit. But if you want to use it for your own means, feel free.

# Do you accept new authors?

Yes. Needless to say. I need adding a new page for authors on-boarding, but in the meantime if you want to contribute send me a message here.

I would also like reimbursing authors with monetary or swag items whenever I can. It's because I believe that producing quality content takes time and time is limited - we only have one life don't we? The site can accept ads from sponsors so that they can help fund new authors content.

So what are you waiting for?
How do you organize your projects?
Tags: discuss, showdev
Published: 2019-06-14 17:58:21

---
title: How do you organize your projects?
published: true
description: Where do you keep your side projects and portfolio?
tags: #discuss, #showdev
cover_image: https://images.unsplash.com/photo-1496171367470-9ed9a91ea931?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80
---

I've been working on a lot of side projects or small apps lately, and I feel like they're all just scattered about - between Codepen, Glitch, Netlify, my own webhost, etc.

It's made me wonder how other people organize or keep track of their apps, and what the best way to kind of "clean up" after myself is!
How to read more books 📚
Tags: books, tips, learning
Published: 2019-06-14 17:46:00


[Image credit - [pixabay](https://pixabay.com/images/id-3723751/)]

In part 1 of these series, I shared my experience on how I've started to read software development books on a regular basis.

{% link https://dev.to/lightalloy/learning-to-love-software-development-books-5e4 %}

In this post, I would like to share what helps me to find time and motivation to read.

## Find out if you really need it at the moment
Reading technical books requires time and mental energy, especially if the topic is new to you and/or you read in a foreign language. Sometimes it's more valuable to have more practice or incorporate other learning styles in your schedule. Maybe you just have other priorities in life at the moment, and that's ok.

If you choose to start reading more:

## Set a quantifiable goal
The first thing that worked for me was setting a goal. First, it was 10 pages a day. That's not much, but still, you can read a book in 1 to 2 months this way, which already brings a lot of value. Even 5 pages a day will make a difference.

{% link https://dev.to/hitman666/the-math-behind-reading-30-books-per-year-39g %}

Though I admit that it usually takes me more than 5 minutes to read and comprehend 5 pages. You can also use a time goal, e.g. 30 minutes a day, it will allow having a more predictable schedule.

## Schedule a specific time to read
I found that it's most effective for me to read in the morning before starting to work. However, it affects my productivity during the day, I can achieve more if I start working right after finishing my morning routine without reading. But sometimes it's still worth it, I try to alter my schedule a bit every once a while.

Many people find it convenient to read while commuting or when they have small pieces of time, like while waiting in a queue. Personally, I find it much harder to concentrate in such circumstances, so I prefer reading books by the computer. This way it's easier to focus, take notes or try out the code. When I have several spare minutes, I'll rather read a blog post. Sometimes I can only afford to read in a distracting environment or right before sleep, and it's still better than nothing.

## Participate in a book club
It may be hard to find a relevant one or organize it. But if you do, it will be a huge motivation to keep reading. Discussing helps a lot with comprehension and remembering what you've read.

## Track the books you've read
I like keeping the lists of books I've read and that I plan to read, it kind of helps me to read more.
I still can't choose between [Goodreads](https://www.goodreads.com/user/show/73509440-anna-buianova) and [Livelib [ru]](https://www.livelib.ru/reader/lightalloy), and use both of them.

Please, share what helps you to read tech books.
🔖 Bookmarklets Manager Chrome Extension!
Tags: dev, opensource, showcase
Published: 2019-06-14 17:06:43

---
title: 🔖 Bookmarklets Manager Chrome Extension!
published: true
description: A Chrome Extension to manage bookmarklets with the monaco editor (the VSCode Editor!)
tags: #dev #open-source #showcase
---

All info you need to install is here:

{% github ahmed-musallam/chrome-bookmarklet-manager %}


This project has been in the making for quite some time. I wanted a bookmarklet manager extension that did not run any code on pages without the user actually trigging said code. This extension runs no [Content Scripts](https://developer.chrome.com/extensions/content_scripts) which means that the extension itself does not load any code onto the pages you visit, nor does it care! All this extension does, is give you a way to edit bookmarks that start with `javascript:` in a nice editor. Oh did I forget to mention it uses the [monaco editor](https://microsoft.github.io/monaco-editor/)? the editor behind VSCode!

Give it a shot, and let me know what you think! I would appreciate any input/pull requests/stars you can give!

PS. This extension is built with Vue, I am no Vue expert. Still learning :)
Outlook Space Liberation - A Tampermonkey Script
Tags: jquery, tampermonkey
Published: 2019-06-14 17:01:01

---
title: Outlook Space Liberation - A Tampermonkey Script
published: true
description: Take back that space that those annoying ads and upgrade prompts are currently holding prisoner
tags: jQuery, tampermonkey
cover_image: https://thepracticaldev.s3.amazonaws.com/i/a0k5pw5jta2sjm2foorc.png
---
I don't frequent outlook.com, but when I do, I can't tell you how much it annoys me that ad-block (in this case Ghostery) is unable to block these sections. So, I did what anyone would do, [I created a tampermonkey script](https://gist.github.com/fischgeek/811512bd5ec5de929206ee19c45200d4) to help me out. Thought I would share it. Hope it brings others as much joy as it does me.

    // ==UserScript==
    // @name         Outlook Space Liberation
    // @namespace    http://tampermonkey.net/
    // @version      0.1
    // @description  Gains that space back by annoying ads and upgrade prompts.
    // @author       fischgeek
    // @match        https://outlook.live.com/mail/*
    // @grant        none
    // @require      http://code.jquery.com/jquery-1.12.4.min.js
    // ==/UserScript==
    
    var $ = window.jQuery
    $(document).ready(function() {
        setInterval(function(){
            $('[data-icon-name="OutlookLogo"]').parent().parent().parent().hide()
            $('[role="menu"]').prev().hide()
            $('span:contains("Upgrade to Office 365")').parent().parent().parent().hide()
        }, 500)
    })
Welcoming two summer interns to the DEV team!
Tags: meta
Published: 2019-06-14 16:45:05

---
title: Welcoming two summer interns to the DEV team!
published: true
description: We are so excited welcome two summer interns to the DEV team.
tags: meta
cover_image: https://thepracticaldev.s3.amazonaws.com/i/97a2sge9bgapcn6szuep.png
---

We are excited to welcome two interns who will be joining us for the next ~10 weeks.  @aikedaa and @devencourt will be primarily focused on non-technical tasks, ranging from engaging and supporting new partners, to creating and scheduling recurring DEV threads, establishing new channels to distribute DEV articles, working with current and prospective sponsors, and much more.

Here's a bit more about each of them in their own words:

{% link https://dev.to/aikedaa/i-am-joining-the-dev-team-377k %}

{% link https://dev.to/devencourt/joining-the-dev-team-pec %}

We are incredibly excited for a great summer together!
Joining the DEV Team!
Tags: meta
Published: 2019-06-14 16:44:03

Hello, everyone. My name is Brian and I'm proud to be joining the DEV team as one of their two new Business Development and Growth Interns. 

I had been lurking on DEV.to for a short while before applying for this internship to get a feel for the community. I quickly realized that I had been on the website and app quite frequently because of the open and friendly nature of its community and the vast amount of knowledge available from all of its members. 

I have a limited knowledge set on software development and I am enthusiastic about expanding what I know. I have experience with Python 3, HTML/CSS, and Lua. I have also dabbled in 2D and 3D Game Design. I chose to move away from software development when I enrolled in college to pursue my creative and linguistic endeavors, but I am still very passionate about technology and development in my free time. 

I am wholeheartedly excited to engage with the team and its community members. My responsibilities as an intern will mainly be focused on non-technical work, especially engaging and supporting current and prospective partners and sponsors. This internship is an amazing opportunity for me and I aim to support the DEV team to the best of my ability. 

I speak English, Spanish, and am currently strengthening my Japanese. Feel free to contact me in whichever language is easiest for you and I'll do my best to respond promptly.