Skip to content

Instantly share code, notes, and snippets.

View knee-cola's full-sized avatar


View GitHub Profile
#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 December 5, 2018 09:32
Shim for `process` variable for CDN modules packed as UMD
if(!this.process) {
this.process = {};
if(!this.process.env) {
this.process.env = {};
if(!this.process.env.NODE_ENV) {
this.process.env.NODE_ENV = "production";
knee-cola /
Last active January 23, 2023 14:43
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 January 18, 2024 11:07
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.

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 );
* @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 March 12, 2024 21:33
simple progressive texture image loader for Three.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
// 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 January 12, 2021 09:50 — forked from chandlerprall/ThreeCSG.js
csg.js wrapper for three.js
@author Chandler Prall <>
Wrapper for Evan Wallace's CSG library (
Provides CSG capabilities for Three.js models.
Provided under the MIT License