Skip to content

Instantly share code, notes, and snippets.

@born2frag
born2frag / sss.js
Created December 12, 2013 09:45
Show screen size (browser) - chrome snippet
var vars = {};
api = {
  viewport: function() {
    var e = window, a = 'inner';
    if (!('innerWidth' in window )) {
      a = 'client';
      e = document.documentElement || document.body;
    }
    return { width : e[ a+'Width' ] , height : e[ a+'Height' ] };
@born2frag
born2frag / dragongame.js
Created November 26, 2013 14:48
Small JS dragon game with loops (if,while,for)
var slaying = true;
var youHit = Math.floor(Math.random()*2);
var damageThisRound = Math.floor(Math.random()*2);
var totalDamage = 0;
while(slaying)
{