Skip to content

Instantly share code, notes, and snippets.

View kixxauth's full-sized avatar

Kris Walker kixxauth

View GitHub Profile
@kixxauth
kixxauth / insult_handler.py
Created October 22, 2010 07:51
Insult server tutorial.
import logging
import time
import base_handler
class InsultServer(base_handler.BaseHandler):
def get(self):
# Log the user agent just for fun.
logging.info(self.user_agent_repr)
response = base_handler.Response(
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",
%%
%% jkp.erl Was created for The Hudson Valley Programmers' Meetup
%% homework assignment #13. The requirement is to build a
%% rock -- paper -- scissors game between parallel processes.
%% http://hvprogrammers.org/homework-13.html
%%
%% It's also my first experiment with Erlang.
%%
%% kixxauth@gmail.com
%%
/**
* URL encode an object.
*/
exports.encode = function encode(data) {
var postData = [], value, property;
for(property in data) {
if (Object.prototype.hasOwnProperty.call(data, property)) {
value = ((typeof data[property] === "undefined") && "undefined" ||
/**
* A simple parallel program in JavaScript for the Rhino JavaScript engine.
*/
// Set up the globals.
//
// While JavaScript allows all values and references in the global scope to be
// dynamic, only objects (JavaScript arrays and object natives) are mutable "in
// place". It is up to the programmer to keep the global namespace clear in a
// multithreaded environment. Because this is a simple program, I didn't do
/**
* A simple parallel program in JavaScript for the Rhino JavaScript engine.
*/
// Set up the globals.
//
// While JavaScript allows all values and references in the global scope to be
// dynamic, only objects (JavaScript arrays and object natives) are mutable "in
// place". It is up to the programmer to keep the global namespace clear in a
// multithreaded environment. Because this is a simple program, I didn't do