Skip to content

Instantly share code, notes, and snippets.

@kenhoff
kenhoff / parallaxStars.js
Created March 29, 2015 07:09
Field of parallaxed stars - Phaser
var game = new Phaser.Game("100", "100", Phaser.AUTO, '', { preload: preload, create: create, update: update });
var random = new Phaser.RandomDataGenerator()
function preload() {
game.load.image("star", "star1.png")
}
function create() {
game.world.setBounds(-1500, -1500, 3000, 3000)
@kenhoff
kenhoff / socks_checklist.md
Last active October 16, 2015 22:24
Socks Checklist

Socks Checklist

Sat Sun Mon Tue Wed Task
|     |     |     |     | Bring packages in from mail room & outside
|     |     |     |     | 1 can of food (rinse the old food down the drain, rinse the can out and recycle)
|     |     |     |     | Toss and refill cold water
|     |     |     |     | Refill dry food if needed
|     |     |     |     | Check to see if the roomba made it back alive

| | | | | Eat a banana

@kenhoff
kenhoff / server.js
Created October 2, 2015 21:36
A simple node.js server using harp.js and passport.js to only allow access to users in the Microsoft Azure AD.
// require('harp').server(__dirname, { port: process.env.PORT || 5000 })
console.log(process.env.NODE_ENV)
express = require('express')
session = require('express-session')
passport = require('passport')
harp = require('harp')
app = express()
app.use(session({ secret:"whatever"}))
@kenhoff
kenhoff / gifts.md
Last active November 30, 2015 05:42
things ken might want for gifts

things

books

  • the food lab's book
  • ansel adams: the camera
  • the nature of code
  • books of any webcomics i like: questionable content, problem sleuth, dresden codak
@kenhoff
kenhoff / socks.md
Created December 31, 2015 00:06
Socks' Catsitting Checklist

Socks' Catsitting Checklist

To feed Socks:

  1. Rinse her old crusty food down the garbage disposal
  2. Scrub her food bowl out with the crusty green & yellow sponge thing
  3. Open new can, or retrieve can from fridge
  4. Put half a can of food in bowl (cut it in half with a fork if needed, rinse fork)
  5. Cover leftover food with white plastic lid and put in fridge, or rinse out and throw can in recycling
Task Dec 30 Dec 31 Jan 1 Jan 2 Jan 3
@kenhoff
kenhoff / dbCall.js
Created January 9, 2016 21:00
Stubbing RethinkDB calls with Sinon
var r = require('rethinkdb');
dbCall = function(cb) {
r.connect(function(err, conn) {
// console.log("connected");
r.table('tv_shows').get(1).run(conn, function(err, result) {
cb(err, result)
})
})
}
@kenhoff
kenhoff / hofftech-standard-contract.md
Last active May 7, 2016 19:33
Hofftech Standard Contract

Hofftech Standard Contract

Between [company name]

And [client name].

Summary:

@kenhoff
kenhoff / background-and-progress-bars.html
Created December 7, 2017 15:32
background-and-progress-bars.html
<svg
viewBox="0 0 100 100"
class="waveform-container"
preserveAspectRatio="none"
>
<rect
class="waveform-bg"
x="0"
y="0"
height="100"
@kenhoff
kenhoff / bucket-values.md
Created December 7, 2017 15:34
bucket-values.md
indexes values in the bucket max
0 - 4 [ '-0.72', '0.95', '-0.92', '0.47', '-0.02' ] 0.95
5 - 9 [ '-0.76', '0.33', '-0.55', '-0.11', '0.00' ] 0.33
10 - 14 [ '-0.71', '-0.03', '-0.19', '-0.84', '0.13' ] 0.13
15 - 19 [ '-0.72', '0.70', '-0.96', '0.19', '-0.44' ] 0.70
20 - 24 [ '-0.27', '-0.25', '0.23', '-0.23', '-0.50' ] 0.23
...
@kenhoff
kenhoff / bucketing-algorithm.js
Created December 7, 2017 15:35
bucketing-algorithm.js
const NUMBER_OF_BUCKETS = 100; // number of "bars" the waveform should have
let bucketDataSize = Math.floor(decodedAudioData.length / NUMBER_OF_BUCKETS,);
let buckets = [];
for (var i = 0; i < NUMBER_OF_BUCKETS; i++) {
let startingPoint = i * bucketDataSize;
let endingPoint = i * bucketDataSize + bucketDataSize;
let max = 0;
for (var j = startingPoint; j < endingPoint; j++) {
if (decodedAudioData[j] > max) {
max = decodedAudioData[j];