Skip to content

Instantly share code, notes, and snippets.

View themasch's full-sized avatar

Mark Schmale themasch

View GitHub Profile
var sys = require('sys'),
http = require('http'),
fs = require('fs'),
couchdb = require('./lib/couchdb'),
client = couchdb.createClient(5984, 'localhost'),
db = client.db('chat');
function chat(port) {
this.createServer(port);
}
<?php
/**
* Sound-Generation.FM v3.0
*
* @copyright Copyright (c) 2010 by sound-generation.fm
* @author Rico "Mahribarius" Schäfer <drognanexcata@gmx.de>
* @author Mark "MaSch" Schmale <ma.schmale@googlemail.com>
* @package SG.FMv3
* @version $Id: DB.php 119 2010-06-03 00:40:56Z masch $
*/
<?php
class db {
// Eigenschaft um die Datenbankverbindung zu speichern.
protected static $con = null;
// Zugangsdaten als Parameter weil global böse ist
public static function createConnection($host, $name, $user, $pass) {
// neue Verbindung erzeugen und in Klasse speichern.
self::$con = new mysqli($host, $user, $pass, $name);
<?
include("inc/connect.php");
include("inc/inc.php");
include("inc/settings.php");
mysql_query("UPDATE user_groups SET
news='1',
polls='1',
user='1',
... lots of stuff that looks normal...
Finished parsing scripts for resource group Popular
*** defineTerrain ***
Terrain created; size=513 minBatch=33 maxBatch=65 treeDepth=4 lodLevels=5 leafLods=2
High-level program OgreTerrain/1034306555/sm2/vp/hlod/hlod encountered an error during loading and is thus not supported.
OGRE EXCEPTION(3:RenderingAPIException): Failed to preprocess shader OgreTerrain/1034306555/sm2/vp/hlod/hlod in loadFromSource at /var/tmp/portage/dev-games/ogre-1.7.1/work/ogre_src_v1-7-1/RenderSystems/GL/src/GLSL/src/OgreGLSLProgram.cpp (line 155)
High-level program OgreTerrain/1034306555/sm2/fp/hlod encountered an error during loading and is thus not supported.
OGRE EXCEPTION(3:RenderingAPIException): Failed to preprocess shader OgreTerrain/1034306555/sm2/fp/hlod in loadFromSource at /var/tmp/portage/dev-games/ogre-1.7.1/work/ogre_src_v1-7-1/RenderSystems/GL/src/GLSL/src/OgreGLSLProgram.cpp (line 155)
High-level program OgreTerrain/1034306555/sm2/vp/llod/llod encountered an error during loadi
TextProxy *tp = new GraphicsTextProxy(blafoo);
/* edit: missed the new */
/*
* this should call GraphicsTextProxy::setText
*/
tp->setText("random");
/*
*but it calls TextProxy::setText
* WHY? And how to change it?
@themasch
themasch / mysql2sqlite.sh
Created April 4, 2011 21:54
simple shell script to translate a mysql database into a sqlite create script
#!/bin/sh
mysqldump --compact --compatible=ansi --default-character-set=binary -u ${1} -p ${2} |
grep -v ' KEY "' |
perl -e 'local $/;$_=<>;s/,\n\)/\n\)/gs;print "begin;\n";print;print "commit;\n"' |
perl -pe '
if (/^(INSERT.+?)\(/) {
$a=$1;
s/\\'\''/'\'\''/g;
s/\\n/\n/g;
s/\),\(/\);\n$a\(/g;
@themasch
themasch / example.fussl
Created April 4, 2011 22:46
fussl syntax definition
public locked A = {
public init = function() {
// dies ist der konstruktor
};
public methodA = function(p1, p2) {
while(p1<=p2) {
p1++;
}
@themasch
themasch / grep.js
Created April 20, 2011 16:38
grep over your js arrays
var grep = function(pattern, invert) {
invert = invert || false
var ret = [];
if(this.filter) {
ret = this.filter(function(element) {
var b = element.match(pattern);
return b && !invert || invert && !b;
});
} else {
@themasch
themasch / parser.cpp
Created April 27, 2011 12:28
Bla Foo
QPointF *parsePoint(QString in)
{
QStringList lst = in.split(", ");
if(lst.count() == 2) {
QString first = lst.at(0);
QString sec = lst.at(1);
bool fok, sok;
double a = first.toDouble(&fok);