Skip to content

Instantly share code, notes, and snippets.

View secretrobotron's full-sized avatar
🙀
wow!

Bobby Richter secretrobotron

🙀
wow!
View GitHub Profile
void CXMLConfigurator::ParseXML(TiXmlElement const* root_element, std::string const* root_prefix) {
if (root_element) {
const TiXmlElement* child_element = root_element->FirstChildElement();
while(child_element) {
std::string prefix;
prefix = *root_prefix + ".";
const char* tag = child_element->Value();
const char* text = child_element->GetText();
if (tag) {
std::string key(prefix + tag);
CBaseDatorPtr* CConfigurator::Get(std::string const& key) {
CBaseDatorPtr* ptr = NULL;
std::map<std::string, CBaseDatorPtr>::iterator i = configuration_.find(key);
//just use the first one for now (if it exists at all)
if (i != configuration_.end()) ptr = &(i->second);
return ptr;
}
@secretrobotron
secretrobotron / closuresarefun.js
Created June 25, 2011 15:34
closures are fun
var Beep = function() {
var foofoo;
this.fun = function () {
foofoo=3;
};
};
(function(){
var foo;
Beep.prototype.bar = function () {
var paladin = new Paladin({
setup: function (paladin) {
paladin.tasker.add({...});
},
run: function (paladin) {
paladin.graphics.blah({...});
}
});
@secretrobotron
secretrobotron / gist:1250778
Created September 29, 2011 14:01
CubicVR Wireframe Syntax
var boxMesh = new CubicVR.Mesh({
primitives:{
type: "box",
size: 1.0,
material: material3,
uvmapper: uvcubic
},
wireframe: {
enabled: true,
triangulate: true,
@secretrobotron
secretrobotron / gist:2630165
Created May 7, 2012 20:23
TrackEvent documentation

Module: TrackEvent

Supports a single event in the Media > Track > TrackEvent model.

Class: TrackEvent

Represents and governs a single popcorn event.

  • param options : Options for initialization. Can contain the properties type, name, and popcornOptions. If the popcornOptions property is specified, its contents will be used to initialize the plugin instance associated with this TrackEvent.

Usage: TrackEvent(options)

Module: Comm

Allows communication between entities through postMessage.

Class: Comm

Lets entities communicate when communication restrictions exist by passing messages through postMessage.

  • param clientWindow : Window from/to which to send/receive messages
  • param readyCallback : Function to be called when link is set up

Usage: Comm(clientWindow, readyCallback)

this.getAABB = function(){
var aabb = [_sceneObject.position.slice(), _sceneObject.position.slice()];
if(_sceneObject.obj){
aabb = _sceneObject.getAABB();
aabb = [
aabb[0].slice(),
aabb[1].slice()
];
@secretrobotron
secretrobotron / gist:2725979
Created May 18, 2012 15:52
butter instancing
// Instance
define([], function(){
return function(ctor){
//assume `butter` is known
return function(){
var args = Array.prototype.slice.call(arguments).unshift(butter);
function(){
var _foo;
this.foo = _foo;
this.setFoo = function(value){
_foo = value;
};
}