Skip to content

Instantly share code, notes, and snippets.

/*
Geometry Library
All angles are in radian measurements
*/
// Point Object
function Point(x, y) {
this.x = x;
this.y = y;
};
registerEntity('player', {
poly: [[100, 100], [200, 100], [100, 200]],
init: function(that) {
},
render: function(that) {
ctx.strokeStyle = '#fff';
canvasUtils.drawPolygon(that.poly);
}
});
/*
Geometry Library
All angles are in radian measurements
*/
// Point Object
function Point(x, y) {
if (x.length === undefined) {
this.x = x;
this.y = y;
@MattRoelle
MattRoelle / gist:63b663a80da7cc79fc56
Created June 19, 2014 02:57
wavepot.com is my new addiction, livecoding in javascript
var generated = false;
var currentNote = false;
var bpm = 600;
var sequence = [
squareWave(50, 0.1),
sineWave(440, 0.4),
squareWave(50, 0.1),
sineWave(540, 0.4),
squareWave(50, 0.1),
@MattRoelle
MattRoelle / newwp.sh
Created July 10, 2014 15:14
New WP on localhost
#!/bin/sh
echo "# Downloading latest.tar.gz"
wget wordpress.org/latest.tar.gz
echo "# Extracting"
tar -xf latest.tar.gz
echo "# Cleaning Up"
mv wordpress/* .
rm -r wordpress
echo "# Setting up mysql"
mysql -u root -p -e "create database $1db; grant usage on *.* to $1user@localhost identified by '$2'; grant all privileges on $1db.* to $1user@localhost;"
jQuery(function($) {
function Demo() {
var i, j;
$('html').css('perspective', '2000px');
$('body').css({'transition': 'transform 0.1s ease-out'});
var mousePos = {};
$(window).mousemove(function(e) {
mousePos.x = e.clientX;
mousePos.y = e.clientY;
});
var actx = new AudioContext();
var sound = actx.createBufferSource();
var req = new XMLHttpRequest();
var audioFile = 'https://dl.dropboxusercontent.com/u/87705298/136351__djmastah__requiem-3.mp3';
req.open('GET', audioFile, true); req.responseType = 'arraybuffer';
req.onload = function() {
actx.decodeAudioData(req.response, function(buffer) {
sound.buffer = buffer;
(def start-grid [[0 0 0 0 0 1 0 0 0 0]
[0 0 0 0 1 0 0 0 0 0]
[0 0 0 0 1 0 0 0 1 0]
[0 0 0 0 0 0 0 0 1 0]
[0 0 0 0 0 0 0 0 1 0]
[0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 1 1 0 0 0]
[0 0 1 0 0 1 1 0 0 0]
[0 1 0 0 0 0 0 0 0 0]
[1 0 0 0 0 0 0 0 0 0]])
(require-macros :golly)
(local golly (require :golly))
(defentity test-entity [self props]
{:x 300 :y 200 :width 200 :height 200}
(mixins (golly.mixins.mouse-interaction))
(field :state
(statemachine :red
(transitions
(turn-red {:to :red})
;; Redux style state management
(local initial-state
{:screen nil
:energy 0
:deck (icollect [_ ct (ipairs [:scout :warrior :healer :archer :scout :scout :scout])]
(make-card ct))
:hand []
:field []
:discard []})