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
String[] listFileNames(String dir) { | |
File file = new File(dir); | |
if (file.isDirectory()) { | |
String names[] = file.list(); | |
StringList filelist = new StringList(); | |
for (String s : names) { | |
if (!s.contains("DS_Store")) { | |
filelist.append(s); |
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
void setup() { | |
size (400, 300); // make a canvas that's 300 x 300 | |
//SETTING UP MY UNDERLYING GRID STRUCTURE | |
int numImages = 12; | |
int colWidth = 10; //column width | |
int rowHeight = 10; //row height | |
int colNum = width/colWidth; | |
int rowNum = height/rowHeight; |
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
color col; | |
void setup() { | |
size(200, 100); | |
col = color(50, 100, 25); | |
} | |
void draw() { | |
background(0); | |
noStroke(); |
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 for Java 7 | |
// With Java 8 you can now say: | |
import javax.xml.bind.DatatypeConverter; | |
import java.nio.ByteBuffer; | |
import java.nio.IntBuffer; | |
// Load an image | |
PImage img = loadImage("file.jpg"); |
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
var fs = require('fs'); | |
var request = require('request'); | |
var url = 'https://farm8.staticflickr.com/7484/15685407577_d19030d469_m.jpg'; | |
var saveFile = 'test.jpg'; | |
request.head(url, getImage); | |
function getImage(err, res, body) { | |
var req = request(url); |
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
var canvas; | |
var button; | |
function setup() { | |
// Make a canvas | |
canvas = createCanvas(100,100); | |
// Make an HTML DOM element, a button! | |
// The button will have the word "submit" in it | |
button = createButton("submit"); |
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
compile-time: | |
Missing a semi-colon ";" | |
Missing left parentheses "(" | |
Missing right curly bracket "}" | |
The variable “myVar” doesn't exist. | |
The local variable “myVar” may not have been initialized. | |
The class “Thing” doesn't exist. | |
The function "myFunction()" expects parameters like this: myFunction(type, type, type, ...) | |
The method "function(type, type, type, ...)" doesn't exist. | |
Error on "_____" |
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
int val; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(3, INPUT); | |
} | |
void loop() { | |
val = analogRead(0); | |
Serial.write(val); |
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
var checkbox; | |
function setup() { | |
checkbox = createCheckbox('the label'); | |
checkbox.checked(true); // passing in an arg sets its state? | |
// What should this be called?? | |
// it's wrapping 'onchange' | |
checkbox.changed(myCheckedEvent); // even for when the user does something | |
} |
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
<html> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | |
<script language="javascript" src="../../lib/p5.js"></script> | |
<script language="javascript" src="sketch.js"></script> | |
<script language="javascript"> | |
//$(document).ready(function() { | |
window.onload = function() { | |
$('#defaultCanvas').appendTo("#container"); |