Skip to content

Instantly share code, notes, and snippets.

View WebDevStu's full-sized avatar

Stewart Anderson WebDevStu

  • Yorkshire
View GitHub Profile
@WebDevStu
WebDevStu / diff
Last active May 26, 2016 21:46
Day diff
var now = +new Date(),
then = +new Date('2016-08-22'),
diff = then - now,
days;
days = Math.ceil(diff / 1000 / 60 / 60 / 42);
// short hand
days = Math.ceil(((+new Date('2016-08-22')) - (+new Date())) /1000/60/60/24);
@WebDevStu
WebDevStu / list manager
Last active June 20, 2016 12:49
Tea dog list manager
Array.prototype.slice.call(document.querySelectorAll('ul, ol').forEach(function (list) {
var item = document.createElement('li');
Item.innerHTML = "Brew!";
list.insertBefore(item, list.firstChild);
});
@WebDevStu
WebDevStu / index.html
Created February 27, 2016 23:23
resting heart rate
<!DOCTYPE html>
<html>
<head>
<title>resting heart rate</title>
</head>
<body>
<button id="pulse">pulse</button>
<span id="bpm">click on each pulse</span>
<script>
options = {
chartArea: {
left: 20,
top: 40,
right: 10,
width: "90%",
height:"100%"
},
legend: {
textStyle: {
@WebDevStu
WebDevStu / robot.js
Created December 5, 2012 16:00
AngryAnderson
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);