Skip to content

Instantly share code, notes, and snippets.

Avatar

J.D. Zamfirescu zamfi

View GitHub Profile
View dropping-circles.js
// dropping circles, phase 1
// the circles array!
var circles = [];
function setup() {
createCanvas(340, 340);
// add three circles
for (var i = 0; i < 3; i += 1) {
View arrays-of-objects.js
var people = [
{
name: "J.D. Zamfirescu",
food: "宫保鸡丁",
color: "blue"
},
{
name: "Adam Smith",
food: "小笼包",
color: "red"
View jd-object.js
var jd = {
name: "J.D. Zamfirescu",
food: "宫保鸡丁",
color: "blue"
};
textAlign(CENTER);
fill(0);
textSize(15);
View hues-array.js
var hues = [14,134,13,65,134,243,95,68,345];
colorMode(HSB);
noStroke();
for (var i = 0; i < hues.length; i += 1) {
fill(hues[i], 100, 100);
ellipse(20+i * 30, height/2, 15);
}
View pose-example.js
var poses = [
{
"nose": {
"x": 333.79916958873963,
"y": 281.8711811385424,
"confidence": 0.9843198657035828
},
"leftEye": {
"x": 385.9717814127604,
"y": 245.32875046163042,
View ngrams.txt
-ENDMESSAGE- because it :: 0.8181818181818182 (9:2)
-ENDMESSAGE- mile :: 0.18181818181818182 (2:9)
-ENDMESSAGE- thank you :: 0.7692307692307693 (10:3)
able to :: 0.7692307692307693 (10:3)
all agree :: 0.14285714285714285 (2:12)
all agree -ENDMESSAGE- :: 0.09090909090909091 (1:10)
average :: 0.21739130434782608 (5:18)
be able :: 0.8181818181818182 (9:2)
be able to :: 0.8181818181818182 (9:2)
be around :: 0.23076923076923078 (3:10)
View lights.ino
class Blinker {
public:
Blinker(int pin, float periodSeconds, float onSeconds = 0.5, float delayUntilStart = 0.0) {
this->pin = pin;
period = periodSeconds * 1000;
onTime = onSeconds * 1000;
offset = delayUntilStart * 1000;
nextOn = millis() + offset;
pinMode(pin, OUTPUT);
}
View move-trailer-generator.html
<html>
<head>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="tracery.js"></script>
<title>Text Generator</title>
</head>
<body>
<button onclick="addNewTrace()">One more!</button>
<div id="main"></div>
View pong.js
var puck = {
x: 200,
y: 200,
xSpeed: 3,
ySpeed: -1,
r: 15
};
var edgeOffset = 20;
var player1 = {
View circles-objects.js
var circles = [];
function setup() {
createCanvas(400, 400);
for (var index = 0; index < 100; index = index + 1) {
circles[index] = {
x: width / 2,
y: height / 2,
xSpeed: random(-5, 5),
You can’t perform that action at this time.