Skip to content

Instantly share code, notes, and snippets.

View sebastianhaeni's full-sized avatar
🚀

Sebastian Häni sebastianhaeni

🚀
View GitHub Profile
@sebastianhaeni
sebastianhaeni / bezier.html
Last active June 30, 2017 09:21
Simple Demo to draw a bezier curve on a canvas
<!doctype html>
<html>
<body>
<canvas id="bezier" width="500px" height="500px" style="border: 1px solid black"></canvas>
<script>
let canvas = document.getElementById('bezier');
let ctx = canvas.getContext('2d');
const SCALE = 100;
@sebastianhaeni
sebastianhaeni / knapsack.js
Created February 24, 2017 10:10
A simple algorithm to solve the 1-0 knapsack problem
// result table
var B = [];
var utilities = [3, 4, 2, 3];
var weights = [3, 2, 4, 1];
// max weight
var W = 9;
// init table