teleren/devto huggingface dataset:
How to Serve Vue with Nest
Tags: vue, typescript, javascript
Published: 2019-11-12 02:58:30


Want to serve a VueJS app from a NestJS backend? Here's how you do it.

## Create a new Nest app

Install the Nest CLI

```bash
npm install -g @nestjs/cli
```

Create the NestJS app

```bash
nest new nest-with-vue
```

Install the dependencies

```bash
cd nest-with-vue
npm install
```

## Verify it's all working properly

First, run it (this will watch the folder so we won't have to restart the server as we make changes):

```bash
npm run start:dev
```

Then, hit it (in a separate terminal window):

```bash
curl localhost:3000
```

You should get `Hello World!`.

## Set it up to serve static content

Install the package:
```bash
npm install --save @nestjs/serve-static
```

### Use the package

src/app.module.ts:

```typescript
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { ServeStaticModule} from '@nestjs/serve-static'; // New
import { join } from 'path'; // New

@Module({
  imports: [
    ServeStaticModule.forRoot({ // New
      rootPath: join(__dirname, '..', 'client/dist'), // New
    }), // New
  ],
 controllers: [AppController],
 providers: [AppService],
})
export class AppModule {}
```

src/main.ts:

```typescript
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.setGlobalPrefix('api'); // New
  await app.listen(3000);
}
bootstrap();

```

We're moving all the existing endpoints to under `/api`, and then serving the static content in the `./client/dist` folder (which doesn't exist yet) when someone hits the root (in this case `localhost:3000`).

Also note that the name `client` here could be anything. It's just the folder where we're going to put the Vue app.

## Verify that the controller endpoint moved

Now, if we hit the previous endpoint:

```bash
curl localhost:3000
```
You should get `{"statusCode":500,"message":"Internal server error"}`.

But if you hit the new `/api` endpoint:

```bash
curl localhost:3000/api
```

You get `Hello World!` again.

Now we just have to create the Vue app in that `./client/dist` folder.


## Create the VueJS app

Install the Vue CLI:
```bash

npm install -g @vue/cli
# OR
yarn global add @vue/cli
```

Create the app:

```bash
vue create client
```

Build the app:

```bash
cd client
npm run build
```

This will put all the static files in `./client/dist`, right where the Nest app will be looking for them.

## Verify that Nest is serving the compiled Vue app

```bash
curl localhost:3000
```

You should get something that looks like:

```html
<!DOCTYPE html><html lang=en> ... <strong>We're sorry but client doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> ... </html>
```

Which is the HTML being served by the Vue app.

Open it up in your browser and you'll see it's working!

![Vue screenshot](https://i.imgur.com/iqn0F96.png)

## Closing words

That's it. You can find the complete code [here](https://github.com/ZakMiller/NestWithVue).
Scientists estimate less than 70! atoms in the observable Universe!
Tags: javascript, codenewbie
Published: 2019-11-12 01:46:31

Did you know that scientists estimate less than 70! atoms in the entire universe?

This looks impossible but you can actually verify this statement pretty easily with the help of Google and a little bit of JavaScript.

#Step 1

Just google "atoms in the observable universe" and see the answer.

#Step 2

Use the [codeguppy.com editor](https://codeguppy.com/code.html) and copy and paste the following code snippet:

```
var p = 1n;

for(var i = 1n; i <= 70n; i++)
{
    p *= i;
}

println(p);

```

#Step 3

Compare the results from the previous steps! You'll see that the statement is accurate!


> Note: This fun fact has been the pretext to introduce you working with Big Numbers in JavaScript (note the "n" suffix after the constants in the code above). 

70! is such a big number that you cannot calculate accurately using regular numbers. Of course ... you don't always need precision when working with a such big numbers.

> However, it is always important to estimate the size of your data structures when code. Otherwise you may run into interesting situations.

Big numbers are a pretty recent construct in the JavaScript language. If you want to calculate 70! in a classical way, without big numbers, just take a look at this code: [https://codeguppy.com/code.html?m4AfgJmCABGNEvKlUNtM](https://codeguppy.com/code.html?m4AfgJmCABGNEvKlUNtM)




For more fun facts and programming tips please follow [@codeguppy](https://twitter.com/codeguppy) on Twitter.
Day 31 : Back to the Swing
Tags: hiphop, code, coding, lifelongdev
Published: 2019-11-12 01:27:48

_liner notes_:
- Saturday : You already know! Radio show day!! As usual, had a great time. Check the show out here: kNOwBETTERHIPHOP.com

![Covers of Wu-Tang Clan's Enter The Wu-Tang 36 Chambers and A Tribe Called Quest's Midnight Marauders](https://thepracticaldev.s3.amazonaws.com/i/4mr2u14p5y866hnrpg3g.jpg)

- Sunday : Started working on my side project using Svelte and Sapper. Ran into an issue getting a Leaflet map to show up because it doesn't work with Server Side Rendering out of the box.

- Professional : Been thinking about the next project to work on. Brought it up to other team members and they seemed into it. There is something along the same lines that has been worked on, so I may be working with others to bring it to completion. Rest of the day, I was looking into a question that someone had. Tried to remake what they did, but I'm running into some issues. If I don't get it working by tomorrow morning, going to ask the team for help.

- Personal : Going to see if I can find a workaround for the Leaflet / SSR for my project. Would really like to get it working. If not, going to do it the regular way. Want to get at least the map to show up by tonight. We also had our Orlando Developers board meeting.

![Sharp cliffs in a mist in Zhangjiajie, China](https://thepracticaldev.s3.amazonaws.com/i/y7a4i1k2hrc4yqkxfs2m.jpg)

Tomorrow, I'm hoping to get the person's question duplicated so I can help them more or maybe even find the solution outright. Also want to see if I can get the previous project that the team was working up and running to see how we can use it in what I'm looking to build.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube Pjwuj4-mDJI %}
Good readings this week from dev to devs
Tags: todayilearned, weeklyretro, discuss, goodreadings
Published: 2019-11-12 14:09:03

---
title: Good readings this week from dev to devs
published: true
date: 2019-11-12 01:09:53 UTC
tags: todayilearned, weeklyretro, discuss, Good Readings
canonical_url: https://boobo94.xyz/good-readings/good-readings-this-week-from-dev-to-devs/?utm_source=rss&utm_medium=rss&utm_campaign=good-readings-this-week-from-dev-to-devs
cover_image: https://i1.wp.com/boobo94.xyz/wp-content/uploads/2019/11/good-readings.jpg
---

Good readings are a series of [articles](/) that share the best articles/books read by me. This is the first article from this series and I post the list below:

- [https://www.ilikebigbits.com/2019\_07\_08\_programming\_in\_1969.html](https://www.ilikebigbits.com/2019_07_08_programming_in_1969.html)
- [https://dev.to/chrisachard/dns-record-crash-course-for-web-developers-35hn](https://dev.to/chrisachard/dns-record-crash-course-for-web-developers-35hn)
- [https://chrisachard.com/cheatsheets/dns-cheatsheet.pdf](https://chrisachard.com/cheatsheets/dns-cheatsheet.pdf)
- [https://dev.to/aurelio/working-with-environments-in-postman-4bcm](https://dev.to/aurelio/working-with-environments-in-postman-4bcm)
- [https://dev.to/scottydocs/how-to-build-a-documentation-culture-2mk7](https://dev.to/scottydocs/how-to-build-a-documentation-culture-2mk7)
  - [https://docs.microsoft.com/en-us/style-guide/top-10-tips-style-voice](https://docs.microsoft.com/en-us/style-guide/top-10-tips-style-voice)
  - [https://docs.microsoft.com/en-us/style-guide/acronyms](https://docs.microsoft.com/en-us/style-guide/acronyms)
  - [https://www.writethedocs.org/guide/writing/style-guides/](https://www.writethedocs.org/guide/writing/style-guides/)
- [https://dev.to/scottydocs/how-to-write-a-kickass-readme-5af9](https://dev.to/scottydocs/how-to-write-a-kickass-readme-5af9)
- [https://medium.com/frontend-digest/axios-vs-fetch-which-to-use-in-2019-6678c083c5c](https://medium.com/frontend-digest/axios-vs-fetch-which-to-use-in-2019-6678c083c5c)
- [https://onezero.medium.com/apple-is-trying-to-kill-web-technology-a274237c174d](https://onezero.medium.com/apple-is-trying-to-kill-web-technology-a274237c174d)

The post [Good readings this week from dev to devs](https://boobo94.xyz/good-readings/good-readings-this-week-from-dev-to-devs/) appeared first on [boobo94](https://boobo94.xyz).
Career Goals
Tags: productivity, career, student, computerscience
Published: 2019-11-12 00:42:52

I am confused about what to do for my career. As now of I am undergrad final year student and as all students have same pressure of what to do? I have checked out a few options which are :-
1) Go Hiking
2) Start Business
3) Go For Job Interviews
4) Do Masters
Well to start with I have choose option 3 as its suitable and secured thing for my future. I don't know it but still I choose and count as one of the secured options. But what in Job? A whole bunch of list awaits here too. Go for back-end development, front-end development, full stack, mean stack, lamp stack, mern stack, competitive programming... blah ... blah.... Still confused. So I decided to write my resume in such a way that companies will choose me rather than choosing myself. And I got an offer letter too. But what now, Am I happy? I guess the job will make me happy when I take interest and I started doing things. Now I am liking it very much and appreciate the decision of what I made. If I had choose other options at that time may be I might not be happy as I am right now. So choose your career wisely enough and be happy in what u like. Don't think there is a less time for you, Have a deep thinking and give sufficient time, as time will make your things better and better day by day!!!.
Questions to ask a team you're considering joining
Tags: workplace, career
Published: 2019-11-12 00:13:42

---
title: Questions to ask a team you're considering joining
published: true
description: I recently chose a new team to work on at Box, and I wrote down some of the questions I asked the teams as I interviewed them to make my decision.
tags: workplace, discuss, career
---

I recently chose a new team to work on at Box, and I wrote down some of the questions I asked the teams as I interviewed them to make my decision.

- **What are things that need doing that no one is doing? Things you’re doing that you wish you weren’t?**
- **How do your Tech Lead and Eng Manager split responsibilities?**(Especially useful to compare answers given by people on the team who are the TL/EM vs. those who aren't)
- **What’s the tech stack?** (Have them whiteboard the layers out and ask questions until you understand it enough to re-explain it.)
- Who are the people that add pressure to the team? In what ways do they add pressure?
- **How is status reported and tracked?**
- **What’s your career growth plan? When do you anticipate you’ll be promoted?** (Don't forget to also ask this of people who would be above you in the management chain.)
- **How far ahead do you know what you’ll be working on?**
- **What’s a recent technical discussion you were part of?** (Ask enough questions to fully understand it and be able to restate the resolution to an outsider.)

As always, _the most value comes from followup questions_, but these were good starters.

Let me know if you find these useful, and feel free to add your own in the comments.
Quick Tips for Restful Routing from a beginner.
Tags: ruby, beginners
Published: 2019-11-12 00:00:12

From being completely new to Ruby programming to learning the joys of Sinatra, the journey doesn't seem to end and I love it! My latest adventure, learning restful routes. Here a few simple things that I learned the hard way.

1. Work on one piece at a time.
This is something that should be common sense but its so crucial. I made the mistake of assuming certain data would pass correctly because it had worked on previous implementation, but I never stopped to think about routing being correct. This obviously caused me to chase some invisible error that was no where near close to what was actually the problem more times that I care to admit.

2. Pry Pry Pry Params Params Params
These are wonderful tools provided to us by some beautiful big brain angels of mercy. Don't take their hard work for granite because they alone made it possible for me to make it through. 

3. Nested routes make everything better
I tried to come up with this clean design that 100% separated components because I felt nesting made things looked messy. To an extent, I still feel I am right but I also don't know what i'm talking about. I spent days trying to pull of this "clean code" and only minutes from nesting. 

4. Stay consistent
This is also a no brainer but apparently I don't have one at all because its a lesson I had to learn again. No need to try and be fancy or just throw something together, take you time and plan out your approach. Oder matters in routing. In addition, tracing your work becomes a lot easier if you stay consistent in how you layout controllers.
Shell Scripts: How To Run Them
Tags: beginners, tutorial
Published: 2019-12-16 15:16:37

---
title: Shell Scripts: How To Run Them
published: true
date: 2019-11-12 00:00:00 UTC
tags: beginner, tutorial
canonical_url: https://stephencharlesweiss.com//2019-11-27/running-shell-scripts/
---

I am constantly striving to improve my understanding and comfort interacting with my terminal. I remember how excited I was when I first started to understand how to [change my shell from bash to zsh](https://www.stephencharlesweiss.com/2019-09-02/change-default-shell-zsh/), [create persistent aliases](https://www.stephencharlesweiss.com/2018-12-22/oh-my-zsh-and-persistent-aliases/), and even begin [writing my own functions](https://www.stephencharlesweiss.com/2019-02-13/next-level-shell-aliases-and-functions/).

More recently, I’ve been experimenting writing shell scripts when it dawned on me - I didn’t actually know _how_ to run the script. If it were an `.html` file, I could open it in a web browser. If it were a node application, I could run it from the command line:

```shell
$ node my-file.js
```

But what about a `.sh` file?

This is one of those questions that once you know how, you forget that you once didn’t. But until you know - it’s not really clear what you’d do.

Imagine you have a directory with a `setup` script in it:

```shell
.
├── node_modules
├── package-lock.json
├── package.json
├── setup.sh
└── src
```

To execute the setup script, you simply call it:

```shell
$ ./setup.sh
```

In this example, I’m already in the directory where setup lives - but you can imagine if I was up a directory, and it was saved in a directory `scripts`, I could also call it:

```shell
$ ./scripts/setup.sh
```

You don’t need to preface it with anything (as in the `node` example) because the shell knows how to execute the shell script!
Hello Devs and Programmers.
Published: 2019-11-11 23:45:13

To all those who haven't made it out yet, stay focused and keep doing what you're doing. Improve everyday.
Hope you reach where you're headed soon.

Just spreading a little positivity. And, trust me, we all go through the same process so if you haven't made it out yet. Believe me, you will.

Happy Coding. And don't spread hate against vim. 😅

And those who have made it, Congratulations and always remember. There's always the next thing 😊👍
Python String Formatting Techniques
Tags: python, programming
Published: 2019-11-11 23:40:21

In an effort to build up a bit of a video collection, I finally got around to putting together a video for my [string formatting article](https://therenegadecoder.com/code/how-to-format-a-string-in-python/
). In it, I share six string formatting techniques including old-school concatenation and new features like f-strings. Also, it features my cat and a little challenge at the end! If you remember Mad Libs, you'll love this.

{% youtube qZMYur8VRlU %}
Using Regex to Prevent User-Error during E-commerce Site-Content Turnovers
Tags: regex
Published: 2019-11-11 22:31:42

As is often the case with an environment with fast-paced deadlines and lots of last-minute site content decisions, humans often make mistakes and these mistakes can both impact the customer experience and the financial bottom line. E-commerce websites generally do not have guard rails for site content, promotions, or new product additions as these changes generally occur during an overnight cycle and will simply accept whatever is scheduled to load. No matter how detail-oriented a team is, inevitably the team will miss something and there will be a customer-facing error(usually from around midnight for the next 8 or 9 hours until business hours or whenever it is that someone on the team physically notices). My conclusion after many incidents and attempts to modify and perfect process that failed: DON’T TRUST YOURSELF, AUTOMATE YOUR SITE CHECKS! 

My solution to the issue was to create regular expressions statements that checked every user that entered the site to search their session and confirm that these elements were present. Things I built include checks for an image name in our hosting site in our main content in case the scheduled content from the prior day fell off and no content replaced it, checks for some threshold of free shipping in checkout(almost all e-commerce sites have some form of threshold amount to qualify for free shipping), and a check at checkout to run the promotion against the database to make sure all promotions were set up. These checks can be implemented multiple ways; Checks can be created in any server-side A/B testing platform or in most of the enterprise analytics platforms with a simple regex statement to identify these elements. How you configure them will depend on your individual systems, but implementing these small checks could mean the difference between a quick fix at midnight (when almost no one would notice) and 9 hours of customer facing errors. I recommend you check into a quick implementation for your own needs.
QA Tester walks into a bar..
Tags: testing, projectbenatar, devops, banter
Published: 2019-11-11 22:28:05

QA Tester walks into a bar:

He orders a beer.
He orders 3 beers.
He orders 2976412836 beers.
He orders 0 beers.
He orders -1 beer.
He orders q beers.
He orders nothing.
Él ordena una cerveza.
Il commande une bière.
He orders a deer.
He tries to leave without paying.
He starts ordering a beer, then throws himself through the window half way through.
He orders a beer, gets his receipt, then tries to go back.
He orders a beer, goes to the door of the bar, throws a handful of cookies into the street, then goes back to the bar to see if the barmaid still recognizes him.
He orders a beer, and watches very carefully while the barmaid puts his order into the till to make sure nothing in his request got lost along the way.
He starts ordering a beer, and tries to talk the barmaid into handing over her personal details.
He orders a beer, sneaks into the back, turns off the power to the till, and waits to see how the barmaid reacts, and what she says to him.
He orders a beer while calling in thousands of robots to order a beer at exactly the same time.
Fractal intro, Fade bullets, Spectral menu | Module Monday 63
Tags: showdev, githunt, webdev, javascript
Published: 2019-11-11 22:16:45

---
title: Fractal intro, Fade bullets, Spectral menu | Module Monday 63
published: true
description: Module Monday 63
tags: showdev, githunt, webdev, javascript
cover_image: https://res.cloudinary.com/component/image/upload/b_rgb:ffffff,c_lpad,h_350,w_800/v1573269941/fractal-intro_jvauat.gif
canonical_url: https://guide.anymod.com/module-monday/63.html
---

## Everything below is open source 
These modules can be used on any website, web app, or anywhere else. There are hundreds more like these built & shared on [AnyMod](https://anymod.com).

Click a mod to see it along with its source code.

## Fractal intro
Introduce your mobile app to the world.
<a class="btn btn-sm" href="https://anymod.com/mod/fractal-intro-lloknl?preview=true">View mod</a>
<a href="https://anymod.com/mod/fractal-intro-lloknl?preview=true">
  <img src="https://res.cloudinary.com/component/image/upload/v1573269941/fractal-intro_jvauat.gif"/>
</a>

## Bullet fade in
Animated points that appear sequentially and look great doing it.
<a class="btn btn-sm" href="https://anymod.com/mod/fade-bullets-ormoao?preview=true">View mod</a>
<a href="https://anymod.com/mod/fade-bullets-ormoao?preview=true">
  <img src="https://res.cloudinary.com/component/image/upload/v1573269939/fade-bullets_ivx03c.gif"/>
</a>

## Reusable side menu
Add it anywhere, customize, and reuse easily.
<a class="btn btn-sm" href="https://anymod.com/mod/spectral-menu-balorl?preview=true&dark=true&lorem=true">View mod</a>
<a href="https://anymod.com/mod/spectral-menu-balorl?preview=true&dark=true&lorem=true">
  <img src="https://res.cloudinary.com/component/image/upload/v1573269941/sidemenu_p1tcdc.gif"/>
</a>

## Vimeo video embed
Put a responsive Vimeo vid on any page.
<a class="btn btn-sm" href="https://anymod.com/mod/vimeo-video-dmadd?preview=true&w=768">View mod</a>
<a href="https://anymod.com/mod/vimeo-video-dmadd?preview=true&w=768">
  <img src="https://res.cloudinary.com/component/image/upload/v1573269943/vimeo_pfc9qb.gif"/>
</a>

## Pre-styled quotation block
Add your text and it's ready to use.
<a class="btn btn-sm" href="https://anymod.com/mod/quotation-block-bkbmk">View mod</a>
<a href="https://anymod.com/mod/quotation-block-bkbmk">
  <img src="https://res.cloudinary.com/component/image/upload/v1573269938/quotation_iga7sb.png"/>
</a>

<hr>

I post new mods from the community [here](https://dev.to/tyrw) every (Module) Monday -- I hope you find them useful!

Happy coding ✌️
TicTacToe game- Simple Ruby implementation
Tags: replit, ruby
Published: 2019-11-11 21:53:58

I have made this simple implementation of the tictactoe game. It is a game played by two players where they choose random numbers between 1 to 9. The first player takes X and the second player takes O. The interesting part is  that the person who manages to score three times in a row is the winner

{% replit @Phemia/Object-Oriented-TicTacToe %}
IDOM - Server Side Rendering in Python
Tags: python, react, javascript, opensource
Published: 2019-11-11 21:45:04

Ever wish you could write client-side Python? Well here's the next best thing, a server-side rendering solution implemented in pure Python! Check out:

- The [documentation](idom-docs.herokuapp.com/)
- An [interactive demo](https://mybinder.org/v2/gh/idom-team/idom-jupyter/main?urlpath=lab/tree/notebooks/introduction.ipynb) using Jupyter Notebooks

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/vws91it2g42aejazki2h.gif)