Skip to content

Instantly share code, notes, and snippets.

View gengkev's full-sized avatar

Kevin Geng gengkev

  • Carnegie Mellon University
View GitHub Profile
@gengkev
gengkev / index.html
Created March 30, 2012 19:33 — forked from antimatter15/regeression.js
Linear Regression
<!doctype html>
<meta charset="UTF-8" />
<script src="linreg.js"></script>
<title>Linear Regressions in JS</title>
<script>
function $(d){return document.getElementById(d)};
var canvas, textarea, func = "linreg";
window.onload = function(){
canvas = document.getElementById("view");
textarea = document.getElementsByTagName("textarea")[0];
@gengkev
gengkev / interval.js
Created December 28, 2011 15:26 — forked from manast/interval.js
Accurate Javascript setInterval replacement
function Interval(func,duration){
if(typeof func !== "function") throw new TypeError("Expected function");
else if(typeof duration !== "number") throw new TypeError("Expected number");
this.func = func;
this.duration = duration;
this.baseline = +new Date();
(function(_this){
_this.timer = setTimeout(function(){