teleren/devto huggingface dataset:
Should You Throw Away More Code than You Keep?
Tags: productivity, beginners, discuss, healthydebate
Published: 2019-04-22 18:43:16

---
title: Should You Throw Away More Code than You Keep?
published: true
description: 
tags: productivity,beginners,discuss,healthydebate
---

Once in a while, I like to pick a random NPM package that I'm using in my projects, and go read the source code on GitHub.

When I was first learning JavaScript, I read some of the source code for jQuery and Express. It was a positive experience. I was surprised that I could understand a lot more of the code than I expected. There were definitely a lot of terms and concepts that I had to look up as I went along, but that helped me learn a lot of new things.

I expected it to be much more intimidating, it was actually very readable. That's probably in large part because I was lucky that jQuery and Express are well-written and documented projects.

I've also read some really messy codebases (and written a lot of messy code myself), and it showed me that there's a lot of variability in the software world. No two projects as alike.

**But here's what reading source code doesn't show you:**

You don't see what paths development took and how the code got to where it is today. (unless you go digging through git commits, which I recommend as well).

When you read the source code of a fully-formed, well-maintained and well-documented project, you might get the impression that the developers really knew what they were doing. When you look at the finished product, it might seem like the authors had everything figured out, and they just sat down and wrote it.

The reality is: they probably threw away more code than they wrote, before arriving at the current state.

In fact the code probably went through a lot more iterations that it might seem.

So when you're learning and working on your own projets, don't be afraid to throw away code.

Code is free to write, so write lots of it. Code is also free to delete, so delete at will.

As long as you keep producing, you'll keep getting better at it.

By having the mindset that it's okay to throw away your code, you're going to write more and that's how you improve.

Do you agree? Should you throw away code more code than you keep?
Best Practices for HTML
Tags: discuss, html, bestpractices, beginners
Published: 2019-04-22 22:57:19

---
title: Best Practices for HTML
published: true
description: Discussion about best practices for HTML. 
tags: discuss, HTML, best-practices, beginner
---

Hey Everyone,

I’m not new to HTML as it’s been around for a long time but I’m somewhat new to developing for the web. 

Currently I’m reviewing some notes I have and looking up more information on MDN and I always like to see “best practices” as those are like gold nuggets. 

Sometimes it seems like best practices incorporate other factors that are not straightforward. For example creating a relationship between `<label>` and `<input>` using `for` and `id` attributes respectively.

So, what kind of sneaky best practices do you know of for HTML?
Using Adafruit Feather M0 for environmental sensing
Tags: featherm0, featherwing, lora, adalogger
Published: 2019-04-22 21:53:48

---
title: Using Adafruit Feather M0 for environmental sensing
published: true
description: This post is to see if there is general interest in open source projects using the Adafruit Feather M0 board and associated feather wings. 
tags: feather M0, featherwing, LoRa, Adalogger
---

The Open Sensing lab at OSU is considering making it's research and resources available on dev.to. All projects are already available on github.com/openslab-osu, and everything is published under the GNU General Public License v3.0.

Our page here would be a place for all team members to share tutorials and solutions that they have found during the development of various devices.

Would people be interested in this resource?

Feel free to comment below or like this article in repsonse.
I Want to start a mini JS conference catering to beginners. What do you think?
Tags: discuss, javascript, career, webdev
Published: 2019-04-22 21:46:01

Hello, all. Some of you might cringe at the idea of 'Yet Another Tech Conference', but I will plead with you to read me out here for a minute.

We have been blessed | spoiled | overwhelmed | fatigued - pick your devil, by the amount of Javascript conferences that have sprouted along. There is a need for it and it definitely helps our community as a whole feel more connected, vibrant and more important move forward.

The flip side of it though is that I personally feel like, though the content and events have been getting better, the largest portion of our community - beginners to early intermediates - are being completely left off. 

I remember the first time I went to the **jQuery** conference and **John Resig** himself was there with speakers such as **Nicholas Zakas**, **Paul Irish**, **Alex Sexton** etc... I was in awe to see these amazing individuals sharing their craft. But when the dust settled, and I went back to my studio apartment I came to one big realization: dude I totally suck at this, I could not relate or begin to comprehend the level in which these people were navigating. 

I, fortunately, stayed with it but subconsciously was avoiding to go through another one and feel like a plain idiot when it seemed so obvious to the rest of the world.

Long story short, I want to create a different feel to this great community event model. The idea has been in my head for a while, but I was very inspired by the [tinyconf](https://tinyconf.in/) model and Sid's article. {% link https://dev.to/siddharthkp/lessons-learned-from-starting-a-small-conference-o61 %}


I want to mirror that model with those at the early stage or who just started to figure it out as the main audience.

What do you think??
Mndp Tray - Mikrotik Discovery Protocol Tool
Tags: mikrotik, discovery, network, udp
Published: 2019-04-22 21:40:45

---
title: Mndp Tray - Mikrotik Discovery Protocol Tool
published: true
description: Network Discovery Tool
tags: mikrotik, discovery, network, udp
---

{% github xmegz/MndpTray %}
Add Logout Link To Account Menu - BigCommerce For WordPress
Tags: wordpress, bigcommerce, tutorial, php
Published: 2019-04-22 20:59:01

_[Originally posted on Harner Designs' Blog](https://harnerdesigns.com/blog/add-logout-link-to-account-menu-bigcommerce-for-wordpress/)_

BigCommerce for WordPress (BC4WP) allows you to combine the power of the BigCommerce back-end with the customization of WordPress on the front-end for a truly unique E-Commerce experience. 

One thing that seems missing out of their integration is a logout link on the My Account page:
<img src="https://harnerdesigns.com/wp-content/uploads/2019/04/Before-Code.png" alt="BC4WP Account Menu - Before" width="474" height="187" class="alignnone size-full wp-image-1056" />

It seemed like an easy fix and since I've started to dabble in making pull requests to Open Source Software, I decided to take a look. The "SubNav" as they've called it is populated in `bigcommerce-for-wordpress/src/BigCommerce/Accounts/Sub_Nav.php`. It uses `get_option` to pull the stored Account, Orders, & Address pages and populates the `$links[]` array with the associated data.

Easy. 

Just append the logout information to the `$links[]` array with `wp_logout_url()` and the logout link will appear in the my accounts page. 

And thus, my first [Pull Request](https://github.com/bigcommerce/bigcommerce-for-wordpress/pull/150) to the BC4WP repo was born.

## Shot Down Like A High Schooler Before Prom
My PR was rejected citing that logging out of WordPress was "Out of Scope" of the BigCommerce for WordPress plugin. However, Jonathan of [Modern Tribe](https://tri.be/) (the plugin developers) pointed out that there is a filter already applied to the links generated so that Site Admins can add anything they wish to that list of links: `bigcommerce/account/subnav/links`. 

## So..? How Do You Do It?

If you're like me and _want_ to add the logout link to the BigCommerce for WordPress Account Page Submenu, just add the following code to your theme's `functions.php` file:

```php
add_filter('bigcommerce/account/subnav/links', function ($links) {
 $links[] = [
  'url'     => wp_logout_url(),
  'label'   => __('Logout', 'bigcommerce'),
  'current' => false,
 ];
 return $links;
}, 10, 1);
```
And that's it! Now there will be a convenient to use Logout Link on the "My Account" page with BigCommerce for WordPress.

## Recent Blog Posts
* [How To Measure Angles In Illustrator](https://harnerdesigns.com/blog/measure-angles-in-illustrator/)
* [Optimizing My Stars – PHP Generated SVG vs Canvas](https://harnerdesigns.com/blog/optimizing-my-stars-php-generated-svg-vs-canvas/)
* [Unlimited Private GitHub Repos for Free Accounts](https://harnerdesigns.com/blog/unlimited-private-github-repos-for-free-accounts/)
DS1 - Journey into Python
Tags: datascience, python, python3
Published: 2019-04-22 20:40:35

---
title: DS1 - Journey into Python
published: true
description: An encouraging dive into data science. 
tags: datascience, python, python3
---

# Data Science 001 - Journey into Python #

*[This was originally posted on my blog here](https://rimij405.github.io/blog/data-science/data-science-01/)*.

I am practicing being concise. I want to simultaneously explore the field of data science and document my journey.

As part of enrollment in a seminar covering humanitarian free (libre) and open software (HFOSS), I was introduced to Python for the sake of creating an educational application for the Sugar desktop environment. Sugar is not the focus of this post; instead, I want to focus more on *learning* Python. 

## The Past Informs the Present ##

I was born in December of 1997. I was first introduced to Python when I was seven years old. My father sat me down in front of an old computer tower that had a floppy disk drive in it - I don't remember the model name - and put me in front of an old IDE. I don't remember the name of that, either.

The syntax didn't stick, but, the concepts remained. I would go on to enroll at the Rochester Institute of Technology in 2015 and pursue my undegraduate degree in Game Design & Development.

## Data Science ##

Recently, I became enamoured with the idea of actually using my knowledge of computer science to explore datasets in a meaningful way. Many years ago, while enrolled in [high school](https://www.bxscience.edu/), I was privileged to be in a school that was fell-funded and held encouraging programs for those interested in the sciences. At the time, I was still learning the basics of Java and C#, so data never gripped me as much as the game development industry did.

I went on to watch my peers do interesting things with data - I recall one group mapped geography to crime data and won a competition for their findings. My memory fails me, and, I am unsure of the specific name of that competition - but the essence of what inspired me still influences me to pursue this field in my leisure time.

## Why Python? ##

`Python` is only one option when dealing with data analysis and visualization. There are libraries for data visualization in `JavaScript`, such as D3.js and `R` is a free software environment created for statistical computing and graphics.

I simply chose Python since I was already using it for Sugar development and felt that the barrier to entry would be lower.

## Learning Python ##

So that's the goal: learn python for the sake of getting better with Data Science and chronicle the journey along the way.
The Problem with Luminary and Other Exclusive "Podcast" Hosts
Tags: podcast
Published: 2019-04-22 20:49:44

---
title: "The Problem with Luminary and Other Exclusive \"Podcast\" Hosts"
published: true
description: \"heh guess people just don't like paying for things\" Dammit, no. That's not the problem.
tags: podcast
canonical_url: https://cohan.io/the-problem-with-exclusive-podcasts/
---

“heh guess people just don’t like paying for things”

Dammit, no. That’s not the problem.

More news of Luminary, Spotify, The BBC, etc doing their exclusive lockdown of the podcast ecosystem popping up as Luminary readies to go live.

The problem these companies don’t seem to grasp, and indeed the tech blogs that report on them, is the problem with them is _not_ that they’re paid content. It’s that they’re _not podcasts_.

Podcasts have RSS feeds. Podcasts can be played in any podcast client. Podcasts can be played _on iPods_, dammit. There needs to be a way to download the episodes and play them on any device.

Patreon for example gets this. You can set up an exclusive-to-patrons podcast feed on their system and Patreon will give your patrons a unique link that they can use to access the content. _This is all it needs_.

If Luminary, Spotify, The BBC, whoever else, were to provide users with a unique RSS URL they can subscribe to in their client of choice we’re all on the same page.

It is _not_ an issue with paying for podcasts. It’s an issue with their podcasts not being podcasts. Open up your doors, podcasting is inclusive - not exclusive.

Let the market decide if your podcasts are worth paying for, don’t try to lock down the ecosystem that’s been around since before you were a startup sparkle in some nerd’s eye. Quit trying to wall everything off. Ya dinguses.
Laravel SweetAlert
Tags: laravel, laravelpackage, sweetalert, toast
Published: 2019-04-22 20:04:24

---
title: Laravel SweetAlert
published: true
description: A BEAUTIFUL, RESPONSIVE, CUSTOMIZABLE, ACCESSIBLE (WAI-ARIA) REPLACEMENT FOR JAVASCRIPT'S POPUP BOXES FOR LARAVEL
tags: laravel, laravel-package, sweet-alert, toast
---

![Laravel SweetAlert](https://thepracticaldev.s3.amazonaws.com/i/2w2r3dv3nveb6hem7ply.jpg)

Laravel SweetAlert 2 is a Laravel package that integrates the popular JavaScript SweetAlert 2 with Laravel. 

Using the package’s Alert facade or alert() helper, you can queue up SweetAlert 2 alerts on the frontend from your controller:

It so easy to implement and easy to use give a shot and leave your thoughts.

Install

To get started with Laravel SweetAlert, 
use Composer to add the package to your project's dependencies:

``` 
composer require realrashid/sweet-alert
```

#### Alert

*   `alert('Title','Lorem Lorem Lorem', 'success');`

*   `alert()->success('Title','Lorem Lorem Lorem');`

*   `alert()->info('Title','Lorem Lorem Lorem');`

*   `alert()->warning('Title','Lorem Lorem Lorem');`

*   `alert()->question('Title','Lorem Lorem Lorem');`

*   `alert()->error('Title','Lorem Lorem Lorem');`

*   `alert()->html('<i>HTML</i> <u>example</u>'," You can use <b>bold text</b>, <a href='//github.com'>links</a> and other HTML tags ",'success');`

#### Toast

*   `toast('Your Post as been submited!','success','top-right');`

You can also configure the package’s ToSweetAlert middleware to handle SweetAlert 2 messages during a middleware handler:

``` 
public function someFunction(Request $request)
{
    return redirect('login')->with('success', 'Login Successfully!');
}
```

You should check out the [Documentation ](https://realrashid.github.io/sweet-alert/) to see what methods are available.
You can learn more about this package and check out the source code on GitHub at [realrashid/sweet-alert](https://github.com/realrashid/sweet-alert/)

Featured On

<p align="center">
  <a href="https://laravel-news.com/laravel-sweetalert"> <img src="https://laravelvoyager.com/assets/images/featured-on/laravelnews.png" /></a>
</p>
When npm tells you you're hosed
Tags: npm, node, javascript, webdev
Published: 2019-04-22 19:22:18

---
title: When npm tells you you're hosed
published: true
description: One way to try to recover from npm errors
tags: npm, node, javascript, webdev
cover_image: https://thepracticaldev.s3.amazonaws.com/i/3q1n72d017mllj3u2z6e.jpg
canonical_url: https://johnpapa.net/npmwipe
---

There may be a problem with a package you are using, not npm itself. Sigh. Deep breath. Grunt. Okay - time to wipe the `node_modules` and start again.

Reasons aside, for now, there are a few commands I seem to run almost daily to try to recover from errors. [Kelly Vaughn](https://twitter.com/kvlly) got me thinking this morning about this.

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">if at first you don&#39;t succeed, try `rm -rf node_modules &amp;&amp; npm install`</p>&mdash; Kelly Vaughn 🐞 (@kvlly) <a href="https://twitter.com/kvlly/status/1120320939303014402?ref_src=twsrc%5Etfw">April 22, 2019</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

There are a few contributing factors to me running into issues with npm packages. 

1. I manage a lot of code, including some I touch infrequently enough where the packages get stale.
1. I work in coffee shops and poor WiFi areas quite often (good WiFi one minute, poor the next)
1. I have supported 1000+ developers using Node.js with npm 
1. Murphy's Law surrounds me

Maybe they don’t affect you - in which case - that’s great! 

So what do I do when I see one of the issues with my npm packages? Especially the ones that claim there may be something wrong with one of the packages and not npm itself? I clear the `node_modules` folder and try again.

```bash
rm -rf node_modules package-lock.json
npm install
```

And to do it with flair, I created a bash alias to run these commands.

```bash
npm-wipe
npm i
```

Why run it in two commands? Mostly because I like to see that the first one completed then go run `npm install` manually. I have no good reason. You may prefer to run it all at once.

## Bash Alias

Here is how I set up my bash alias on my macOS.

```bash
alias npm-wipe="rm -rf node_modules package-lock.json"
```

Hope this helps you out of a bind once in a while, too! Do you use this technique? If not, what do you do when npm errors bite you?
What is a Framework?
Tags: framework, rails, ruby, beginners
Published: 2019-04-22 19:08:36

---
title: What is a Framework?
published: true
description: An article I wish I had when I was becoming familiar with tech jargon. 
tags: framework, rails, ruby, beginner
---
  While I was learning Javascript on my own, I began exposing myself to all the resources I could. Using <a href="https://freecodecamp.com/">FreeCodeCamp</a> as my guide, I browsed the internet for other supplemental resources to add context to what I was learning. Eventually, I began reading about Javascript frameworks “Learn Angular vs. Vue”, I couldn’t wrap my head around what a framework actually was. I was under the impression that frameworks would make learning how to code “easier”.

  Fast forward 2.5 months into my coding bootcamp, and I am learning the ropes of Rails. So, now that I’ve learned and built a project using a framework, how would I define a framework to a total code newbie? Frameworks, and in this case Rails, didn’t make learning how to code any easier, but it did lay out a lot of groundwork so I could hit the ground running with building my web application. Frameworks use abstraction (high level code) in order to provide a foundation to build off of. For example, typing rails new unicorn creates a directory which provides a standard layout of how to organize the files within your application named unicorn. Also, Rails comes with generators in which you can create tables from the command line, instead of having to create a file in your text editor and write out the code in the file in order to create a table. Not to mention, the infamous scaffold generator, which creates CRUD functions for a model by typing out one line in the command line!

  In short, you can think of a framework as a piece of software built because someone identified that there was similar code/ patterns that had to get built out each time a new application is built. In the context of Rails, David Heinemeier Hansson put in the legwork in order to make it more efficient for other developers to build an application. There’s even extensive and fantastic documentation to demonstrate how to use the <a href="https://guides.rubyonrails.org/">framework</a>.

  I remember bringing this topic of “What is a framework?” up with one of my instructors. I first told him what my initial idea of a framework was— training wheels, since frameworks do a lot of the work for you. However, this setup is not trivial. It’s important to understand Ruby well before jumping into Rails, so you are able to understand and have context with the magic (really abstraction) of Rails. My instructor opposed my analogy, and instead, he said think of using frameworks as standing on the shoulders of giants. Well said.
Node gems
Tags: node
Published: 2019-04-22 17:54:15

---
title: Node gems
published: true
description: A descriptive snippet collection for Node.js
tags: node.js
---
Node-gems -- I have created a Node.js project with descriptive snippets of code to cover the fundamentals of Node.js. Check it out here : https://github.com/fardeen9983/Node-gems
How to check if push notification is actually enabled in iOS
Tags: ios, swift, push, notification
Published: 2019-04-22 17:31:42

---
title: How to check if push notification is actually enabled in iOS
published: true
description: 
tags: ios,swift,push,notification
---

There are times we want to log if user can receive push notification. We may be tempted to merely use `isRegisteredForRemoteNotifications` but that is not enough. From a user 's point of view, they can either receive push notification or not. But behind the scene, many factors are in the game. It can be that user has disabled push notification in app settings or in iOS Settings. It can also be that user enables push notification but disables all sound or banner display mechanism.


`isRegisteredForRemoteNotifications` is that your app has connected to APNS and get device token, this can be for silent push notification
`currentUserNotificationSettings` is for user permissions, without this, there is no alert, banner or sound push notification delivered to the app
Here is the check

```swift
static var isPushNotificationEnabled: Bool {
  guard let settings = UIApplication.shared.currentUserNotificationSettings
    else {
      return false
  }

  return UIApplication.shared.isRegisteredForRemoteNotifications
    && !settings.types.isEmpty
}
```

For iOS 10, with the introduction of `UserNotifications` framework, instead of checking for `currentUserNotificationSettings`, you should use UserNotifications framework

```swift
center.getNotificationSettings(completionHandler: { settings in
  switch settings.authorizationStatus {
  case .authorized, .provisional:
    print("authorized")
  case .denied:
    print("denied")
  case .notDetermined:
    print("not determined, ask user for permission now")
  }
})
```

Push notification can be delivered to our apps in many ways, and we can ask for that

```swift
UNUserNotificationCenter.current()
  .requestAuthorization(options: [.alert, .sound, .badge])
```

User can go to Settings app and turn off any of those at any time, so it's best to check for that in the settings object

```swift
open class UNNotificationSettings : NSObject, NSCopying, NSSecureCoding {


    open var authorizationStatus: UNAuthorizationStatus { get }


    open var soundSetting: UNNotificationSetting { get }

    open var badgeSetting: UNNotificationSetting { get }

    open var alertSetting: UNNotificationSetting { get }


    open var notificationCenterSetting: UNNotificationSetting { get }
}
```

❤️ Support my apps ❤️ 

- [Push Hero - pure Swift native macOS application to test push notifications](https://onmyway133.com/pushhero)
- [PastePal - Pasteboard, note and shortcut manager](https://onmyway133.com/pastepal)
- [Quick Check - smart todo manager](https://onmyway133.com/quickcheck)
- [Alias - App and file shortcut manager](https://onmyway133.com/alias)
- [My other apps](https://onmyway133.com/apps/)

❤️❤️😇😍🤘❤️❤️