Skip to content

Instantly share code, notes, and snippets.

@naholyr
naholyr / function-argnames.js
Created February 19, 2012 18:30
JS Introspection: extract function parameter names
Function.prototype.argNames = function () {
// Extract function string representation: hopefully we can count on it ?
var s = this.toString();
// The cool thing is: this can only be a syntactically valid function declaration
s = s // "function name (a, b, c) { body }"
.substring( // "a, b, c"
s.indexOf('(')+1, // ----------------^
s.indexOf(')') // ------^
);
@nikreiman
nikreiman / CallSuspendResume.cpp
Last active September 12, 2019 15:26
Code snippits for creating a VST 2.x plugin host
void resumePlugin(AEffect *plugin) {
dispatcher(plugin, effMainsChanged, 0, 1, NULL, 0.0f);
}
void suspendPlugin(AEffect *plugin) {
dispatcher(plugin, effMainsChanged, 0, 0, NULL, 0.0f);
}