Skip to content

Instantly share code, notes, and snippets.

View windmaomao's full-sized avatar

Fang Jin windmaomao

  • Raleigh, NC
View GitHub Profile
@windmaomao
windmaomao / aoc2015-d1-part1.kt
Last active September 18, 2020 17:35
Day 1: Not Quite Lisp, Part 1
// Aoc 2015 Day 1, Not Quite Lisp, Part 1
fun part1(ops: List<Int>) = ops.sum()
@windmaomao
windmaomao / animationStrategy.js
Created May 23, 2020 13:44
In doing so, we guarantee that the animation time is independent of how often the timer callback is actually executed. If there are big delays (due to other blocking events), this method may result in dropped frames.
const animationRate = 30; // 30 ms
let initialTime, elapsedTime;
function animate(deltaT) {
// calculate object positions based on deltaT
}
function onFrame() {
const currentTime = new Date().getTime();