Skip to content

Instantly share code, notes, and snippets.

@x3ro
x3ro / gist:3240690
Created August 2, 2012 21:14
Terasology themeable UI brainstorming
{
"id": "main-menu",
"class": "UIWindow",
"children": [
{
"id" : "main-window",
"class" : "UIWindow",
"image" : "engine:bg.png",
},
@x3ro
x3ro / stateful_popover.js
Created July 16, 2012 11:07
StatefulPopover for Twitter Bootstrap
!function ($) {
"use strict"; // jshint ;_;
/* POPOVER PUBLIC CLASS DEFINITION
* =============================== */
var StatefulPopover = function ( element, options ) {
this.contentWasSet = false
@x3ro
x3ro / gist:2999594
Created June 26, 2012 22:05
Assoc.js Benchmark
function createRandomWord(length) {
var consonants = 'bcdfghjklmnpqrstvwxyz',
vowels = 'aeiou',
rand = function(limit) {
return Math.floor(Math.random()*limit);
},
i, word='', length = parseInt(length,10),
consonants = consonants.split(''),
vowels = vowels.split('');
for (i=0;i<length/2;i++) {
@x3ro
x3ro / gist:2909918
Created June 11, 2012 12:43
Running Timadorus Bookkeeper in Eclipse

The following steps worked for me in order to run the AttackProcessTest from inside Eclipse:

  1. Check out the entire project from the SVN url svn co svn+ssh://<haw username>@svn.informatik.haw-hamburg.de/srv/svn/timadorus
  2. cd to Bookkeeper/trunk and execute find . -type d -name ".svn" -exec rm -rf {} \; to delete all SVN directories (these interfered in the execution process from inside eclipse, at least for me on OS X)
  3. Import the project in eclipse
  4. Install Ivy from the eclipse update url http://www.apache.org/dist/ant/ivyde/updatesite
  5. Right-click on the build.xml file and choose "Ant Build"
  6. Locate the AttackProcessTest.java file and right-click, and choose Run As > JUnit Test (this will fail).
  7. Now right-click the file again, and choose Run As > Run Configurations.. and selected the "Environment" tab
  8. Now you must add the following environment variables:
<- "PUT /api/settings/ HTTP/1.1\r\nContent-Type: application/xml\r\nX-Billomatapikey: fb72f8e523cf97865005b18c569f3a24\r\nAccept: */*\r\nUser-Agent: Ruby\r\nConnection: close\r\nHost: myapitest.billomat.net\r\nContent-Length: 2443\r\n\r\n"
<- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<settings>\n <article-number-length type=\"integer\">0</article-number-length>\n <article-number-pre nil=\"true\"></article-number-pre>\n <client-number-length type=\"integer\">2</client-number-length>\n <client-number-pre nil=\"true\"></client-number-pre>\n <confirmation-email-body nil=\"true\"></confirmation-email-body>\n <confirmation-email-subject nil=\"true\"></confirmation-email-subject>\n <confirmation-intro nil=\"true\"></confirmation-intro>\n <confirmation-note nil=\"true\"></confirmation-note>\n <confirmation-number-length type=\"integer\">0</confirmation-number-length>\n <confirmation-number-pre nil=\"true\"></confirmation-number-pre>\n <credit-note-email-body nil=\"true\"></credit-note-email-body>\n <cr
@x3ro
x3ro / net_http_debug.rb
Created May 2, 2012 17:16 — forked from kaiwren/net_http_debug.rb
Enable debug for all Ruby HTTP requests
require 'net/http'
module Net
class HTTP
def self.enable_debug!
class << self
alias_method :__new__, :new
def new(*args, &blk)
instance = __new__(*args, &blk)
instance.set_debug_output($stderr)
instance
@x3ro
x3ro / gist:1917473
Created February 26, 2012 16:06
Weird PHP file-upload form behaviour
<?php
if( isset($_POST['submitted']) ) {
var_dump($_POST);
var_dump($_FILES);
}
?>
<!DOCTYPE html>
<html>
<head>
<title>PHP File Upload</title>
from Queue import Queue
from Queue import Empty
import threading
import time
def queueGetNowait(queue):
try:
return queue.get_nowait()
except Empty:
#!/usr/bin/env python
# -*- coding: utf8 -*-
# T → g(b|c)d
import sys
parseInput = sys.argv[1]
var produkteZuAngebot = (
from u in produkte
let produkt = Produktverwaltung.ProduktMitId(u.Key)
select new ProduktZuAngebot {Angebot = angebot, Menge = u.Value, Produkt = produkt}
).ToList();
angebot.ProduktAngebote = produkteZuAngebot;