Skip to content

Instantly share code, notes, and snippets.

View pnakibar's full-sized avatar
👽

Pedro Mathias Nakibar pnakibar

👽
View GitHub Profile

VS Code Live Share

For fun and profit sharing

Why?

  • We at Klarna (or at least in my team) do lot's of mobs
  • Only watching your friend code? Not so fun
  • Why not make writing code a co-op experience?
  • Good way of pair/mob programming without a big screen

CO-OP

curl -X POST \
https://protected-bastion-53873.herokuapp.com/api/products \
-H 'authorization: d87cfe94-6665-4c63-b5b9-58a3c1498545' \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'postman-token: 16cf1324-58fb-da18-9741-0810db8e222a' \
-d '{
"price": 10,
"name": "Novo Produto"
}'
package beerzeit.utils;
import org.apache.commons.io.IOUtils;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;
import org.primefaces.model.UploadedFile;
import java.io.*;
/**
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Websocket tutorial</title>
<script src="http://localhost:3000/socket.io/socket.io.js"></script>
</head>
<body>
import express from 'express';
import bodyParser from 'body-parser';
import morgan from 'morgan';
import socketio from 'socket.io';
import http from 'http';
import socketioJwt from 'socketio-jwt'; // nova dependência!
import jwt from 'jsonwebtoken'; // nova dependência!
import cors from 'cors'; // nova dependência! para fazer o login
const users = [
import express from 'express';
import bodyParser from 'body-parser';
import morgan from 'morgan';
import socketio from 'socket.io';
import http from 'http';
const app = express();
app.use(morgan('dev'));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Websocket tutorial</title>
<script src="http://localhost:3000/socket.io/socket.io.js"></script>
</head>
<body>
@pnakibar
pnakibar / index.1.html
Last active October 3, 2016 04:36
primeira página para o tutorial de websockets
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Websocket tutorial</title>
<script src="http://localhost:3000/socket.io/socket.io.js"></script> <!-- pegando a dependência do servidor -->
</head>
<body>
@pnakibar
pnakibar / server.1.js
Last active October 3, 2016 04:34
Express.js em tempo real com Socket.io
import express from 'express';
import bodyParser from 'body-parser';
import morgan from 'morgan';
import socketio from 'socket.io'; // importando o socket.io
import http from 'http'; // talvez no seu projeto você não importe a biblioteca http, mas aqui é necessário
const app = express();
app.use(morgan('dev'));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
{
// ...
"scripts": {
// ...
"coverage": "babel-node node_modules/.bin/babel-istanbul cover _mocha -- ./test/* --recursive"
}
// ...
}