This file contains hidden or 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
// All the Tetris blocks are instances of this Block class. | |
Block = Class.extend({ | |
init: function(game, grid, color) { | |
this.color = color; | |
this.grid = grid; | |
this.game = game; | |
this.x = 64; | |
this.y = -128; | |
this.rotation = 0; |
This file contains hidden or 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
from multiprocessing import Process, Queue | |
from amqplib import client_0_8 as amqp | |
from hackwars import SETTINGS | |
import simplejson as json | |
import threading | |
CONNECTION_LOOKUP = {} | |
def handle_message(message): |
This file contains hidden or 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
import thread, time | |
import socket | |
from hackwars.orbited_server.comet import handle_request | |
from orbited import start | |
def listen(): | |
try: | |
comet_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
comet_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) |
This file contains hidden or 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
@cherrypy.expose | |
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) |
This file contains hidden or 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
/** | |
* HackWars 2 | |
* | |
* The main JavaScript entry-point. | |
*/ | |
var HackWars = Class.extend({ | |
/** | |
* | |
*/ | |
init: function() { |
This file contains hidden or 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
/** | |
* 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. |
This file contains hidden or 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
this.$user.click(function() { | |
var userObject = $(this).data('class'); | |
userObject.handleClick(this); | |
}); |
This file contains hidden or 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 type="text/javascript"> | |
$(document).ready(function() { | |
var value = $('#div-i-care-about').find('.value').text(); | |
}); | |
</script> | |
<div id="div-i-care-about"> | |
<span class="value">30.5</span> | |
</div> |
This file contains hidden or 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 type="text" id="template-user-side"> | |
<li> | |
<a> | |
<img src="http://www.gravatar.com/avatar/{md5}" width="24" height="24" />{first_name} {last_name} {days_assigned} | |
</a> | |
</li> | |
</script> |
This file contains hidden or 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
describe 'CouchConnector' | |
describe 'loadDocument with mocked connection' | |
before | |
lastURL = '' | |
c = new connector.connector({ | |
port: 5984, | |
host: 'localhost', |
OlderNewer