Skip to content

Instantly share code, notes, and snippets.

// Matrix with a strided array
class Matrix {
constructor (rows, cols) {
this.rows = rows;
this.cols = cols;
this.data = Array(rows * cols).fill(null);
}
get(x, y) {
const app = document.getElementById("app")
const render = (root) => {
let nodes = []
return function(strings, ...expressions) {
if (root.childElementCount > 0 && nodes.length > 0 && nodes.length === expressions.length) {
// update nodes in list with matching expressions
nodes.forEach((node, idx) => {
# Loan Calc
principle, interestRate, loanLength
principle * (interestRate / (1 - (1 + interestRate) ** -loanLength))
Loan Amount, Monthly Interest Rate (1% = 0.01), Loan Length in Months
Per Month

Permissions Table (mnt Smart)

Name type:web type:privileged type:certified
geolocation ! ! !
geolocation-noprompt
mmi-test
camera !
alarms
tcp-socket
udp-socket
@rgruesbeck
rgruesbeck / localStorage.js
Created September 27, 2019 02:49
localStorage wrapper for KaiOS
class Storage {
constructor(name) {
this.name = name;
this.read();
}
// return data
list() {
return this.read();
}
@rgruesbeck
rgruesbeck / van-lyfe-wifi.md
Created August 1, 2019 01:56
van lyfe wifi
@rgruesbeck
rgruesbeck / record.md
Last active July 23, 2019 23:31
record screen
  1. record with simplescreenrecorder to mkv
  2. make frames:
mkdir frames
ffmpeg -i input -vf scale=320:-1:flags=lanczos,fps=10 frames/ffout%03d.png
  1. convert to gif
convert -loop 0 frames/ffout*.png output.gif
@rgruesbeck
rgruesbeck / mobilebundle.js
Created July 5, 2019 23:04
HTML5 mobile games bundle
// Mobile fixes
// prevent scroll/refresh
document.addEventListener('touchmove', function(e) {
e.preventDefault();
}, { passive: false })
#!/bin/sh
# Black 0;30 Dark Gray 1;30
# Red 0;31 Light Red 1;31
# Green 0;32 Light Green 1;32
# Brown/Orange 0;33 Yellow 1;33
# Blue 0;34 Light Blue 1;34
# Purple 0;35 Light Purple 1;35
# Cyan 0;36 Light Cyan 1;36
# Light Gray 0;37 White 1;37
overview: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Optimizing_canvas
garbage collection: http://buildnewgames.com/garbage-collector-friendly-code/
bitwise optimizations: https://galactic.ink/journal/2011/11/bitwise-gems-and-other-optimizations/
perf: https://developers.google.com/web/tools/chrome-devtools/rendering-tools/