Skip to content

Instantly share code, notes, and snippets.

class Paint {
height = 600;
width = window.innerWidth - 40;
constructor(canvas) {
this.appCanvas = document.querySelector(canvas);
this.appCanvas.height = this.height;
this.appCanvas.width = this.width;
this.canvasContext = this.appCanvas.getContext('2d');
this.brushSize = 20;
class WeatherApp {
constructor() {
this.baseUri = 'openweathermap.org/';
this.appKey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
this.town = 'Bishops Stortford';
this.newTown = '';
this.displayedLocation = '';
this.description = '';
this.icon = '';
this.values = {
const state = {
imageData: {},
pageNumber: 1,
totalPages: 0,
getMoreImages: true,
columnNumber: 0,
arrayIndex: 0,
idNum: 0,
};
class ColourGridGame {
constructor() {
this.container = document.querySelector('.grid-game-container');
this.canvas = document.createElement('canvas');
this.canvas.height = 600;
this.canvas.width = 600;
this.canvasCtx = this.canvas.getContext('2d');
this.grid = [
{coords: [0,0], hasSquare: false, colour: '', adjacentSquare: {left: null,right: 2,up: null,down: 5}},
{coords: [150,0], hasSquare: false, colour: '', adjacentSquare: {left: 1,right: 3,up: null,down: 6}},
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Weather App</title>
<!-- development version -->
<script src="https://unpkg.com/vue@next"></script>
<link rel="stylesheet" href="css/app-styles.css">
<template>
<main>
<header>
<h1 v-text="heading" class="center"></h1>
</header>
<ul>
<li :key="item.id" :id="item.id" v-for="item in items">
<span v-text="item.text" class="item" :class="item.status"></span>
<span class="btn tick" @click="taskDone">&#10003;</span>
<span class="btn delete" @click="deleteTask">X</span>
package main
import (
"regexp"
"strings"
"strconv"
"github.com/gin-gonic/gin"
"net/http"
"database/sql"
_ "github.com/go-sql-driver/mysql"
const network = new brain.NeuralNetwork();
const width = 320;
const guessResult = document.getElementById('guess-result');
const guess = document.getElementById('guess');
let height = 0;
let streaming = false;
let video = null;
let canvas = null;
let photo = null;
let photoButton = null;
const ballCount = 5;
const clink = 'clink';
let ballX = 240;
let canvas, stage, tweens, activeCount, text, frontlineX, backlineX, backlineY, lineEnd;
const init = () => {
canvas = document.getElementById('testCanvas');
stage = new createjs.Stage(canvas);
createjs.Sound.registerSound("clink.mp3", clink);
tweens = [];
/* Made using CreateJS */
const notesPath = 'notes/';
const notes = [
{src: 'C.mp3', id: 1, text: 'C'},
{src: 'D.mp3', id: 2, text: 'D'},
{src: 'E.mp3', id: 3, text: 'E'},
{src: 'F.mp3', id: 4, text: 'F'},
{src: 'G.mp3', id: 5, text: 'G'},
{src: 'A.mp3', id: 6, text: 'A'},