This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ... */ | |
class Vector2D { /* ... */ } | |
let showTracer = true | |
let vectorCount = 4 | |
let initState = [] | |
let vectors = [] | |
const handleInit = (arr) => { /* ... */ } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const background = document.querySelector('#background') | |
const canv = document.querySelector('#canvas') | |
const bgCtx = background.getContext('2d') | |
const canvMidX = canv.width * 0.5 | |
const canvMidY = canv.height * 0.5 | |
class Vector2D { /* ... */ } | |
const randomInRange = (min, max) => Math.floor(Math.random() * (max - min + 1) + min) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Vector2D { | |
constructor(sx=10, sy=10, size=50, angle=0) { | |
this.sx = sx | |
this.sy = sy | |
this.size = size | |
this.angle = angle | |
this.rotation = angle | |
this.rotationStep = 0 | |
this.color = '#000' | |
this.isPencil = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
constructor (firstName, lastName, birthday) { | |
this.firstName = firstName | |
this.lastName = lastName | |
this.birthday = birthday | |
} | |
sayHello () { | |
return `My name is ${this.firstName}` | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
constructor (firstName, lastName, birthday) { | |
this.firstName = firstName | |
this.lastName = lastName | |
this.birthday = birthday | |
} | |
sayHello () { | |
return `My name is ${this.firstName}` | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class API { | |
#url | |
#handleError (res) { | |
return res.ok ? res : Promise.reject(res.statusText) | |
} | |
constructor () { | |
this.#url = 'https://purelyawespme.com/api' | |
} | |
get (endpoint) { | |
return window.fetch(this.#url + endpoint, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const API = (function () { | |
const url = 'https://purelyawespme.com/api' | |
const handleError = (res) => res.ok ? res : Promise.reject(res.statusText) | |
const doGet = (endpoint) => window.fetch(url + endpoint, { | |
method: 'GET', | |
headers: new Headers({ | |
'Accept': 'application/json' | |
}) | |
}) | |
.then(handleError) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const firstName = 'John' | |
const lastName = 'Doe' | |
let sleepCounter = 0 | |
function sleep (firstName) { | |
return `${firstName} is asleep for the ${++sleepCounter} time` | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const user = { | |
firstName: "John", | |
lastName: "Doe", | |
sleepCounter: 0, | |
eat: function() {}, | |
sleep: function() { | |
return `${this.firstName} is asleep for the ${++this.sleepCounter} time`; | |
}, | |
code: function() {}, | |
repeat: function() {}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const server = express() | |
server.use(function (req, res, next) { | |
if (req.host !== 'localhost' && req.get('X-Forwarded-Proto') === 'http') { | |
res.redirect(`https://${req.hostname}${req.url}`) | |
return | |
} | |
next() | |
}) |
NewerOlder