Skip to content

Instantly share code, notes, and snippets.

@rezoner
rezoner / PropertiesAPI.js
Created January 30, 2016 20:51
Properties API for Canvas GUI
/* Properties are nothing more but a complex event handlers */
GUI.properties.myProperty = {
/* Order of appliance when set in group */
order: 3,
/* Rendering order to determine wheter it should be drawn before or after other properties */
@rezoner
rezoner / todo.md
Last active February 1, 2016 11:47

TODOS:

  • Image scaling mode: fit, cover, manual
  • Image positioning
  • Image padding
  • Multiple images
  • Multiple borderImages
  • Horizontal scroll and scrollbar
  • Optional scrollbar
  • Optional content scroll
@rezoner
rezoner / layers.js
Last active February 3, 2016 14:01
/*
What I would like to have is a way to build an element out of components.
Components can duplicate and order can be easily set.
*/
".content button": [
["image", "button.png", 0, 0],
["sprite", "flames", "center", "center"],
/* Paste that into console (F12) and hit enter */
setInterval(function() {
$("button[value=INCREASE]").click()
}, 5000);
@rezoner
rezoner / robin.js
Last active April 3, 2016 16:31
A script that will click GROW button every 5 seconds, so u can go like poop or something.
/* Paste that into console (F12) and hit enter */
window.clicker = setInterval(function() {
$("button[value=INCREASE]").click()
}, 5000);
@rezoner
rezoner / Client.js
Created June 4, 2016 19:00
Time delta between websocket messages
var client = new WebSocket("ws://IP:1337");
var last = Date.now();
client.addEventListener("message", function(event) {
var delta = Date.now() - last;
console.log("Time since last message ", delta, "ms");
@rezoner
rezoner / is_port_taken.js
Created February 4, 2017 12:52
NodeJS is port taken
function isPortTaken(port, fn) {
var net = require('net')
var tester = net.createServer()
.once('error', function(err) {
return fn(err);
})
.once('listening', function() {
/* You can reach absolute boundaries of game loop using events API. */
var app = playground({
});
app.on("step", function() {
stats.begin();
var app = playground({
ready() {
this.loaded = true;
/* Call resize manually if you need to */
this.resize();
},
{
translation: function(tx, ty) {
return [
1, 0, 0,
0, 1, 0,
tx, ty, 1,
];
},
rotation: function(angleInRadians) {