This file contains hidden or 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
# PDE: | |
add_library('hype') | |
# processing.py: | |
# from hype.core.util import H | |
# from hype.core.interfaces import HCallback | |
# from hype.extended.behavior import HOscillator | |
# from hype.extended.drawable import HCanvas | |
# from hype.extended.drawable import HRect | |
# from hype.extended.layout import HGridLayout | |
# from hype.extended.util import HDrawablePool |
This file contains hidden or 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
import hype.core.util.*; | |
import hype.extended.drawable.*; | |
void setup() { | |
size(640,640); | |
H.init(this); | |
HRect rect1 = new HRect(100); | |
rect1.fill(#FF6600) // set fill color | |
.stroke(#000000, 150) // set stroke color and alpha |
This file contains hidden or 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
AudioContext = require('web-audio-api').AudioContext | |
Gibber = require('gibber.audio.lib/build/gibber.audio.lib.js') | |
// I want something truly random which can give a uniform distribution of integers | |
Random = require('random-js') | |
random = Random(Random.engines.browserCrypto) | |
// random.integer(30, 41) | |
Gibber.init() | |
Clock.bpm = 96 // 2500ms/whole, 625ms/quarter, 19.53ms/128th |
This file contains hidden or 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
On Mon, Dec 1, 2014 at 9:55 AM, Ben <[email protected]> wrote: | |
> Question: how hard would it be to integrate gibber.audio.lib running under | |
> node with Sublime 3? | |
LOL, I was already looking into this. Right now, I'm dead in the water. | |
The best thing I know of is SublimeREPL, but with ST3 under Win7 x64, I'm | |
getting OSError: [WinError 6] The handle is invalid every time I try to send | |
anything to Node. I've Googled around a bit, but I haven't found anything like | |
a solution yet. |
This file contains hidden or 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
import array | |
def setup(): | |
global vertexes | |
vertexes = array.array('f', (0,) * 12) | |
def draw(): | |
# drawing stuff here | |
def updateGeometry(): |
This file contains hidden or 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
'''A sketch inspired by (a radical misinterpretation of) the math from the | |
JS1K segment of Steven Wittens' "Making Things With Maths" video. Really, | |
everything is mine except the math in `segment.py`. See also | |
http://acko.net/blog/js1k-demo-the-making-of | |
Implemented in Processing.py/Processing 2.1 by Ben Alkov 11-16 Sept 2014. | |
''' | |
class Segment(object): | |
'''A Segment, which encapsulates its own position and color, and can draw |
This file contains hidden or 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
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible"> | |
<title>PyPy.js experiment</title> | |
<script src="http://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script> | |
<!-- shim for ES6 `Promise` builtin --> | |
<script src="./lib/Promise.min.js" type="text/javascript"></script> |
This file contains hidden or 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
"*": | |
"exception-reporting": | |
userId: "" | |
welcome: | |
showOnStartup: false | |
"sync-settings": | |
_analyticsUserId: "" | |
analytics: false | |
personalAccessToken: "" | |
gistId: "" |
This file contains hidden or 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
let range = function * (start = 0, end = null, step = 1) { | |
if (end === null) { | |
end = start | |
start = 0 | |
} | |
let value = start | |
while (value < end || end < value) { | |
yield value | |
value += step | |
} |
This file contains hidden or 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
// Return a value from a given range, which avoids zero, within a given tolerance. | |
function avoidZero(range, tolerance) { | |
// Return a random value in the range from `-range` to strictly less than | |
// `range`, excluding the inner range +/-`tolerance` (and, logically, zero as | |
// well). | |
let value = _.random(-range, range) | |
while (-tolerance < value && value < tolerance) { | |
value = _.random(-range, range) | |
} | |
return value |