Skip to content

Instantly share code, notes, and snippets.

View xosofox's full-sized avatar

Peter Dietrich xosofox

View GitHub Profile

Keybase proof

I hereby claim:

  • I am xosofox on github.
  • I am xosofox (https://keybase.io/xosofox) on keybase.
  • I have a public key whose fingerprint is A529 3A15 8FEA 4D76 C33C 87DC 39C0 237A 4B11 62BC

To claim this, I am signing this object:

if (Meteor.isServer) {
// update the appropriate rsvp entry with $
Parties.update(
{_id: partyId, "rsvps.user": this.userId},
{$set: {"rsvps.$.rsvp": rsvp}});
} else {
// minimongo doesn't yet support $ in modifier. as a temporary
// workaround, make a modifier that uses an index. this is
// safe on the client since there's only one thread.
var modifier = {$set: {}};
@xosofox
xosofox / gist:1293760
Created October 17, 2011 20:51
autoload config for PropelBundle tests with Symfony2
//had to add these prefixes to my autoload for the php-unit tests to run
//app/autoload.php
$loader->registerPrefixes(array(
'Twig_Extensions_' => __DIR__.'/../vendor/twig-extensions/lib',
'Twig_' => __DIR__.'/../vendor/twig/lib',
'BaseObject' => __DIR__.'/../vendor/propel/runtime/lib/om',
'Persistent' => __DIR__.'/../vendor/propel/runtime/lib/om',
'Propel' => __DIR__.'/../vendor/propel/runtime/lib',
@xosofox
xosofox / zzz.php
Created December 11, 2010 19:22
Aktuelle fehlerhafte ZZZ-Berechnung...
//
$aussetzen = 2 // oder ZZZ aus der SPielangabe
$possibles=0; //Anzahl möglicher Züge
//Und hier kommt der ZZZ-Berechner-Teil
//Grundidee: Schau, ob überhaupt schon so viele Züge gemacht wurden, wie ZZZ gesetzt ist. Wenn ja, dann lauf ZZZ züge zurück und hol von dort die neue Position
//Wenn beim zurücklaufen ein Crash auftritt, wird die anzahl der zurückzulaufenden Züge nochmals erhöht.... und dabei passt wohl was nicht?
if ($possibles==0)
<?php
//erst die Klasse
class Vector
{
private $x;
private $y;
@xosofox
xosofox / Vectors.class.php
Created November 25, 2010 10:00
Please improve this one!
<?php
//erst die Klasse
class Vector
{
private $x;
private $y;
@xosofox
xosofox / Random Wikipedia Page Title (de)
Created April 29, 2010 11:44
Retrieve Random Wikipedia Page Title
<?php
function randwik()
{
#retrieves a random page title from wikipedia
$ch = curl_init("http://de.wikipedia.org/wiki/Spezial:Random");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@xosofox
xosofox / Remember: stdClass
Created March 3, 2010 16:12
stdClass (note to self)
// I can never remember the "stdClass" - but it's extremely handy when creating an object that needs to be converted to JSON afterwards...
$c = new stdClass;