Skip to content

Instantly share code, notes, and snippets.

<html>
<head>
<link rel="stylesheet" href="style.css"></link>
<script type="text/javascript" src="script.js"></script>
<title>Week 1 : Self-Portrait</title>
</head>
<body>
<button id="yesButton" onMouseDown='approved()'>4 rEaL?</button>
<h1 id="header">This is Rachel</h1>
<div class="container">
window.addEventListener('DOMContentLoaded', (event) => {
const playingVideo = (currentVideo) => {
let video = document.getElementById(currentVideo);
video.muted = true;
let isPlaying = video.currentTime > 0 && !video.paused && !video.ended
&& video.readyState > 2 && video.muted;
if (!isPlaying) {
video.play();
}
}
<html>
<head>
<link rel="stylesheet" href="style.css"></link>
<script type="text/javascript" src="/socket.io/socket.io.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body onload="initCanvas();">
<canvas width="500" height="500" id="mycanvas" />
</body>
</html>
let socket = io.connect('http://165.22.177.152:8080/');
socket.on('connect', function() {
console.log("Connected");
});
// Receive from any event
socket.on('othermouse', function (data) {
console.log(data.x + " " + data.y);
odraw(data.x,data.y);
// HTTP Portion
var http = require('http');
var fs = require('fs'); // Using the filesystem module
var httpServer = http.createServer(requestHandler);
var url = require('url');
httpServer.listen(8080);
function requestHandler(req, res) {
var parsedUrl = url.parse(req.url);
@raclim
raclim / style.css
Last active September 25, 2019 15:12
html {
background-color: #f7f5f5;
}
#mycanvas {
margin: 4em 20em;
box-shadow: 10px 10px 5px #ebc0c2;
}
<html>
<head>
<link rel="stylesheet" href="style.css"></link>
<script src="/socket.io/socket.io.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<div class="container">
<video id="thevideo" height="480" width="720"></video>
<canvas id="thecanvas"></canvas>
var https = require('https');
var fs = require('fs'); // Using the filesystem module
var url = require('url');
var options = {
key: fs.readFileSync('my-key.pem'),
cert: fs.readFileSync('my-cert.pem')
};
function handleIt(req, res) {
.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
}
window.addEventListener('load', function() {
// The video element on the page to display the webcam
var video = document.getElementById('thevideo');
// Constraints - what do we want?
let constraints = { audio: false, video: true };
// Prompt the user for permission, get the stream
navigator.mediaDevices.getUserMedia(constraints).then(function(stream) {
// Attach to our video object