teleren/devto huggingface dataset:
New boilerplate project quickstart with Next.js TypeScript powered by Zeit Now with built-in Sentry support
Tags: zeit, nextjs, typescript, sentry
Published: 2019-11-18 23:43:24

Today, I wanted to quickly get started with building an API to test one of the many 3rd party API we rely on, won't go into details but I wanted to basically make it accessible from Google Sheet, to generate reports using https://medium.com/unly-org/how-to-consume-any-json-api-using-google-sheets-and-keep-it-up-to-date-automagically-fb6e94521abd

But, damn, couldn't find anything to get starter quickly ... Lots of official boilerplates at https://zeit.co/new but none looked like what I needed (API-oriented project).

So, I built one, based on the NextJS template (I don't care about the frontend capabilities and don't plan on using them, but since the API doesn't rely on Next, it won't slow down the API itself, while giving me more flexibility if I ever need to build some UI).

I wanted something I could reuse very easily for future projects, so I figured using Zeit Now would just make sense as hosting platform (kinda love their GitHub integrated "Deploy" button, quite smart and useful to try out things on the fly very quickly).

Also, Zeit Now provides a decent free plan, so anyone can just get started anytime (unlike AWS...)

I want to build something very simple, one endpoint (for now, those things tends to grow faster than expected... Kinda like kids!) but I need something production-grade, with monitoring (Sentry), error handling (Sentry), unit tests (Jest), you name it. I focused on the most useful and here it is!

https://github.com/UnlyEd/next-typescript-api-zeit-boilerplate

Also, I love Serverless and that's another reason why I picked Next.js (in serverless mode) because it'll just scale when needed, and "downscale" when unused, and I don't want to pay for unused uptime, so it's really a good fit for my use case.

---

I plan to release another OSS boilerplate with a very complex Next.js app, focused on both frontend and backend this time, who would be interested? (been working on it for two weeks, quite a lot of things to get right, it's tough!)
<br /> beats 4 tha web a1s out there
Tags: markdown, body, a1, h2
Published: 2019-11-18 23:10:32

Body markdown
Body markdown
We be body markdown

Body markdown
Body markdown
We be body markdown

BodyBodyBodyBodyBodyBodyBodyBody

BodyBodyBodyBodyBodyBodyBodyBody

Body markdown 
Body markdown

# h1 is a pound

## and a h2 is just two of 'em
Build tool maintenance?
Tags: webpack, npm, productivity, discuss
Published: 2019-11-18 23:00:08

Hi,


I find myself struggling with build tools more than I would care for.
This usually happens with projects that are a year old or older.
Modules break or become deprecated, causing the whole project to break down and prevent me and other people from working on it until we find the problem.

I'm sure everyone knows this problem and has dealt with this before.
If we are lucky we can just upgrade the whole thing to the latest Webpack version and everything will work again.
Sometimes just removing the node_modules and run "npm install" does the trick.
Other times nothing seems to help, especially when there are both Mac and Windows users working on the project and using the same build tools.
Even in projects where I know the tools worked several months ago, something can go wrong and I have to spend hours searching for a solution.

What are your thoughts on the build tools we generally use for web development? 
Do you think everything would be easier if we went back if we stopped using them at all?
Faster YouTube embeds with lite-youtube web component
Tags: webcomponents, youtube
Published: 2019-11-19 00:24:13

---
title: Faster YouTube embeds with lite-youtube web component
published: true
date: 2019-11-18 22:47:41 UTC
tags: web components, youtube
canonical_url: https://justinribeiro.com/chronicle/2019/11/18/faster-youtube-embeds-with-lite-youtube-web-component/
---

I was puttering around Github at the end of last week and I stumbled upon Paul Irish’s [lite-youtube-embed](https://github.com/paulirish/lite-youtube-embed). I heart the things that Paul comes up with and in the run around with Chrome Dev Summit and what not last week, I had likely missed it (and as of this writing, it’s come a long way since I saw it on Friday in a single html file).

What I really was intrigued about was the numbers: it was fast. Having been embedding YouTube videos in some of my posts recently, I wanted more speed as the YouTube embeds weren’t exactly blazing fast in my traces. So I decided I’d go a bit of a different direction than Paul and build a ShadowDOM version of the component (since Paul was going to only build the custom element version, I didn’t want to pester him with a shadowDOM argument in his issue tracker).

My encapsulated and responsive version is now available on NPM at [@justinribeiro/lite-youtube](https://www.npmjs.com/package/@justinribeiro/lite-youtube), recently updated to version 0.3.1. Primary features include:

- No dependencies; it’s just a vanilla web component.
- It’s fast yo.
- It’s Shadow Dom encapsulated!
- It’s responsive 16:9
- It’s accessible via keyboard and will set ARIA via the `videotitle` attribute
- It’s locale ready; you can set the `videoplay` to have a properly locale based label

To use, you can install it via npm or yarn:

```
npm i @justinribeiro/lite-youtube # or yarn add @justinribeiro/lite-youtube
```

Or you can just include is directly with JSDelivr:

```
\<script type="module" src="https://cdn.jsdelivr.net/npm/@justinribeiro/lite-youtube@0.3.1/lite-youtube.js"\>
```

From there, just include it your page with the `videoid` and `videotitle`

```
\<lite-youtube videoid="guJLfqTFfIw" videotitle="Sample output of devtools-to-video cli tool"\> \</lite-youtube\>
```
<lite-youtube videoid="hvitpOwoETU" videotitle="1930s Grunow radio to Google Assistant"></lite-youtube>

If you’d like to contribute or find an issue, the [project is available on Github](https://github.com/justinribeiro/lite-youtube) or if you’re looking for the non-ShadowDOM version, do check out Paul’s [repo](https://github.com/paulirish/lite-youtube-embed) and pending NPM package as well.
From Simple Script To Beautiful Web Application With Streamlit
Published: 2019-11-18 22:26:12

<p>Building well designed and easy to use web applications requires a significant amount of knowledge and experience across a range of domains. This can act as an impediment to engineers who primarily work in so-called back-end technologies such as machine learning and systems administration. In this episode Adrien Treuille describes how the Streamlit framework empowers anyone who is comfortable writing Python scripts to create beautiful applications to share their work and make it accessible to their colleagues and customers. If you have ever struggled with hacking together a simple web application to make a useful script self-service then give this episode a listen and then go experiment with how Streamlit can level up your work.</p><p><a href='https://www.pythonpodcast.com/streamlit-web-application-episode-238/'>Listen Now!</a></p>
Escaping Analysis Paralysis For Your Data Platform With Data Virtualization - Episode 107
Published: 2019-11-18 22:25:36

<p>With the constant evolution of technology for data management it can seem impossible to make an informed decision about whether to build a data warehouse, or a data lake, or just leave your data wherever it currently rests. What's worse is that any time you have to migrate to a new architecture, all of your analytical code has to change too. Thankfully it's possible to add an abstraction layer to eliminate the churn in your client code, allowing you to evolve your data platform without disrupting your downstream data users. In this episode AtScale co-founder and CTO Matthew Baird describes how the data virtualization and data engineering automation capabilities that are built into the platform free up your engineers to focus on your business needs without having to waste cycles on premature optimization. This was a great conversation about the power of abstractions and appreciating the value of increasing the efficiency of your data team.</p><p><a href='https://www.dataengineeringpodcast.com/atscale-data-virtualization-episode-107/'>Listen Now!</a></p>
Coding bootcamp grads can't get jobs
Tags: beginners, codenewbie, career
Published: 2019-11-18 22:23:47

Coding bootcamps - the fast track to success, or a misleading marketing scheme?

**Check out this video for more detail:**
Subscribe [here](https://www.youtube.com/mattupham?sub_confirmation=1)!
{% youtube j7uBunTxzyk %}
[Why can't Coding Bootcamp Grads find Jobs?](https://youtu.be/j7uBunTxzyk)

There are a number of reasons why coding bootcamp grads can't find jobs. 

The self-taught / coding bootcamp route is arguably harder to get your first work experience compared to the path of getting a traditional CS degree.

In the video above, I break down the why coding bootcamp grads can't get jobs, what's in their control in the job search, and what's out of their control. Also, I talk about career advice and job search tips!

Join our growing [Discord](https://discord.gg/9RGdMcF) community! 

**Subscribe Here**
[YouTube - Matt Upham](https://www.youtube.com/mattupham?sub_confirmation=1)
Running a single test suite/spec in Jasmine
Tags: testing, jasmine, todayilearned
Published: 2019-11-18 21:38:38

This post was originally published on [my blog](https://dzhavat.github.io/2019/11/18/running-a-single-test-suite-spec-in-jasmine.html).

---

Every developer knows that writing tests is important. To me, tests are like an evidence that I present to my team (or my future self) that the code I’ve written actually works the way I claim it be. This sounds nice and stuff but it wasn’t until recently that I started writing actual tests.

Something I’ve noticed, even with my little testing experience, is that test suites can grow pretty fast. It’s not long before you end up with a bunch of suites each containing a bunch of specs and then you ask yourself “How can I run only a single suite/spec instead of the whole thing?”

I’ve certainly asked myself this question more than once. So if you write your tests using Jasmine, I have a simple solution:

### Running a single suite

Does this look familiar?

```js
describe("A suite", function() {
  // ... specs here
});
```

Well, if you put an `f` in front of `describe`, meaning `fdescribe`, Jasmine will only run that particular test suite.


```js
fdescribe("A suite", function() {
  // ... specs here
});
```

### Running a single spec

Normal stuff here...

```js
describe("A suite", function() {
  it("should check whether `true` is really `true`", function() {
    expect(true).toBe(true);
  });
});
```

Again, if you put `f` in front of `it`, meaning `fit`, Jasmine will run only that particular spec.

```js
describe("A suite", function() {
  fit("should check whether `true` is really `true`", function() {
    expect(true).toBe(true);
  });
});
```

So here you go. If, for whatever reason, you need to run a single suite/spec, you can quickly do so by using `fdescribe` and `fit`. You can find this in the official docs as well. So I’ve definitely not given you the hottest tip out there, but I find it useful. Hope you do as well!
Got a simple webpage you want to host on localhost?
Tags: hosting, npm
Published: 2019-11-18 21:21:07

---
title: Got a simple webpage you want to host on localhost?
published: true
description: Using NPM to host an html page with lite-server
tags: hosting, npm
cover_image: https://raw.githubusercontent.com/nickraphael/blog/master/assets/bert-sz-rhNff6hB41s-unsplash.jpg
---
I recently found myself with an index.html page and assets folder.  Now I could simply load index.html directly in a browser by file...
```
file:///C:/index.html
```
However, I wanted to host it locally on localhost since that's a better representation of how it would live in production.  Turns out it's super easy - barely an inconvenience.  I'm going to assume you have the npm package manager installed that comes with node.

Open your prefered command line and navigate to the index.html folder.

```
npm init
```
This will take you through a little setup wizard where you'll be asked to provide basic information about your project.  Name, Author, Description etc.  Once complete you will see it has created a package.json file.

Next we will ask npm to include lite-server in our project.  Lite-server is a nice little webserver that is perfect for our needs.

```
npm install lite-server --save-dev
```

https://www.npmjs.com/package/lite-server
Lite-server is a __Lightweight development only node server that serves a web app, opens it in the browser, refreshes when html or javascript change, injects CSS changes using sockets, and has a fallback page when a route is not found.__

The last step is to open package.json and add the following to scripts...

```
"start": "lite-server"
```

That's it!  All we do now is launch our webpage with...

```
npm start
```

You will see your browser automatically open at index.html.  What's more, any edits to your webpage will automatically trigger a page refresh.  Nice.
When to use continue, pass and break in python.
Tags: python, beginners, productivity, codequality
Published: 2019-11-18 20:53:43

### **continue**
continue forces the loop to start at the next iteration. In short, continue will jump back to the top of the loop
```
a = [0, 1, 2]
for element in a:
    if not element:
        continue
    print(element)
```
output-
```
1
2
```
**UseCase**: The continue statement can be used to skip the current iteration only. Loop does not terminate but continues on with the next iteration.
### **pass**
while pass means there is no code to execute here, it passes execution to the next statement. So pass will continue processing.
```
a = [0, 1, 2]
for element in a:
     if not element:
         pass
     print(element)
```
output-
```
0
1
2
```
**UseCase**: You can use pass statement when you have created a method but have not implemented, yet.
### **break**
The break statement provides you with the opportunity to exit out of a loop when a given condition is triggered. 
````
a = [0, 1, 2, 3, 4, 5]
for element in a:
    if element == 3:
        break
    print(element)
```
output-
```
0
1
2
```
**UseCase**: The break statement can use in a program to break out of a loop for the matching condition.
Best paid learning resources? 👩‍🏫
Tags: discuss, beginners
Published: 2019-11-18 20:42:50

I've been self-teaching myself web development, mainly angular over the past few months and recently got a job as a trainee developer. Part of that meeting they said they would be happy to fund any training etc. that would make me more useful.

Currently, I have found just learning from the free web has been sufficient but I think it's definitely worth while taking advantage of paid content if its funded. 

My question is, Is there any paid resources out there that you guys recommend that's worth paying for. Books, online courses, etc?
How to Return JSON-Encoded Response for non-dict object
Tags: django, beginners, python, tutorial
Published: 2019-11-18 20:22:51

---
title: How to Return JSON-Encoded Response for non-dict object
categories:
- django
- beginners
- python
- tutorial
tags:
- django
- beginners
- python
- tutorial
category: blog
canonical_url: https://sharmapacific.in/how-to-return-json-encoded-response-for-non-dict-object/
---
An HttpResponse subclass that helps to create a JSON-encoded response. Its default Content-Type header is set to application/JSON.

The first parameter, data, should be a dict instance. If non-dict object is passed as the first argument, a TypeError will be raised.

#### Example dict instance:
``` python

from django.http import JsonResponse

def user(req):
    response = {
        'id': 1,
        'name': 'Tom',
        'status': Active
    }
    return JsonResponse(response)
```

#### Example non-dict object:
```
return JsonResponse([1, 2, 3, 4])
```

TypeError: In order to allow non-dict objects to be serialized set the safe parameter to False

By default, the JsonResponse’s first parameter, data, should be a dict instance. To pass any other JSON-serializable object you must set the safe parameter to False.

```
return JsonResponse([1, 2, 3, 4], safe=False)
```

The safe boolean parameter defaults to True. If it’s set to False, any object can be passed for serialization (otherwise only dict instances are allowed).
Arcology Roguelike Lifestream E5
Tags: unity3d, roguelike, livestream, gamedev
Published: 2019-11-18 19:37:59

# Episode 5: Procedural Generation

In this video I build on the Procedural Generation algorithm discussed in the previous video.

I start with a bit of Game and Art Design, exploring the idea of the game having levels or floors that are separated from the other floors or levels in the game. To implement this visually I add a very basic "scaffold" effect.

I look at ways to get better coverage of the entire level with Rooms.

I also attempt a solution to prevent rooms from overlapping. The code works, but the generated levels lack play-ability. In this instance Game Mechanics trump the correctness of the algorithm.

I also add some code to ensure our level always has one entrance, and finally, I add random rotations to placed Room Templates.

I might not look like a major difference (if you just glance at the thumbnails) but there is major progress being made towards playable levels, which will allow for much easier testing of combat mechanics, unit balance and various other Game Design Aspects.

{% youtube _AJ1l_DNxSI %}
Integrate static security checking for python!
Tags: security, python, vscode
Published: 2019-11-18 19:33:15

## The basics
Today we will be talking about bandit, a python static analysis tool that reviews your code for possible security flaws. We will be using bandit, lets create a virtual environment and use pip to install bandit.

```sh
python -m venv venv
source venv/bin/activate
pip install bandit
```

Lets use the following application below as an example.

```py
from os import system

system('sudo su')
```

Obviously using sudo su in a shell process isn't good practice, but we're just showing off the capabilities of bandit. So, lets run bandit against our file.

```sh
bandit app_name.py
```

> Below is an example of the response

```
Test results:
>> Issue: [B605:start_process_with_a_shell] Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
   Severity: Low   Confidence: High
   Location: bad.py:3
   More Info: https://bandit.readthedocs.io/en/latest/plugins/b605_start_process_with_a_shell.html
2
3       system('sudo su')

--------------------------------------------------
>> Issue: [B607:start_process_with_partial_path] Starting a process with a partial executable path
   Severity: Low   Confidence: High
   Location: bad.py:3
   More Info: https://bandit.readthedocs.io/en/latest/plugins/b607_start_process_with_partial_path.html
2
3       system('sudo su')

--------------------------------------------------

Code scanned:
        Total lines of code: 2
        Total lines skipped (#nosec): 0

Run metrics:
        Total issues (by severity):
                Undefined: 0.0
                Low: 2.0
                Medium: 0.0
                High: 0.0
        Total issues (by confidence):
                Undefined: 0.0
                Low: 0.0
                Medium: 0.0
                High: 2.0
Files skipped (0):
```

This is pretty nice it gives us all the results we need. We can use these results in a bunch of different ways, but in what I do is grep the report and look to see if there are any "High or Medium" severity items, and then kill the CI/CD pipeline.

## VSCode Implementation

In VSCode, what you can do is use CMD+Shift+P while in your python application and select linter, and choose bandit, you may be asked to install it, choose yes, ensure you tell VSCode to use bandit once more, and now, if you hover over the marked text, you will see the error/warnings.
I'm Gonna be Open w/ You: What I Learned at the All Things Open conference
Tags: opensource, todayilearned
Published: 2019-11-18 19:32:36

Earlier this year, I went to the [All Things Open 2019](allthingsopen.org "All Things Open Homepage") conference in Raleigh, NC. My goal was to meet people and learn new things, but I could never have prepared for the things I learned.

## As a new person in tech and a first-time conference-goer

* T-shirts, hoodies, shorts, and other casual clothing is totally acceptable
* Everyone is so welcoming and kind
* I was pronouncing everything wrong
  * Kubernetes (hint: NOT Koo-brrr-neats)
     * K8s (hint: NOT kates)
  * Netlify (tip: it's Net-lif-eye)
  * PostgreSQL (tip: 's' is said twice / hint: NOT post-greh-Es-Queue-Ell or post-greh-Sequel)
  * Azure (hint: NOT a-zoo-er)
  * I'm sure there are more

## Reminders for next time

* Do not wait until 2 days before to book a hotel room
* Make sure to bring a water bottle

## Takeaways from sessions

* Use open-source tools to bootstrap, the big companies are, why wouldn't you
* Free admission != access (speaker [Nikema Prophet](https://twitter.com/dev_nikema))
{% twitter 1183440514772819968 %}
* Allow people to be themselves at work (speaker Matt Rogers)
{% twitter 1183450073058959360 %}
* Avoid burnout! (speaker [Ashley McNamara] (https://twitter.com/ashleymcnamara))
{% twitter 1184104968053297152 %}
* The lines between front and backend have blurred over the last few years, hence why I couldn't tell the difference. (speaker [Chris Coyier ](https://twitter.com/chriscoyier))
{% twitter 1184112325764272128 %}
* Machine learning is basically a bunch of if/else statements, I think
* Mentoring can scale and [Kubernetes](https://github.com/kubernetes/community/tree/master/contributors/guide#welcome "Kubernetes mentor framework") has a neat framework for it
* Every single person, regardless of our differences, has a place in tech

### Other observations

* Purple hair is in and it looks badass on all sorts of different people
* It seems to be acceptable to be on your phone/computer through entire sessions
* I met a few people from Twitter
* Lego! There were legos on 2 different floors (I <3 Lego!)

PS. Here's a separate bit on [what I learned about stickers](https://dev.to/vickilanger/rules-to-stick-to-my-observations-about-stickers-c9c).
Python Dictionary Implementation Question
Tags: python, help
Published: 2019-11-18 19:30:17

I'm curious about the implementation of dictionary in python. I'm learning about hash tables in my computer science course, and I'm aware that the dictionary data structure in python works as a hash table.
What I haven't worked out is this: what determines the number of buckets in the hash table? I'm asking this about python dictionary in particular, although I'd be interested in other cases as well.

Thanks,
Erik