Skip to content

Instantly share code, notes, and snippets.

@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
};
@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 / 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 / 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 / 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 / steps.txt
Last active October 7, 2019 16:41
Setting up NodeJS w/ NPM + PM2 on Ubuntu 16.10 (Yakkety Yak!)
> SSH Login to your home directory.
> Get APT updates & upgrades.
sudo apt-get update
sudo apt-get upgrade
> NodeJS & NPM
> https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
> Installs the latest NodeJS & NPM, including the essential build tools (used by most packages).
@servercharlie
servercharlie / steps.txt
Last active September 22, 2017 13:22
MongoDB setup on Ubuntu 16.10 (Yakkety Yak!)
sudo apt-get update
sudo apt-get install mongodb
sudo nano /etc/systemd/system/mongod.service
> paste the shit below
> change your 'User=' value to your preferred user
> configure it with your dbpath & logpath
@servercharlie
servercharlie / notes.txt
Last active March 7, 2017 16:29
Musings on Azure VM setups
- portal.azure.com has that latest features compared to manage.windowsazure.com
- in portal.azure.com, you got two (2) deployment models: classic and resource-manager.
- resources deployed in classic won't be compatible with those deployed in resource-manager, same thing vice-versa.
on vm's, on opening ports:
- opening ports on manage.windowsazure.com is MANUAL, one-by-one, through your vm's endpoints.
- opening ports on portal.azure.com ALLOWS PORT RANGES, through your vm's network adapter's network security group.
- you can manage both inbound and outbound in your network security group.
- @ https://docs.microsoft.com/en-us/azure/virtual-machines/virtual-machines-windows-nsg-quickstart-portal
@servercharlie
servercharlie / steps.txt
Created March 7, 2017 17:03
Enabling root login in Ubuntu 16.10 (Yakkety YaK!) - Instant SFTP Access
> why enable root login?
> useful for dev purposes if you want instant sftp access.
> you can revert these settings anyways in case you decide to go for production.
sudo nano /etc/ssh/sshd_config
> change PermitRootLogin prohibit-password
> to PermitRootLogin yes