Skip to content

Instantly share code, notes, and snippets.

View zeroeth's full-sized avatar
🤖
🐱 🤖 🐱 🤖

[0] zeroeth

🤖
🐱 🤖 🐱 🤖
View GitHub Profile
@zeroeth
zeroeth / marionetteview.js
Created February 11, 2014 19:48
Make model available to Backbone.Marionette View.
return Backbone.Marionette.ItemView.extend({
// Pass model to view because template 'this' is not current view.
// based on: https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.view.md#basic-example
//
templateHelpers: function() {
return { model: this.model };
}
});
@zeroeth
zeroeth / tmx.html
Last active June 20, 2020 19:16
tmx starter game
<html>
<head>
<script src='http://cdn.html5quintus.com/v0.2.0/quintus-all.js'></script>
<style>
canvas { background-color: #5e81a2; }
</style>
</head>
<body>
<script>
// This game uses spritesheet.png from:
@zeroeth
zeroeth / runnjump.html
Last active June 20, 2020 19:11
run and jump
<html>
<head>
<script src='http://cdn.html5quintus.com/v0.2.0/quintus-all.js'></script>
<style>
canvas { background-color: #5e81a2; }
</style>
</head>
<body>
<script>
// This game uses spritesheet.png from:
@zeroeth
zeroeth / asteroids.html
Last active August 29, 2015 13:55
asteroids 1
<html>
<head>
<script src='http://cdn.html5quintus.com/v0.2.0/quintus-all.js'></script>
<style>
canvas { background-color: black; }
</style>
</head>
<body>
<script>
// This game uses images from:
@zeroeth
zeroeth / notzork.js
Last active August 29, 2015 13:55
text adventure
// introduction
// a game with two rooms
// walk to next room
// grab an item
// (something good or bad happens)
var room1 = {
description: "A dark room full of holographic clowns"
}
@zeroeth
zeroeth / jump.js
Created February 1, 2014 17:01
simple jump game
var player1 = {name: "yoda", power: "jedi", age: 900};
var player2 = {name: "luke"}
var players = [player1, player2];
var jump = function(player) {
console.log(player.name + " jumps!");
}
@zeroeth
zeroeth / explicit_includeandextend.rb
Last active January 4, 2016 13:19
include override
module SwingableInstanceMethods
def instance_swing
puts 'Did an instance swing!'
end
end
module SwingableClassMethods
def static_swing
puts 'Did a static swing!'
end
@zeroeth
zeroeth / game.js
Last active March 27, 2022 14:17
javascript game basics.
var hit_enemy = function(enemy, weapon) {
if(enemy.state == "alive") {
enemy.health = enemy.health - weapon.damage;
console.log("hit!", enemy.health);
if(enemy.health <= 0) {
console.log("it died");
enemy.state = "dead";
}
}
{
"app/assets/javascripts/models/*.coffee": {
"command": "jmodel",
"alternate": "spec/javascripts/models/%s_spec.coffee",
"template": "class @AppName.Models.%S extends Backbone.Model"
},
"app/assets/javascripts/collections/*.coffee": {
"command": "jcollection",
@zeroeth
zeroeth / birthday.abc
Created January 19, 2014 09:58
Happy Birthday (In ABC notation)
X:72
T:Happy Birthday
M:3/4
L:1/4
K:G
V:1
|"G"D/2D/2|"G"E D G|"D"F2 D/2D/2|E D A|
"G"G2 D/2D/2|d B G|"C"F E2-|E2 c/2c/2|"G"B G "D"A|"G"G2|