Skip to content

Instantly share code, notes, and snippets.

View devyn's full-sized avatar
👨‍💻
Nushell is really cool

Devyn Cairns devyn

👨‍💻
Nushell is really cool
View GitHub Profile
@devyn
devyn / #
Created August 28, 2009 21:58 — forked from rmanalan/gist:161461
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
# 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
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() {
<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();
<!-- WORKS!!! -->
<html>
<head>
<title>FaceMouse</title>
<script src="canvas-animation.js"></script>
<script>
var anim;
var mousex = 0;
var mousey = 0;
function init() {
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
</style>
<script>
function init() {
{
"scripts": [
"game.js",
"physics.js",
"logic.js"
],
"resources": {
"res/background.png",
"res/message1.txt",
"res/message2.txt"
/*
* 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:
/*
* 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];
function require(url) {
var script = document.createElement('script');
script.src = url;
document.getElementsByTagName('head')[0].appendChild(script);
}