Skip to content

Instantly share code, notes, and snippets.



View GitHub Profile
View arduino-mosquitto-basic-example.ino
#define DEBUG
#ifdef DEBUG
#define DEBUG_PRINT(str) Serial.println(str);
#define DEBUG_PRINT2(str1, str2) Serial.print(str1); Serial.println(str2);
#define DEBUG_PRINT(str)
#define DEBUG_PRINT2(str1, str2)
knee-cola / define-process-shim.js
Created Dec 5, 2018
Shim for `process` variable for CDN modules packed as UMD
View define-process-shim.js
if(!this.process) {
this.process = {};
if(!this.process.env) {
this.process.env = {};
if(!this.process.env.NODE_ENV) {
this.process.env.NODE_ENV = "production";
View chrome-mobile-footer-bug.html
knee-cola /
Last active Jun 26, 2022
tracking battery usage on Windows laptop

What's this?

This is a script, which tracks charging and discharging time of a Windows powered laptop.

It creates a log file, which contains information about time the laptop spend charging and discharging the battery. The collected information can give you a pretty good idea about the battery life of your laptop.

Here's a sample:

knee-cola /
Last active Jan 2, 2021
Concentric CSS config for VS Code extensions PostCSS Sorting & Sass Lint

What's this?

This is concentric configuration for PostCSS Sorting an Sass Lint Visual Studio code extensions.

The Sass Lint extension will check if the SCSS file is formated corectly, while PostCSS Sorting will help you automatically fix the property order.

How to install

Step1: First install both VS Code plugins.

View SphereControls.js
var SphereControls = function (camera, domElement, config) {
var self = this;
config = config || {};
domElement = ( domElement !== undefined ) ? domElement : document;
domElement.addEventListener( 'mousedown', onDocumentMouseDown, false );
domElement.addEventListener( 'mousemove', onDocumentMouseMove, false );
domElement.addEventListener( 'mouseup', onDocumentMouseUp, false );
View BallSpinerLoader.js
* @author knee-cola /
* Original file URL:
* This is a spinner/loader built for Three.js platform.
* It can be used to notify user that some resources are being loaded.
* I made it to replace pure CSS spinner, which was displayed in the
* overlay above the 3D animation, since it was slowing down WebGL
* How to use:
knee-cola / ProgressiveImgLoader.js
Last active Mar 2, 2022
simple progressive texture image loader for Three.js
View ProgressiveImgLoader.js
* @author knee-cola /
* Original file URL:
// This is a simple progressive image loader for Three.js
// It enables the smaller image files to be loaded first,
// before the big texture image is fully loaded.
// The images are loaded in the order they are passed
View ThreeUvMapper.js
// This function is based on the code found at (the original source doesn't work well)
// She following page explains how UV map should be calculated
// The following documentation shows what a apherical UV map should look like
var ThreeUvMapper = {
knee-cola / ThreeCSG.js
Last active Jan 12, 2021 — forked from chandlerprall/ThreeCSG.js
csg.js wrapper for three.js
View ThreeCSG.js
@author Chandler Prall <>
Wrapper for Evan Wallace's CSG library (
Provides CSG capabilities for Three.js models.
Provided under the MIT License