Skip to content

Instantly share code, notes, and snippets.

View brantz's full-sized avatar

Thomas Rudolf brantz

  • Givve
  • Munich, Germany
View GitHub Profile
package com.nagai.server;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.nagai.client.GameServerService;
@brantz
brantz / gist:841226
Created February 23, 2011 21:32
updateloop.java
public void tradeAcceptUpdateLoop() {
if (model.getTradingOfferStatus() == 2) {
log.log(Level.INFO, model.getPlayerColor()
+ "'s trade offer was accepted.");
killTimer();
Window.alert("Your trade offer was accepted");
} else if (model.getTradingOfferStatus() == 0) {
log.log(Level.INFO, model.getPlayerColor()
+ "'s trade offer was declined.");
killTimer();
@brantz
brantz / index.html
Created August 8, 2011 21:15
dw example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Check Magazine</title>
<link href="styles/check_cs5.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/check_menu.css" rel="stylesheet" type="text/css" />
</head>
@brantz
brantz / output.txt
Created December 29, 2011 14:55
output
[/]$ apt-get install apache2 libapache2-mod-jk
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap ssl-cert
Suggested packages:
www-browser apache2-doc apache2-suexec apache2-suexec-custom ufw tomcat6 libapache-mod-jk-doc
The following NEW packages will be installed:
apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapache2-mod-jk libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap ssl-cert
@brantz
brantz / return
Created January 20, 2012 22:56
return from httpbin
"origin": "188.174.193.115",
"files": {},
"form": {},
"headers": {
"Content-Length": "0",
"Accept-Language": "en-us",
"Accept-Encoding": "gzip, deflate",
"X-Forwarded-Port": "80",
"Host": "httpbin.org",
"Accept": "*/*",
@brantz
brantz / output.txt
Created November 20, 2012 10:19
pip install -r requirements.txt
Downloading/unpacking lxml (from -r requirements.txt (line 1))
Downloading lxml-3.0.1.tar.gz (3.2MB): 3.2MB downloaded
Running setup.py egg_info for package lxml
Building lxml version 3.0.1.
Building without Cython.
Using build configuration of libxslt 1.1.26
warning: no previously-included files found matching '*.py'
warning: no files found matching '*.txt' under directory 'src/lxml/tests'
Downloading/unpacking nose (from -r requirements.txt (line 2))
@brantz
brantz / open_immo.rb
Created November 20, 2012 11:10
factories/open_immo.rb
# encoding: UTF-8
def open_immo_listing
JSON.parse(File.read(File.dirname(__FILE__) + "/immo_net_listing.json"))
end
def open_immo_xml
File.read(File.dirname(__FILE__) + '/immo_net_listing_generated_valid.xml')
end
# encoding: utf-8
files = Dir.glob(File.dirname(__FILE__) + '*.json')¬
files.each do |file|
content = File.read(file)
content.gsub('amp;', '')
new = File.open(file, 'wb')
new << content
new.close
end
@brantz
brantz / server.py
Created December 5, 2012 13:53
the bottle server
#encoding: utf-8
from os import getenv
from error_mailer import ErrorMailer
from bottle import route, run, template, request, BaseResponse
import sys
import ConfigParser
import logging
class Server():
# check if python version is >= 2.7
@brantz
brantz / error_mailer_test.py
Created December 5, 2012 13:58
the webtest test
#encoding: utf-8
from webtest import TestApp
from webtest.debugapp import debug_app
from server import Server
import unittest
class ErrorMailerTest(unittest.TestCase):
def test_minimal_request(self):
self.app = TestApp(Server)