Skip to content

Instantly share code, notes, and snippets.

@lamberta
lamberta / SeeInvisible.as
Created April 16, 2010 04:21
See-Invisible pv3d demo
/**
* To see the demo and a writeup, visit:
* http://lamberta.posterous.com/3d-flash-demo-see-through
*
* This software is release under the MIT License.
* Copyright (c) Billy Lamberta, 2008
* www.lamberta.org
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@lamberta
lamberta / gist:368010
Created April 16, 2010 04:34
pv3d materials sample
<instance_material symbol="lambert1SG" target="#myShaderName"/>
@lamberta
lamberta / VectorBend.as
Created April 16, 2010 04:41
Better-Bend-than-Break pv3d demo
/**
* VectorVision + AS3Dmod example, by Billy Lamberta <www.lamberta.org>.
**/
package {
import com.as3dmod.ModifierStack;
import com.as3dmod.modifiers.Bend;
import com.as3dmod.plugins.pv3d.LibraryPv3d;
import com.as3dmod.util.ModConstant;
import com.as3dmod.util.Phase;
import com.zavoo.svg.SvgPathsPapervision;
@lamberta
lamberta / Box2dScene.as
Created April 16, 2010 05:06
PaperBox2D.as demo
/* scenes/Box2dScene.as
*/
package scenes {
import Box2D.Collision.Shapes.b2PolygonDef;
import Box2D.Collision.b2AABB;
import Box2D.Common.Math.b2Vec2;
import Box2D.Dynamics.Joints.b2MouseJoint;
import Box2D.Dynamics.Joints.b2MouseJointDef;
import Box2D.Dynamics.b2Body;
import Box2D.Dynamics.b2BodyDef;
@lamberta
lamberta / gist:368058
Created April 16, 2010 05:33
.emacs todo-list-mode startup
(add-to-list 'load-path "~/emacs/lisp/") ;my lisp dir
(autoload 'todo-list-mode "todo-list-mode") ;load when needed
;a simple function that opens the file,
;and switches to todo-list-mode.
(defun open-todo-list ()
(interactive)
(find-file "~/notes/TODO")
(todo-list-mode))
@lamberta
lamberta / gist:368095
Created April 16, 2010 06:27
Doodle.js v0.1 web examples
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<!--[if IE]><script type="text/javascript" src="http://explorercanvas.googlecode.com/svn/trunk/excanvas.js"></script><![endif]-->
<script src="./doodle-0.1.js" type="text/javascript"></script>
<script type="text/javascript">
function init() {
//we'll be putting the rest of our javascript here!
};
</script>
@lamberta
lamberta / gist:368098
Created April 16, 2010 06:33
Doodle.js v0.1 web examples
var cx = oo.canvas().width/2;
var cy = oo.canvas().height/2;
var img_w = 271;
var img_h = 365;
var img = oo.image({src:'./img/face_271x365.png',
x:cx - img_w/2,
y:cy - img_h/2,
axis:{x:img_w/2,
y:img_h/2,
coord:'local',
@lamberta
lamberta / demo-bouncy_balls.html
Created April 17, 2010 23:16
Doodle.js v0.1 web demos
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Doodle.js Demo - Bouncy Balls</title>
<!--[if IE]>
<script type="text/javascript" src="http://explorercanvas.googlecode.com/svn/trunk/excanvas.js"></script>
<![endif]-->
<script type="text/javascript" src="http://cloud.github.com/downloads/biilly/doodle.js/doodle-0.1.1.min.js"></script>
@lamberta
lamberta / gist:582623
Created September 16, 2010 15:31
JavaScript Loop Speed Tests
/* JavaScript Loop Speed Tests.
* 100,000,000 iterations, average of 10 runs.
* Run on Chromium 6.0.472.53
*/
/* Basic for-loop
* 1056.9 ms
*/
for (var i=0; i < count; i++) {
1+1;
@lamberta
lamberta / profiling.js
Created September 18, 2010 04:13
JavaScript code profiling and stats tools.
/* JavaScript code profiling and stats tools.
*/
var timer;
(function () {
/* Stats for function execution.
* @param {Function} fn Function to time.
* @param {Array} params Arguments to supply to function.
* @param {Number} iterations Number of times to execute the given function.