This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File.open('test.txt', 'r+') do |f| | |
out = "" | |
f.each do |line| | |
out << line.gsub(/\[([^\]]+)\]\(([^)]+)\)/, '<a target="_blank" href="\2">\1</a>') | |
end | |
f.pos = 0 | |
f.print out | |
f.truncate(f.pos) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// usage for DSP | |
// https://github.com/vinniefalco/DSPFilters | |
#include "Dsp.h" | |
// variables... these filters want a float ** array, so I allocate it like this: | |
Dsp::Filter* f; | |
float* audioData[1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rename files: | |
find . -type f -iname "testApp.h" -exec rename 's/testApp/ofApp/' {} \; | |
find . -type f -iname "testApp.cpp" -exec rename 's/testApp/ofApp/' {} \; | |
#find and replace | |
find . -type f -iname "ofApp.h" -exec sed -i "" 's/testApp/ofApp/g' {} \; | |
find . -type f -iname "ofApp.cpp" -exec sed -i "" 's/testApp/ofApp/g' {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for hiro | |
//-------------------------------------------------------------- | |
void testApp::draw(){ | |
ofSetColor(255,0,127); | |
ofBeginShape(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// some small examples from in-class | |
f = { 1 + 1 + 1}; | |
f.value; | |
a = {SinOsc.ar(440)}.play | |
a.free |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// make a sphere | |
ofSpherePrimitive sph; | |
sph.set(100, 10); | |
ofMesh s = sph.getMesh(); | |
// grab the current camera | |
// this is to figure out where a camera "should" be, ie, for this overall picture where is the camera. | |
ofCamera mainCam; | |
mainCam.setupPerspective(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// This is a recipe from the O'Reilly Safari Cookbook | |
/// http://safari.oreilly.com/0596007612/cplusplusckbk-CHP-11-SECT-5 | |
/// Usage: | |
/// vector<int> v; | |
/// computeStats(v.begin( ), v.end( ), sum, mean, var, dev, skew, kurt); | |
#pragma once |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// was noticing sin(ofGetElapsedTimef()) gets crunchy at some point, because of lower resolution in sin / cos. here's an alternative function that seems to help... not tested for speed. | |
float ofGetElapsedTimeForSin(){ | |
long long timeNow = ofGetElapsedTimeMillis(); | |
long long modForTwoPi = (int)(TWO_PI*1000.0); | |
return ((float)(timeNow % modeForTwoPi)/1000.0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in main.cpp | |
ofAppGLFWWindow w; | |
ofSetupOpenGL(&w, 1024,432,OF_WINDOW); // <-------- setup the GL context | |
testApp * app = new testApp(); | |
app->WINDOW = &w; | |
ofRunApp(app); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in .h file: | |
ofNode a,b,c; | |
float aEnergy; | |
float bEnergy; | |
float aEnergySmth; | |
float bEnergySmth; | |
float time; | |
ofPolyline nodeLine; |
OlderNewer