Skip to content

Instantly share code, notes, and snippets.

View vanderlin's full-sized avatar

Vanderlin vanderlin

View GitHub Profile
int n = 10;
float xpos[] = new float[n];
float ypos[] = new float[n];
// --------------------------------------------------------
void setup() {
size(500, 500);
for (int i=0; i<n; i++) {
@vanderlin
vanderlin / GL Info
Last active December 18, 2015 10:38
static void getOpenGLCapabilities() {
printf("Getting OpenGL Capabilities\n");
// number of textures
GLint ntex;
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &ntex);
printf("Num Textures: %i\n", ntex);
// do we have point sprites
#include "testApp.h"
#include "ofxBox2d.h"
ofxBox2d box2d;
vector <ofxBox2dPolygon> triangles;
//--------------------------------------------------------------
void testApp::setup(){
ofSetFrameRate(30);
@vanderlin
vanderlin / Rotate Box2d Rect
Last active April 24, 2018 19:51
Rotate a box2d Rect
#include "testApp.h"
#include "ofxBox2d.h"
ofxBox2dRect centerRect;
ofxBox2d box2d;
vector <ofPtr<ofxBox2dCircle> > circles;
//--------------------------------------------------------------
void testApp::setup() {
#include "testApp.h"
ofEasyCam camera;
ofVec3f posA, posB;
ofVec3f velA, velB;
bool bTouchingA, bTouchingB;
bool bPressedA, bPressedB;
static float minMouseDis = 15.0;
#include "testApp.h"
class Plane {
public:
ofVec3f p0,p1,p2;
void set(ofVec3f pt0, ofVec3f pt1, ofVec3f pt2) {
p0 = pt0; p1 = pt1; p2 = pt2;
}
float distance(ofVec3f point) {
@vanderlin
vanderlin / Simple Singleton
Last active August 29, 2015 13:56
Simple Singleton JS
var MyClass = (function() {
var instance;
function init() {
// Private
var className = "CLASS";
var cb;
var GlobalClass = (function () {
var propA = 33;
var name = "Something";
var callback;
return {
value:33,
stringvar:"some string",
sayThis: function(e) {
callback = e;
[super viewDidLoad];
[self.navigationController.navigationBar setBackgroundImage:[UIImage alloc] forBarMetrics:UIBarMetricsDefault];
[self.navigationController.navigationBar setShadowImage:[UIImage alloc]];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
self.navigationController.navigationBar.titleTextAttributes = @{NSFontAttributeName:[UIFont fontWithName:APP_FONT_MARK_OT_BOLD size:15], NSForegroundColorAttributeName:[UIColor whiteColor]};
// this is kinda a hack...
UIBarButtonItem *backButton = [[UIBarButtonItem alloc]
initWithTitle: @""
@vanderlin
vanderlin / gist:c36c59f8f7463c24c081
Created February 20, 2015 15:18
Stop Bootstrap from modal shift
.modal {
overflow-y: auto;
}
.modal-open {
overflow: auto;
}
.modal-open[style] {
padding-right: 0px !important;
}