Skip to content

Instantly share code, notes, and snippets.

Drew Petersen kirbysayshi

Block or report user

Report or block kirbysayshi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View alea.js
// From http://baagoe.com/en/RandomMusings/javascript/
function Alea() {
return (function(args) {
// Johannes Baagøe <baagoe@baagoe.com>, 2010
var s0 = 0;
var s1 = 0;
var s2 = 0;
var c = 1;
if (args.length == 0) {
@kirbysayshi
kirbysayshi / convert.sh
Last active May 17, 2019
Convert JavaScript React components to TypeScript
View convert.sh
#!/bin/bash
# usage: ./convert.sh src/components
PATH_TO_JS=$1
git clone git@github.com:lyft/react-javascript-to-typescript-transform.git
pushd react-javascript-to-typescript-transform
yarn install
popd
@kirbysayshi
kirbysayshi / flatten_and_test.js
Last active May 14, 2019
flatten an object into a single depth using string keys
View flatten_and_test.js
require('tap-browser-color')();
var test = require('tape');
test('it flattens!', function(t) {
var input = {
users: [
{ name: 'name1', id: 1, image: { '64x64': 'http://1' } },
{ name: 'name2', id: 2, image: { '64x64': 'http://2' } }
],
errors: [ new Error('err1') ],
@kirbysayshi
kirbysayshi / LICENSE
Last active Feb 24, 2019
Hierarchical Spatial Hash Grid: extremely efficient spatial hashing for collision detection between objects of any size! This is an implementation in JS as described in http://www10.informatik.uni-erlangen.de/~schornbaum/hierarchical_hash_grids.pdf
View LICENSE
Copyright 2012 Andrew Petersen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR O
@kirbysayshi
kirbysayshi / mass-aggregation-change.sh
Created Nov 23, 2011
quick examples of how to change many many wsp (graphite/whisper) files settings
View mass-aggregation-change.sh
for f in $(find $1 -iname "*.wsp"); do
if [ -a $f ];
then /opt/graphite/bin/whisper-set-aggregation-method.py $f max;
fi;
done
@kirbysayshi
kirbysayshi / usb-install-howto.md
Created Aug 23, 2018
How to install Snow Leopard on a Dell Latitude D630. lol "easiest install ever"! From 2009-05-20, for posterity.
View usb-install-howto.md

Welcome to the easiest install on a D630 EVER.

This method is contingent on two things: you must have access to a Leopard installation, and you must have an 8gb or larger USB key.

EQUIPMENT Chameleon RC1 Binaries: http://chameleon.osx86.hu/file_download/23/Chameleon-2.0RC1-r431-bin.tar.gz Chameleon RC1 Package: http://chameleon.osx86.hu/file_download/22/Chameleon-2.0-r431.pkg.zip Retail DVD/Image 8GB USB Key (or larger) Necessary Kexts: AppleACPIPS2Nub.kext, ApplePS2Controller.kext, Disabler.kext, dsmos.kext

View LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Andrew Petersen <http://kirbysayshi.github.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@kirbysayshi
kirbysayshi / perlin-noise.js
Last active Mar 5, 2018
Code adapted and cleaned up from the C# implementation here http://flafla2.github.io/2014/08/09/perlinnoise.html. Specific changes: conversion to JS, removal of classes and stateful classes.
View perlin-noise.js
// Hash lookup table as defined by Ken Perlin. This is a randomly
// arranged array of all numbers from 0-255 inclusive.
const permutation = [ 151,160,137,91,90,15,
131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,
88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166,
77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,
102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196,
135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123,
5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,
View index.js
var createGame = require('voxel-engine')
function sphereWorld(x, y, z) {
// return the index of the material you want to show up
// 0 is air
if (x*x + y*y + z*z > 15*15) return 0
return 3
}
function flatWorld(i,j,k) {
@kirbysayshi
kirbysayshi / .gitignore
Last active Jan 9, 2018
testcast demonstrating rollup getting confused by the presence of "default" as a normal property.
View .gitignore
node_modules
dist
package-lock.json
You can’t perform that action at this time.