Skip to content

Instantly share code, notes, and snippets.

View ggoodman's full-sized avatar

Geoff Goodman ggoodman

View GitHub Profile
<html>
<head>
<title>You are here!</title>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('jquery', '1.3');
google.load('maps', '2');
google.setOnLoadCallback(function(){
var map = new google.maps.Map2(document.getElementById("map_canvas"));
var loc = new google.maps.LatLng(google.loader.ClientLocation.latitude, google.loader.ClientLocation.longitude);
<?php
$title = "Home";
?>
<?php include('fragment.header.php'); ?>
<?php $blog->articles
->prefetch('user') // Pre-populate the $user member
->aggregate('tags') // Call the aggregateTags method of Article on the Query
->paginate(20) // Tweak the Query for pagination and add $pager to $blog->articles
<?php
class User extends FAEntity {
public function setTableDefinition() {
$this->setTableName('user')
$this->hasColumn('id', array(
'primary' => TRUE,
'autoIncrement' => TRUE,
express = require 'express'
app = module.exports = express.createServer()
sys = require('sys')
fs = require('fs')
http = require('http')
connect = require 'connect'
auth = require 'connect-auth'
fb = require("./fb_creds.js")
async = new Async
async
.local
client: (msg) ->
console.log "CLIENT", msg
addTen: (n, cb) ->
cb(n + 10)
.remote('server', "Hello from the client")
$ = require('jquery')
$ ->
$('#input').keypress (e) ->
if e.keyCode == 10 || e.keyCode == 13
live.send 'relay', $('#input').val()
$('#input').val('').focus()
live = require('./live').client()
.expose
serverMessage: (name, message) ->
@ggoodman
ggoodman / server.js
Created April 19, 2011 14:11
Hello world node.js server
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(process.env.C9_PORT);
@ggoodman
ggoodman / buildSaveURL.js
Created July 23, 2011 20:17
buildSaveURL
buildSaveURL = function(content, mime) {
// Better feature detection would be needed for portability
urlBuilderBase = window.createObjectURL ? window : window.webkitURL;
// Create and fill the blob
bb = new BlobBuilder();
bb.append(content);
// Create and return the blog url
return urlBuilderBase.createObjectURL(bb.getBlob(mime));
@ggoodman
ggoodman / README.md
Created September 6, 2011 20:56
Slamikaze html5 game proof of concept

SLAMIKAZE

With your guns disabled and no other means of fighting back, your hopes of survival are all but lost. The enemy are savage, suicidal beasts who will follow you blindly to the furthest reaches of the universe.

Only one hope remains; if you are quick and clever, there might just be a chance... good luck.

How to play

  • Your ship (blue square) follows your mouse cursor closely
  • Enemy ships (red squares) follow your mouse cursor as fast as their weaker ships allow
  • Avoid enemy ships while causing them to collide in order to flee to safety
@ggoodman
ggoodman / bootstrap.js
Created October 5, 2011 15:26
Use socketstream in Cloud9IDE
coffee = require("coffee-script");
process.chdir(__dirname + "/example");
ss = require("socketstream/lib/main")
.init(false)
.process({
node: ["start example", "start", "example"]
});