Skip to content

Instantly share code, notes, and snippets.

@indefinit
indefinit / sketch.js
Created November 24, 2015 19:51
Tall-short-example
//code by:
// https://github.com/Jared-Sprague
var spriteSheet;
var tall = 220;;
var short = 260;
var plantPosX = tall;//our plant position defaults to our tall position
function setup() {
createCanvas(600, 600);
background(200);
spriteSheet = loadImage('image/sprite_sheet.jpg');
@indefinit
indefinit / timing-list.js
Last active October 15, 2015 15:07
An example of using an object literal to schedule timing.
//define an object that holds lyrics and time codes
//key = time in millis
//val = "lyrics"
var timecodes = {
100 : "One, two, three! My baby don't mess around Because she loves me so This I know fo sho!",
5000 : "But does she really wanna But can't stand to see me walk out the door Don't try to fight the feeling Because the thought alone is killin' me right now Thank God for Mom and Dad For sticking to together Like we don't know how"
};
//function to process and schedule lyrics.
//we pass an object as parameter to this function
@indefinit
indefinit / tree-like-drawing.js
Created September 30, 2015 15:11
some ways of drawing tree like shapes in p5js. There is no right answer.
var branches = [];//holds a list of p5.Vectors
var trunkSize = 10.4;
var currentBranchLocL = null;
var currentBranchLocR = null;
function setup() {
createCanvas(windowWidth, windowHeight);
}
function draw() {
@indefinit
indefinit / basicMaterialSketch.js
Created August 7, 2015 14:42
basicMaterial test
var theta = 0;
function setup(){
createCanvas(windowWidth, windowHeight, 'webgl');
}
function draw(){
background(250, 250, 250, 255);
translate(-100, 0, -1000);
push();
@indefinit
indefinit / appquiter.sh
Created May 4, 2015 12:29
A small suite of simple bash scripts for use in long term installations (monitoring/maintenance, etc.)
#!/bin/sh
echo "shutting down [your app name] for the day" >> /Users/SI/Dropbox/InstallationLogs/[your app name here]/ProcessLog.txt
osascript -e 'tell application "[your app name]" to quit'
echo "successful shutdown at $(date)" >> /Users/SI/Dropbox/InstallationLogs/[your app name here]/ProcessLog.txt
@indefinit
indefinit / OscBlobSender.cpp
Last active August 29, 2015 14:16
Test for Blob sending over OSC in Cinder
/*
Copyright (c) 2010, Hector Sanchez-Pajares
Aer Studio http://www.aerstudio.com
All rights reserved.
modified for Blobs by Indefinit, Kevin Siwoff, 2015
This is a block for OSC Integration for Cinder framework developed by The Barbarian Group, 2010
Redistribution and use in source and binary forms, with or without modification, are permitted provided that
@indefinit
indefinit / OscListenerBlobApp.cpp
Last active August 29, 2015 14:16
Test for Osc Blob Listener in Cinder
/*
Copyright (c) 2010, Hector Sanchez-Pajares
Aer Studio http://www.aerstudio.com
All rights reserved.
modified for Blobs by Indefinit, Kevin Siwoff, 2015
This is a block for OSC Integration for Cinder framework developed by The Barbarian Group, 2010
Redistribution and use in source and binary forms, with or without modification, are permitted provided that
@indefinit
indefinit / 282X_programmer.ino
Created February 5, 2015 17:47
modification of WS282X pixel programmer sketch for Arduino
// WS282x programmer
// Takes some commands from the serial and allows you to program WS282x LED modules
//
// Should work with any 168, 328, or 32U4 based Arduino.
//
// to program a pixel, type into your Serial port:
// p n
//
// where n = pixel address number starting at 1
//
@indefinit
indefinit / ci-buffer-conversions.cpp
Last active May 5, 2017 21:57
Cinder: buffer data type conversions and processing
string bufferToString( const cinder::Buffer& buffer )
{
string s( static_cast<const char*>( buffer.getData() ) );
if ( s.length() > buffer.getDataSize() ) {
s.resize( buffer.getDataSize() );
}
return s;
}
uint8_t* bufferToUint8(const cinder::Buffer& buffer)
@indefinit
indefinit / bullet-collision.cpp
Created January 9, 2015 05:25
testing bullet physics collision in Cinder
Voxel* VoxelMapperApp::findVoxel(btRigidBody* pBody) {
// search through our list of gameobjects finding
// the one with a rigid body that matches the given one
for (std::vector<Voxel>::iterator iter = mVoxels.begin(); iter != mVoxels.end(); ++iter) {
if ((iter)->getPhyObj().get()->getRigidBody().get() == pBody) {
// found the body, so return the corresponding Voxel object
return &(*iter);//this feels janky!
}
}
return 0;