Skip to content

Instantly share code, notes, and snippets.

View oliverjumpertz's full-sized avatar
🏠
Working from home

Oliver Jumpertz oliverjumpertz

🏠
Working from home
View GitHub Profile
@oliverjumpertz
oliverjumpertz / simple-linear-regression.js
Created January 5, 2021 19:49
Simple linear regression implemented in JavaScript
const inputArray = [
{
squareMeters: 200,
priceInDollars: 190000
},
{
squareMeters: 100,
priceInDollars: 90000
},
{
@oliverjumpertz
oliverjumpertz / index.js
Created January 8, 2021 08:30
Calculating the simple and exponential moving average in JavaScript
function simpleMovingAverage(prices, window = 5, n = Infinity) {
if (!prices || prices.length < window) {
return [];
}
let index = window - 1;
const length = prices.length + 1;
const simpleMovingAverages = [];
@oliverjumpertz
oliverjumpertz / MyNFT.sol
Last active June 3, 2021 09:22
A basic ERC721 (NFT) implementation. Instantly runnable in remix.ethereum.org
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC721/ERC721.sol";
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/utils/Counters.sol";
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/access/AccessControl.sol";
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/utils/Context.sol";
contract MyNFT is Context, AccessControl, ERC721 {