Skip to content

Instantly share code, notes, and snippets.

View fjenett's full-sized avatar
💤
(offline)

Florian Jenett fjenett

💤
(offline)
View GitHub Profile
// draw a rect filled with diagonal stripes
void setup ()
{
size( 200, 200 );
}
void draw ()
{
background(255);
// 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);
// 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);
// Atkinson dither translated from a Python source
PImage img;
void setup()
{
img = loadImage("ball.jpg"); // add some image here!
size( img.width, img.height );
}
// using boolsche settings
// the settings
int SET1 = 1;
int SET2 = 1 << 1;
int SET3 = 1 << 2;
// set a preference variable
// 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 ()
{
// 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 );
// 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;
<!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;
}
#! /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')