This file contains 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
script/generate plugin HelloWorld | |
# vendor/plugins/hello_world/init.rb | |
Rails.configuration.gem "sinatra" | |
Rails.configuration.middleware.insert_before("ActionController::Failsafe", "HelloWorld") | |
# vendor/plugins/hello_world/lib/hello_world.rb | |
# your sinatra app goes here... | |
require 'sinatra/base' | |
class HelloWorld < Sinatra::Base |
This file contains 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
# Distributed OS, Language Prototype II (Treetop) | |
# With Documentation | |
require 'rubygems' | |
require 'treetop' | |
module DiOS | |
grammar LangProto2 | |
# The main scope of a file. It's also the body of a thing! | |
rule ether |
This file contains 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
function Animation(canvasId, fps) { | |
this.canvas = document.getElementById(canvasId); | |
this.drawingContext = this.canvas.getContext('2d'); | |
this.fps = fps; | |
this.drawing = {}; | |
this.frame = 0; | |
this.start(); | |
} | |
Animation.prototype.start = function() { |
This file contains 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
<html> | |
<head> | |
<title>fast forward, clock</title> | |
<script src="canvas-animation.js"></script> | |
<script> | |
var anim; | |
function init() { | |
anim = new Animation('canvas', 45); | |
anim.drawing.clockBase = function(ctx, frame) { | |
ctx.save(); |
This file contains 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
<!-- WORKS!!! --> | |
<html> | |
<head> | |
<title>FaceMouse</title> | |
<script src="canvas-animation.js"></script> | |
<script> | |
var anim; | |
var mousex = 0; | |
var mousey = 0; | |
function init() { |
This file contains 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
<html> | |
<head> | |
<style> | |
body { | |
margin: 0px; | |
padding: 0px; | |
} | |
</style> | |
<script> | |
function init() { |
This file contains 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
{ | |
"scripts": [ | |
"game.js", | |
"physics.js", | |
"logic.js" | |
], | |
"resources": { | |
"res/background.png", | |
"res/message1.txt", | |
"res/message2.txt" |
This file contains 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 rounded rectangle path. | |
* | |
* x, y: position of the rectangle | |
* | |
* w, h: width and height of the rectangle | |
* | |
* r (Integer): the radius of each corner | |
* r (Array): an array of radii like so: |
This file contains 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
/* | |
* constructor for the Animator class. | |
* | |
* props: a list of initial properties. | |
*/ | |
Animator = function(props) { | |
this._iv = null; | |
for (prop in props) { | |
this[prop] = props[prop]; |
This file contains 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
function require(url) { | |
var script = document.createElement('script'); | |
script.src = url; | |
document.getElementsByTagName('head')[0].appendChild(script); | |
} |