Lovingly skimmed from this guide
- Find your local host name, and hang onto it for later use
$ hostname
- Create a self-signed SSL cert:
openssl req -new -x509 -days 365 -sha1 -newkey rsa:1024 -nodes \
Lovingly skimmed from this guide
$ hostname
openssl req -new -x509 -days 365 -sha1 -newkey rsa:1024 -nodes \
#!/bin/bash | |
EMAIL='YOUR_EMAIL' # edit this | |
PASS='YOUR_PASSWORD' # edit this | |
COOKIES='cookies.txt' | |
USER_AGENT='Firefox/3.5' | |
curl -X POST 'https://github.com/login' --verbose --user-agent $USER_AGENT --data-urlencode "name=${EMAIL}" --data-urlencode "pass=${PASS}" --cookie $COOKIES --cookie-jar $COOKIES | |
curl -X GET 'https://github.com/dashboard/pulls' --verbose --user-agent $USER_AGENT --cookie $COOKIES --cookie-jar $COOKIES |
'use strict'; | |
// Add ECMA262-5 method binding if not supported natively | |
// | |
if (!('bind' in Function.prototype)) { | |
Function.prototype.bind= function(owner) { | |
var that= this; | |
if (arguments.length<=1) { | |
return function() { | |
return that.apply(owner, arguments); |
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/javascript");</script> |
The game we're building is a simple side-scrolling racing game. The player's car is static on the screen, only the background is moving. The enemies are planes whom the player must dodge using the up and down arrow keys. If the player hits a plane, he dies. One point is given each time a plane goes off screen without touching the player.
Our game is composed of sprites. Each sprite has a position (x, y), velocity (speed) and one image, or more if animated.
Images are loaded from the DOM using their CSS selector (imagesSelector
). We use ID selectors (#name
) for single images and class selectors (.name
) for animated sprites composed of several images.
See the images used in the game.
/** | |
* UMD pattern with anonymous function expression | |
*/ | |
(function(){ | |
var umd = function(factory){ | |
if (typeof exports === 'object') { | |
return module.exports = factory(); | |
} | |
else if (typeof define === 'function' && define.amd) { |