Skip to content

Instantly share code, notes, and snippets.

View sameercharles's full-sized avatar

Sameer Charles sameercharles

  • Australia
View GitHub Profile
<!doctype html>
<html lang="en" class="h-100">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<title>Markov chain philosopher</title>
@sameercharles
sameercharles / puppeteer-screenshot-api.txt
Last active May 24, 2022 08:52
API route to capture and send page screenshot with Puppeteer and Express JS
const puppeteer = require('puppeteer')
app.get('/api/snapshot', async (req, res) => {
if (!req.query.url || !req.query.width || !req.query.height) {
res.status(400).send({message: 'Invalid input'})
return
}
// Create a snapshot and send it back
try {
const browser = await puppeteer.launch({ headless: true })
<style>
.game {
background-color: #f0f0f0;
border-radius: 10px;
padding: 10px;
max-width: 300px;
margin: auto;
}
#snake {