Skip to content

Instantly share code, notes, and snippets.

View marijn's full-sized avatar

Marijn Huizendveld marijn

View GitHub Profile
@lsmith77
lsmith77 / gist:4078842
Created November 15, 2012 14:22
stripping cookies for caching when using the Symfony2 HttpCache
<?php
require_once __DIR__.'/AppKernel.php';
use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class AppCache extends HttpCache
{
@davedevelopment
davedevelopment / index.php
Created November 13, 2012 16:36
Tinkering with a Hal resource DTO, separating the framework from the app and content negotiation
<?php
namespace Demo {
require __DIR__."/vendor/autoload.php";
use Nocarrier\Hal;
class Resource extends Hal {}
class ResourceResponse
@rebo
rebo / gist:4035073
Created November 7, 2012 22:46
saga outline
class CreatePartyAccountOrderSaga < Saga
attr_reader :saga_info
def initialize(saga_id, party_attributes, account_attributes, order_attributes)
@saga_id = saga_id;
start(party_attributes, account_attributes, order_attributes)
end
def start(party_attributes, account_attributes, order_attributes)
fiber_based_workflow do
party_id = saga_exec("Creating Party..."){CreateParty.execute(*party_attributes)}
raise CreatePartyFailedError, "Party Creation Failed" if timeout?
@pborreli
pborreli / gist:3906751
Created October 17, 2012 17:05
top 10 commands of one of my vagrant vm
cut -f1 -d" " ~/.bash_history | sort | uniq -c | sort -nr | head -n 10
142 bin/behat
61 php
27 cd
25 sudo
22 ls
15 ps
14 export
12 Xvfb
9 pear
@pierswarmers
pierswarmers / mobile-meta-links.html
Created October 11, 2012 23:36
iOS Web App Configuration
@jmather
jmather / AcceptHeaderKernelListener.php
Created September 29, 2012 22:48
RESTful Versioned API with Silex using Accept header
<?php
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class AcceptHeaderKernelListener implements EventSubscriberInterface
{
@edorian
edorian / gist:3636420
Created September 5, 2012 13:20
assertXPath
/**
* Assert that a XPath matches on a DomNode
*
* Uses the XPath Method boolean() to see if a node test evaluates to true
* It's true if one of the follow conditions is met:
*
* - a number is true if and only if it is neither positive or negative zero nor NaN
* - a node-set is true if and only if it is non-empty
* - a string is true if and only if its length is non-zero
* - an object of a type other than the four basic types is converted to a
@pierswarmers
pierswarmers / less_watcher.sh
Created September 4, 2012 04:24
Script to run watchr and compile LESS
#!/bin/bash
# These are the original commands, courtesy of:
# http://www.ravelrumba.com/blog/watch-compile-less-command-line/
# Requires watchr: https://github.com/mynyml/watchr
# watchr -e 'watch(".*\.less$") { |f| system("lessc #{f[0]} > #{f[0]}.css && echo \"#{f[0]} > #{f[0]}.css\" "}') }
# Requires inotify-tools: https://github.com/rvoicilas/inotify-tools
# while true;do N=`find -name "*.less" `;inotifywait -qe modify $N ;for f in $N;do lessc $f ${f%.*}.css;done;done
namespace Sagas
{
using System;
using System.Collections.Generic;
class Program
{
static ActivityHost[] processes;
@kriswallsmith
kriswallsmith / QSAListener.php
Created August 8, 2012 18:23
implements QSA on Symfony2 redirects
<?php
use JMS\DiExtraBundle\Annotation as DI;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
/** @DI\Service */
class QSAListener
{
private $blacklist;