Skip to content

Instantly share code, notes, and snippets.

View arcman7's full-sized avatar

Andrew Ryan Carpenter arcman7

  • Colossum
  • San Francisco
View GitHub Profile
@arcman7
arcman7 / AmmoDebugDrawer.ts
Last active August 9, 2022 01:43
Ammo Debug Drawer Interface Implementation
/* ADOPTED FROM
https://github.com/InfiniteLee/ammo-debug-drawer
*/
import Ammo from "ammo.js"
export const DefaultBufferSize = 3 * 1000000
export const AmmoDebugConstants = {
NoDebug: 0,
@arcman7
arcman7 / yuka.module.js
Created April 27, 2022 19:10
testing debugging changes to yuka code to return out of non-terminating while loops
/**
* The MIT License
*
* Copyright © 2022 Yuka authors
*
* 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
@arcman7
arcman7 / demo3dModel.js
Last active December 2, 2020 02:33
Minimal wc3 unit model rendering
const { vec3, vec4, mat4, quat } = window.glMatrix
var { ModelViewer, handlers, Scene, Camera } = ModelViewer.default.viewer
// shim methods and variables for custom mdx methods
// taken from https://github.com/d07RiV/wc3data/blob/master/src/mdx/viewer/camera.js
let vectorHeap = vec3.create();
let vectorHeap2 = vec3.create();
let vectorHeap3 = vec3.create();
let quatHeap = quat.create();
@arcman7
arcman7 / addBoldTags.js
Last active July 1, 2020 01:47
add bold tags
// Doesn't handle overlapping sequences (this was my answer when interview finished)
function addBoldTags(str, sub) {
let seen = {}
let p1 = 0
let curSub
let result = str.split('')
let offset = 0 //EDIT during interview did not initialize to zero
let count = 0 //EDIT during interview did not initialize to zero
while(p1 + sub.length < str.length + 1) {
curSub = str.slice(p1, p1 + sub.length)
@arcman7
arcman7 / getContinuousRoute.js
Last active May 29, 2019 01:09
continuous route coding challenge
/*
Changes made from where I left off in the hacker rank challenge-
1. fix typo: "seen[to].p = getNode(from, null, seen[to]);" -> "seen[to].parent = getNode(from, null, seen[to]);"
2. fix typo: "seen[from] = seen[to].p;" -> "seen[from] = seen[to].parent;"
3. fix typo: "seen[to] = seen[from.child];" -> "seen[to] = seen[from].child;"
4. add third condition block - where (seen[to] && seen[from]) evaluates to true - to deal with
linking together the disjoint linked lists
5. fill in both traversing helper methods
*/
@arcman7
arcman7 / solutions.js
Created May 10, 2019 18:46
balanced html tags / brackets
var str0 = `<div>\n<span>\n</div>\n</span>\n`; //expected false
var str1 = `<div>\n<span>\n</span>\n</div>\n</span>\n` //expected false
var str2 = `<div>\n<span>\n</span>\n</div>\n<span>\n`//expected false
var str3 = `<div>\n<span>\n</span>\n</div>\n` //expected true
var str4 = `<div>\n</div>\n`; //expected true
var str5 = `<div>\n</div>\n<span>\n</span>\n`; //expected true
var str6 = `<span>\n<div>\n</div>\n<span>\n</span>\n</span>\n`; //expected true
//nice short solution using a stack
function getType(tag) {