Skip to content

Instantly share code, notes, and snippets.

View marisusis's full-sized avatar
🎹
vibing

Maris Usis marisusis

🎹
vibing
View GitHub Profile
document.onkeydown = function(e){
switch(e.key) {
case "1":
document.querySelectorAll("button.answerA")[0].click();
break;
case "2":
document.querySelectorAll("button.answerB")[0].click();
break;
case "3":
document.querySelectorAll("button.answerC")[0].click();
public enum RoomType {
}
public class Hotel {
private Room[] rooms;
public String name;
var log = require('util').log;
var http = require('http');
var express = require('express');
var app = express();
var server = http.createServer(app);
var path = require('path');
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
//implement http config
var AsciiImage = (function() {
var image = document.createElement('image');
var canvas = document.createElemnt('canvas');
var ctx = canvas.getContext('2d');
return function (url) {
image.src = url;
ctx.drawImage(image,0,0);
}
})();
// Author: Andrei Gheorghe (http://github.com/idevelop)
var ascii = (function() {
function asciiFromCanvas(canvas, options) {
// Original code by Jacob Seidelin (http://www.nihilogic.dk/labs/jsascii/)
// Heavily modified by Andrei Gheorghe (http://github.com/idevelop)
var characters = (" .,:;i1tfLCG08@").split("");
var context = canvas.getContext("2d");
var color = function() {
var hex = new RegExp("^([a-fA-F0-9]){3,6}$","g");
var rgb = new RegExp("(rgb\([0-255],[0-255],[0-255]\))","g");
return function(c) {
}
@marisusis
marisusis / iter.js
Created May 20, 2016 12:59
Iterate over a JSON object and create a html list.
var iter = function() {
var lev = 0;
var levels = [0,0,0,0];
var uls = [$('<ul>')];
return function(obj,level) {
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
levels[lev]++;
if (typeof obj[prop] == 'object') {
uls[lev].append($('<li>').text(prop + ":"));
function colCheck(a,b) {
var acx = a.w/2 + a.x,
acy = a.h/2 + a.y,
bcx = b.w/2 + b.x,
bcy = b.h/2 + b.y;
var w = (a.w + b.w)/2,
h = (a.h + b.h)/2,
dx = (acx - bcx),
dy = (acy - bcy);

Platformer Game

[x] Quad tree colision [ ] Monsters [ ] Lives [ ] Coins/Points