Skip to content

Instantly share code, notes, and snippets.

View systemsoverload's full-sized avatar

TJ Kells systemsoverload

View GitHub Profile
Blackjack.QC.RuleReview.Session = Ext.extend(
/**
* The Constructor!
* @constructor
*/
function( config ){
this.addEvents({
rulesParsed:true
@systemsoverload
systemsoverload / Session.js
Created February 14, 2012 21:56
EXT Sample
Blackjack.QC.RuleReview.Session = Ext.extend(
/**
* The Constructor!
* @constructor
*/
function( config ){
this.addEvents({
rulesParsed:true
@systemsoverload
systemsoverload / gist:3077048
Created July 9, 2012 15:04
Odd shaped polygon collision
HC = require 'lib.hardoncollider'
-- array to hold collision messages
local text = {}
-- this is called when two shapes collide
function on_collision(dt, shape_a, shape_b, mtv_x, mtv_y)
local player, floor
if shape_a == mouse then
player = shape_a
@systemsoverload
systemsoverload / gist:3107864
Created July 13, 2012 22:08
Polygon Collision Resolution
1. Calculate the minimum translation vector for all coliding objects
2. Sum the x and y directions ( sum(x(n)) > 0 = right, sum(y(n)) > 0 = down, etc)
3. With the direction(s) from 3, select the directions that has the minimum displacement along one axis. For instance Down and Left. If you have one block that wants to correct you to the left and one that wants to correct you to the right, there will be no horizontal correction.This works great if you have more than one object to collide with. If you only have one object, the axis with the least displacement will be chosen and tried.
Scenario one object: Falling, high velocity on Y-axis, lower on X. Two pixel width in X-collision, 10 pixels at Y. X would be displaced.
4. Apply the minimum displacement to that axis, check for collisions. Modify the axis speed accordingly. If you hit make a top collision, the Y-Velocity should be set to zero if it is point upwards, otherwise leave it.
5. If there still are collision, apply the minimum displacement for the o
var xxx = {
name: 'reptar'
}
var yyy = {
name: 'godzilla'
}
xxx.getBaz = function(){
return this.name;
function workIt(inputArray) {
putThingDown(inputArray);
var workedArray = reverseIt(flipIt(inputArray));
alert("Worked array contains:" + workedArray);
}
@systemsoverload
systemsoverload / gist:3296078
Created August 8, 2012 15:42
Google Doodle 08/08 AimBot
doodle = document.getElementById('hplogo');
fakeEvt = {preventDefault:function(){}}
function getPowerVal(){
if (ballCount==0){
return 210;
}
if (ballCount < 31){
return 120;
@systemsoverload
systemsoverload / gist:4113328
Created November 19, 2012 19:48
Raphael Object Connector
Raphael.fn.connection = function (obj1, obj2, color, bg) {
if (obj1.line && obj1.from && obj1.to) {
line = obj1;
obj1 = line.from;
obj2 = line.to;
}
var bb1 = obj1.getBBox()//Bounding box of the connectFrom node
, bb2 = obj2.getBBox() //Bounding box of the connectTo node
, connectionPoints // potential connecting points on the edge of the objects
from tastypie.fields import ToManyField
class ConditionalRelatedField(ToManyField):
truthy = set('1', 'true', 'yes')
def dehydrate_related(self, bundle, related_resource):
full = bundle.request.GET.get('include_entitites', '').lower()
if full not in self.truthy:
return related_resource.get_resource_uri(bundle)
else:
myFramework = {
viewport: {
height: "800"
, width: "800"
, color: "#cdcdcd"
, components: []
, render: function(){
//Destory viewport if it already exists
var existingVp = document.getElementById('myFramework-viewport');
if (existingVp){