Skip to content

Instantly share code, notes, and snippets.

const _ = (window)? window._ : require('underscore');
const {sum} = (window)? window.util : require('./Util');
const checkBounds = (body, world)=>{
let {position:[posX, posY], extents: [extX, extY]} = body;
let {boundsMinX: minX, boundsMinY: minY, boundsMaxX: maxX, boundsMaxY: maxY} = world;
if((posX - extX) < minX){
onCollision(body, null,{
axis: 0,
offset: -(posX - extX - minX)
@jesterswilde
jesterswilde / itemComponent
Last active March 28, 2018 13:59
A code sample from a mobile app
//Item
import { h } from 'preact';
import { appMethodsToProps } from '../appData';
import { classNames } from '../../util';
export default appMethodsToProps(({ clickOnItem, index, itemName, cost, selected, alreadyPaid })=> (
<button
onClick={ ()=>clickOnItem(index) }
disabled={alreadyPaid}
@jesterswilde
jesterswilde / js
Created September 14, 2015 05:51
nQuees with Comments
findNQueens = function(nSize){
//make an array, and fill it with ordered numbers to n
var rows = [];
// rows will have 0 - n pushed to it, non inclusive
for (var i = 0; i < n; i++){
rows.push(i);
}
// final array that gets returned
var results = [];
// storage for what we currently have
@jesterswilde
jesterswilde / SpriteSheetRenderer.ms
Created February 8, 2015 15:25
Renders a sprite sheet from 3DS Max and kicks it to Unity
--Sprite Sheet Renderer by Corey Wolff
--Currently this is setup to use automatically spit out a sprite sheet to a specific location based on the
--CreateProject and CreateAsset script I made. It also wants to then have Unity chop up the sprite sheet.
--If people are intersted I could modify this to be a more generic version.
studioLib()
drvLibGame()