Skip to content

Instantly share code, notes, and snippets.

Avatar

Glen Fraser totalgee

View GitHub Profile
@totalgee
totalgee / remove_if_vs_find_if.cpp
Last active Aug 7, 2020
remove_if bug (vs find_if)
View remove_if_vs_find_if.cpp
// Run this code here: https://coliru.stacked-crooked.com/a/1a9ad442077cd0f6
#include <vector>
#include <algorithm>
#include <iostream>
#include <memory>
int main()
{
std::vector<std::unique_ptr<int>> vec;
View SC_preprocessor_example.scd
(
// Look for strings like deg"1 2 ~ 4" for a \degree pattern with durations
var pattern = "(\\w{3})\"([^\"\n]*)\"";
preProcessor = { |code|
var curOffset = 0;
var pat = code.findRegexp(pattern).clump(3);
// pat.debug("pat");
pat.do{ arg p;
var fullMatch = p[0];
var patternType = p[1].last;
@totalgee
totalgee / PtimeChain.sc
Last active Apr 29, 2020
SuperCollider Event pattern similar to Pchain, except it merges "value events" from the right-hand patterns with the values and time structure of the first pattern.
View PtimeChain.sc
PtimeChain : Pattern {
var <>patterns;
*new { arg ... patterns;
^super.newCopyArgs(patterns);
}
<< { arg aPattern;
var list;
list = patterns.copy.add(aPattern);
@totalgee
totalgee / ScriptPerformanceComparisons.txt
Last active Aug 29, 2015
Performance comparison of ChaiScript w/ several other scripting languages
View ScriptPerformanceComparisons.txt
Summary for simple looped calculation (details and code below):
- on OS X 10.10.3, Mac Pro: 3,7 GHz Quad-Core Intel Xeon E5
Language Tested Version Best Time Relative Perf Notes
======== ============== ========= ============= =====
Node.js v0.10.33 0.0028 1
Lua v5.3.0 0.0098 3.5
SuperCollider v3.6.6 0.0138 4.9
Ruby v2.0.0p481 0.0143 5.1
Python v2.7.6 0.0413 14.8
You can’t perform that action at this time.