This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {promisify} = require('util'); | |
const fs = require('fs'); | |
const readFileAsync = promisify(fs.readFile); | |
readFileAsync(filePath, {encoding: 'utf8'}) | |
.then((text) => { | |
console.log('CONTENT:', text); | |
}) | |
.catch((err) => { | |
console.log('ERROR:', err); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fs.readdir(source, function (err, files) { | |
if (err) { | |
console.log('Error finding files: ' + err) | |
} else { | |
files.forEach(function (filename, fileIndex) { | |
console.log(filename) | |
gm(source + filename).size(function (err, values) { | |
if (err) { | |
}.bind(this)) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Use IntelliSense to learn about possible Node.js debug attributes. | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Launch Program", | |
"runtimeExecutable":"node --inspect", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Use IntelliSense to learn about possible Node.js debug attributes. | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "attach", | |
"name": "Node: Nodemon", | |
"restart": true, | |
"protocol": "inspector", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:carbon | |
# Create app directory | |
WORKDIR /usr/src/app | |
# Bundle app source | |
COPY . /usr/src/app/ | |
# npm install | |
RUN apt-get update && apt-get install && npm install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.5' | |
services: | |
mysql: | |
container_name: mysql_db | |
image: mysql:5.7 | |
volumes: | |
- ~/datadir/mysql:/var/lib/mysql | |
ports: | |
- 3306:3306 | |
- 33060:33060 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/app/ping/ping.component.ts | |
import { HttpClient } from '@angular/common/http'; | |
// ... | |
export class AppComponent { | |
constructor(public http: HttpClient) {} | |
public ping() { | |
this.http.get('https://example.com/api/things') | |
.subscribe( | |
data => console.log(data), | |
err => console.log(err) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core' | |
import { HttpInterceptor, HttpHandler, HttpRequest, HttpEvent, HttpResponse } from '@angular/common/http'; | |
import { Observable } from 'rxjs/Observable'; | |
import 'rxjs/add/operator/do'; | |
@Injectable() | |
export class HeaderInterceptor implements HttpInterceptor { | |
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { | |
const dummyrequest = req.clone({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return ( | |
<div key={props.questionId} className="quiz-story"> | |
<QuestionCount counter={props.counter} viewreults={props.viewreults} | |
counter={props.questionId} | |
total={props.questionTotal} | |
/> | |
<Question content={props.question} /> | |
<ul className="answerOptions"> | |
{props.answerOptions.map(renderAnswerOptions)} | |
</ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
function Question(props) { | |
return ( | |
<div> | |
<h2 className="question">{props.content}</h2> | |
</div> | |
); | |
} |