This file contains 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' | |
services: | |
traefik: | |
image: 'traefik:v2.10' | |
container_name: 'traefik' | |
command: | |
- '--api.insecure=true' | |
- '--providers.docker=true' | |
- '--providers.docker.exposedbydefault=false' |
This file contains 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 log = console.log | |
const sg = { | |
admin: 'admin', | |
authors: 'authors', | |
guests: 'guests' | |
} | |
const users = [ | |
{ id: 'johndoe', email: 'johndoe@nobody.com', groups: [sg.admin, sg.authors] }, |
This file contains 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 http = require('http') | |
const baseApiUrl = 'http://jsonplaceholder.typicode.com' | |
// using error-back pattern --> or anti-pattern :) | |
const fetchDataWithPromise = () => { | |
return new Promise((resolve, reject) => { | |
http.get(`${baseApiUrl}/posts`, res => { | |
let rawData = ''; |
This file contains 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 getCustomerInfo = (callback) => { | |
setTimeout( | |
() => callback(null, { name: "John Doe", birthdate: "1967-04-14" }), | |
1000 | |
); | |
}; | |
const getCustomerInfoAsync = promisify(getCustomerInfo); |
This file contains 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
/*************************************************** | |
* Getúlio Magela Silva (gm50x) | |
* | |
* Running Instructions: | |
* node async-iterators {for-each|for-of|map} | |
* | |
* Reference Material (NOT MINE): | |
* https://zellwk.com/blog/async-await-in-loops/ | |
***************************************************/ |
This file contains 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:lts-alpine3.12 AS build | |
WORKDIR /usr/src/app | |
COPY package*.json ./ | |
RUN npm install | |
COPY . . | |
RUN npm run build | |
FROM node:lts-alpine3.12 AS runtime | |
ARG NODE_ENV=production | |
ENV NODE_ENV=${NODE_ENV} |
This file contains 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
/************************************************************ | |
* * | |
* ObservablesOne * | |
* Simples example of playing with rxjs-observables * | |
* * | |
* reqruiements: npm install rxjs * | |
* * | |
************************************************************/ | |
This file contains 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
// Function to create the enums | |
const getEnum = (obj) => { | |
const EEnum = {} | |
if (Array.isArray(obj)) { | |
obj.forEach((enumerator, i) => EEnum[enumerator] = i) | |
} else { | |
Object.getOwnPropertyNames(obj) | |
.forEach(property => { | |
EEnum[property] = obj[property] |
This file contains 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 wordPlural = (word, amount) => { | |
word = word.toLowerCase() | |
if (amount === 1) { | |
return word | |
} | |
return pluralize(word) | |
} | |
const pluralize = word => { |
This file contains 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
/** | |
* Demonstrates Imprecision in C# floats running on top of .NET Core 3.1 | |
**/ | |
using System; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
float n = 1.00f; |
NewerOlder