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
| // draw a rect filled with diagonal stripes | |
| void setup () | |
| { | |
| size( 200, 200 ); | |
| } | |
| void draw () | |
| { | |
| background(255); |
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
| // get number of days between two dates | |
| // jesusgollonet: http://www.jesusgollonet.com/blog | |
| // http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1147706465;start=3#3 | |
| int getDaysBetween (Date d1, Date d2) | |
| { | |
| int msPerDay = 1000 * 60 * 60* 24; | |
| long firstTime =d1.getTime(); | |
| long lastTime = d2.getTime(); | |
| int difference = floor(lastTime/msPerDay) - floor( firstTime/msPerDay); |
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
| // Bresenham Circle | |
| // http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1097973822;start=8 | |
| color black; | |
| int radius; | |
| void setup() | |
| { | |
| size(200, 200); | |
| colorMode(RGB, 100, 100, 100); |
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
| // Atkinson dither translated from a Python source | |
| PImage img; | |
| void setup() | |
| { | |
| img = loadImage("ball.jpg"); // add some image here! | |
| size( img.width, img.height ); | |
| } |
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
| // using boolsche settings | |
| // the settings | |
| int SET1 = 1; | |
| int SET2 = 1 << 1; | |
| int SET3 = 1 << 2; | |
| // set a preference variable |
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
| // Classic Bresenham line algorithm, by Josh Nimoy | |
| // http://processing.org/discourse/yabb/YaBB.cgi?board=general;action=display;num=1040549471 | |
| void setup() | |
| { | |
| size( 500, 500 ); | |
| } | |
| void 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
| // Find int that is closest evenly divisable by two for given int. | |
| void setup () | |
| { | |
| test ( 2 ); | |
| test ( 4 ); | |
| test ( 6 ); | |
| test ( 8 ); | |
| test ( 12 ); | |
| test ( 123 ); |
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
| // rectangle intersection with "not is outside" test | |
| class PRect | |
| { | |
| int x,y,w,h,c; | |
| PRect ( int _x, int _y, int _w, int _h, int _c ) | |
| { | |
| x = _x; | |
| y = _y; |
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
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
| <html xmlns="http://www.w3.org/1999/xhtml"> | |
| <head> | |
| <title>template test</title> | |
| <style type="text/css"> | |
| body { | |
| margin: 100px auto 0 100px; | |
| width: 500px; | |
| } |
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
| #! /usr/bin/ruby | |
| require 'iconv' | |
| require 'cgi' | |
| xml_index = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" | |
| xml_index += "<root>\n" | |
| ic = Iconv.new('UTF-8','LATIN1') |