Skip to content

Instantly share code, notes, and snippets.


Benjamin E. Coe bcoe

View GitHub Profile
View PlaneTetris.js
// All the Tetris blocks are instances of this Block class.
Block = Class.extend({
init: function(game, grid, color) {
this.color = color;
this.grid = grid; = game;
this.x = 64;
this.y = -128;
this.rotation = 0;
from multiprocessing import Process, Queue
from amqplib import client_0_8 as amqp
from hackwars import SETTINGS
import simplejson as json
import threading
def handle_message(message):
import thread, time
import socket
from hackwars.orbited_server.comet import handle_request
from orbited import start
def listen():
comet_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
comet_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
def publish(self, access_token="", ip="", payload=""):
# Make sure the access token matches the IP.
user_check = hackwars.get_cache().get(ip)
if user_check == access_token:
conn = amqp.Connection(host=SETTINGS['rabbit_host'] + ":5672", userid="guest", password="guest", virtual_host="/", insist=False)
View orbited.js
* HackWars 2
* The main JavaScript entry-point.
var HackWars = Class.extend({
init: function() {
View schedgy.js
* The calendar widget.
* @param {jQuery object} $element an element to attach the calendar object to.
* @param {Date} dateObject the date of the first of the month.
* @param {Schedgy object} a reference to the parent schedgy object.
* @retrun calendar is initialized and attached to the element provided.
var Calendar = Class.extend({
days: {}, // Lookup a day in the calendar based on a key representing year/month/day.
View data.js
this.$ {
var userObject = $(this).data('class');
View tight-coupling.html
<script type="text/javascript">
$(document).ready(function() {
var value = $('#div-i-care-about').find('.value').text();
<div id="div-i-care-about">
<span class="value">30.5</span>
View template.html
<script type="text" id="template-user-side">
<img src="{md5}" width="24" height="24" />{first_name} {last_name} {days_assigned}
View spec.js
describe 'CouchConnector'
describe 'loadDocument with mocked connection'
lastURL = ''
c = new connector.connector({
port: 5984,
host: 'localhost',