Skip to content

Instantly share code, notes, and snippets.

@servercharlie
servercharlie / smui.js
Created March 6, 2017 14:15
SMUI - Simple Memory Usage Info
/**
SMUI:
- Simple Memory Usage Info
Dependencies:
- pidusage (npm install pidusage --save )
- eventemitter3 (npm install eventemitter3 --save)
@servercharlie
servercharlie / client.js
Last active February 1, 2018 05:18
Proper PIXI window resizing, w/ jQuery.
/*
- Insert this after:
- referencing jquery.min.js
- referencing pixi.min.js
- creating your PIXI Application instance.
- Point being:
- Window resize binding fucks up if the document isn't ready yet, specially in Chrome.
- Hence, we use jQuery here to ensure the document is in fact ready first,
before we actually bind that shit.
@servercharlie
servercharlie / client.js
Last active March 28, 2019 13:31
Proper Socket.IO Latency Checking
/*
- Insert this after including / referencing socket.io.min.js.
- Point being:
- Client sockets *naturally* adapts its Ping Interval & Ping Timeout
from its server's settings, hence you can't actually those options here.
- We instead add an eventhandler for the "pong", and the actual millisecond latency,
and optionally to the "ping" too, in case you wanna see it in action.
- References:
@servercharlie
servercharlie / cordova-internet-access-fix.md
Created February 21, 2017 12:19
Fix: Cordova app can't access internet.

There also seems to be a separate issue where freshly created apps, or apps upgraded from older version of Cordova will have cordova-plugin-whitelist@1 installed automatically.

For some reason, this version of plugin does not work when installed in this automatic way (including the version installed by cordova create!) even with proper CSP and access tags.

Removing plugin and replacing it with cordova-plugin-whitelist@latest seems to fix the problem, up to and including to cause subsequent reinstallation of cordova-plugin-whitelist@1 to function properly.

@servercharlie
servercharlie / phaser_resolution.js
Created February 21, 2017 12:17
Device scaling factorr, pixi / phaser..
var configuration = {
'render' : Phaser.CANVAS, // Render type
'canvas_width_max' : 2048, // The maximum width of the canvas
'canvas_width' : 1000, // The width of the canvas
'canvas_height_max' : 2048, // The maximum height of the canvas
'canvas_height' : 650, // The height of the canvas
'scale_ratio' : 1, // Scaling factor
'aspect_ratio' : 1, // Aspect ratio
};