Skip to content

Instantly share code, notes, and snippets.

variables:
node_version: 16.19.1
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
@mimiz
mimiz / Dockerfile
Created December 19, 2020 09:16
node-simple-exemple-inject-vars-with-docker
FROM node:12-alpine
ENV MYAPP_DB_URL=CHANGE_ME
EXPOSE 3000
WORKDIR /app
COPY package*.json ./
RUN npm install --production
COPY index.js ./
CMD ["node", "index.js"]
@mimiz
mimiz / scdf-deploy-with-binders.sh
Created August 9, 2020 08:45
scdf-deploy-with-binders.sh.medium
stream deploy uppercase --properties "deployer.http.kubernetes.createNodePort=true,app.http.spring.cloud.stream.bindings.output.binder=binder-one,app.transform.spring.cloud.stream.bindings.input.binder=binder-one,app.transform.spring.cloud.stream.bindings.output.binder=binder-two,app.log.spring.cloud.stream.bindings.input.binder=binder-two"
@mimiz
mimiz / configmap-scdf-server.yaml
Created August 9, 2020 08:45
configmap-scdf-server.medium
apiVersion: v1
kind: ConfigMap
metadata:
name: scdf-server
labels:
app: scdf-server
data:
application.yaml: |-
spring:
cloud:
@mimiz
mimiz / stream.deploy.sh
Created August 9, 2020 08:43
stream-uppercase-medium-deploy
stream deploy uppercase --properties "deployer.http.kubernetes.createNodePort=true"
@mimiz
mimiz / stream.create.sh
Created August 9, 2020 08:41
stream-uppercase-medium
stream create --name 'uppercase' --definition 'http | transform --expression=payload.toUpperCase() | log'
{
"disabled": false,
"bindings": [{
"type": "httpTrigger",
"name": "req",
"direction": "in",
"dataType": "binary",
"methods": [
"post"
]
const Emittery = require('emittery');
const myEmitter = new Emittery();
let value = 1;
myEmitter.on('event', () => {
value = 2
});
myEmitter.on('event', () => {
value += 2
});
myEmitter.emit('event');
const EventEmitter = require('events');
const myEmitter = new EventEmitter();
let value = 1;
myEmitter.on('event', () => {
setImmediate(() => {
value = 2
});
});
myEmitter.on('event', () => {
let value = 1;
setImmediate(() => {
value = 2;
})
console.log(value); // This will print 1.