Skip to content

Instantly share code, notes, and snippets.

View bildepunkt's full-sized avatar

Chris Peters bildepunkt

View GitHub Profile
@xem
xem / readme.md
Last active April 5, 2024 23:16
Maths & trigonometry cheat sheet for 2D & 3D games

Conventions

  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;

@jesstelford
jesstelford / event-loop.md
Last active April 3, 2024 13:57
What is the JS Event Loop and Call Stack?

Regular Event Loop

This shows the execution order given JavaScript's Call Stack, Event Loop, and any asynchronous APIs provided in the JS execution environment (in this example; Web APIs in a Browser environment)


Given the code

@mauvm
mauvm / Jasmine-and-Babel6.md
Created November 12, 2015 10:51
Jasmine ES6 run script for use with Babel 6
$ npm install --save babel-cli babel-preset-es2015
$ npm install --save-dev jasmine

.babelrc:

{
 "presets": ["es2015"]
@staltz
staltz / introrx.md
Last active April 24, 2024 19:47
The introduction to Reactive Programming you've been missing
@jacobvosmaer
jacobvosmaer / gist:3187346
Created July 27, 2012 10:35
Open all files with git merge conflicts in Vim

Open all files with git merge conflicts in MacVim

git diff --name-only | uniq | xargs mvim

When git encounters a merge conflict, e.g. during a rebase, it drops you back into the shell with a dirty working directory. I like this one-liner for opening all files with a merge conflict in MacVim.

Once you're in Vim, you can then switch between the files with :n and :prev, or another favourite: :w | n (save current file and open the next command line-supplied file).

UPDATE: see below for a version that works with real terminal commands.

@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];