Skip to content

Instantly share code, notes, and snippets.

View mataspetrikas's full-sized avatar
🤔
busy busy

Matas Petrikas mataspetrikas

🤔
busy busy
View GitHub Profile
@mataspetrikas
mataspetrikas / fix jQuery.offset() in Mobile Safari (iPad, iPhone)
Created June 9, 2010 15:26
fix jQuery.offset() in Mobile Safari (iPad, iPhone)
// as of 1.4.2 the mobile safari reports wrong values on offset()
// http://dev.jquery.com/ticket/6446
// remove once it's fixed
if ( /webkit.*mobile/i.test(navigator.userAgent)) {
(function($) {
$.fn.offsetOld = $.fn.offset;
$.fn.offset = function() {
var result = this.offsetOld();
result.top -= window.scrollY;
result.left -= window.scrollX;
@mataspetrikas
mataspetrikas / Crystals
Created August 16, 2010 17:28
Processing: Crystals
int oWidth = 20;
int oHeight = oWidth;
int oX;
int oY;
void setup() {
size(800,600);
background(0);
oX = floor(random(width/oWidth)) * oWidth;
int oWidth = 20;
int oHeight = oWidth;
int oX;
int oY;
void setup() {
size(800,600);
background(0);
oX = floor(random(width/oWidth)) * oWidth;
@mataspetrikas
mataspetrikas / Crystals circles
Created August 16, 2010 17:30
Processing: Crystals circles
int oWidth = 20;
int oHeight = oWidth;
int oX;
int oY;
void setup() {
size(800,600);
background(0);
oX = floor(random(width/oWidth)) * oWidth;
@mataspetrikas
mataspetrikas / Your Hair for Me
Created August 17, 2010 12:29
Processing: Your Hair for Me
void setup() {
size(1000, 715);
background(255);
smooth();
}
void draw() {
stroke(0,random(10,16));
noFill();
beginShape();
@mataspetrikas
mataspetrikas / Your Hair for Me 03
Created August 17, 2010 17:24
Processing: Your Hair for Me 03
void setup() {
size(1000, 715);
background(255);
smooth();
}
void draw() {
stroke(0,random(10,16));
noFill();
beginShape();
@mataspetrikas
mataspetrikas / the pointer grow
Created August 18, 2010 18:22
Processing: The Pointer Grow
ArrayList points;
int progress = 2;
void setup() {
size(1200, 800);
background(250);
smooth();
frameRate(5);
points = new ArrayList();
points.add(new Point(width/2, height*0.45));
@mataspetrikas
mataspetrikas / Babel Tower
Created August 18, 2010 18:53
Processing: Babel Tower
ArrayList points;
int progress = 2;
void setup() {
size(1200, 800);
background(250);
smooth();
frameRate(5);
points = new ArrayList();
points.add(new Point(width/2, height*0.45));
@mataspetrikas
mataspetrikas / continuous array loop
Created September 1, 2010 15:26
simple continuous loop over array
// continuous loop over array pseudo-code example
var index = 0;
var arr = [1,2,3,4];
// once the step is done, let's jump to the next one
if(nextStep){
index = (index + 1) % arr.length;
}
@mataspetrikas
mataspetrikas / Infinite Draught
Created September 2, 2010 15:43
Processing: Infinite Draught
// Global variables
int X, Y;
int nX, nY;
int delay = 10;
// Setup the Processing Canvas
void setup() {
size( 800, 600 );
smooth();
strokeWeight(1);