Skip to content

Instantly share code, notes, and snippets.

View heddn's full-sized avatar

Lucas Hedding heddn

View GitHub Profile
@heddn
heddn / varnish
Created October 3, 2012 01:43
varnish daemon opts
# Configuration file for varnish
#
# /etc/init.d/varnish expects the variable $DAEMON_OPTS to be set from this
# shell script fragment.
#
# Maximum number of open files (for ulimit -n)
NFILES=131072
# Locked shared memory (for ulimit -l)
@heddn
heddn / backend.vcl
Created October 9, 2012 20:49
Backend definitions for servers
# https://www.varnish-cache.org/trac/wiki/LoadBalancing
backend server1 {
.host = "localhost";
.port = "8080";
.first_byte_timeout = 300s;
.connect_timeout = 300s;
.between_bytes_timeout = 300s;
# http://www.lullabot.com/articles/varnish-multiple-web-servers-drupal for status.php
.probe = { .url = "/status.php"; .interval = 15s; .timeout = 5s; .window = 8;.threshold = 3; }
}
@heddn
heddn / drupal.vcl
Last active December 13, 2017 16:18
drupal global varnish 3 vcl
# https://www.varnish-cache.org/lists/pipermail/varnish-misc/2011-March/020182.html
/* A backend that will always fail. */
backend failapp {
.host = "127.0.0.1";
.port = "9000";
.probe = {
.url = "/hello/";
.interval = 12h;
.timeout = 1s;
.window = 1;
<?php
abstract class BaseTest extends PHPUnit_Extensions_SeleniumTestCase {
protected $autoStop = FALSE;
protected function setUp() {
$this->setBrowserUrl('http://www.example.com');
}
/**
<?php
class ColorTest extends BaseTest {
/**
* @test
*/
public function links() {
$this->init();
// Test links
$this->assertEquals("Link Text", $this->getText("xpath=//div[@id='exampleId']/h2/a"));
@heddn
heddn / build.xml
Created October 9, 2012 21:35
selenium ant build
<?xml version="1.0" encoding="UTF-8"?>
<project name="Example Test Suite" default="build">
<property environment="env"/>
<target name="build" depends="prepare,phpunit,stop-selenium" />
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/build/logs" />
</target>
<?xml version="1.0" encoding="UTF-8"?>
<phpunit>
<testsuites>
<testsuite name="Example Selenium Test Suite">
<directory>Selenium1Tests</directory>
</testsuite>
</testsuites>
<selenium>
<browser name="Firefox on Linux" browser="*firefox /usr/lib/firefox/firefox"
host="localhost" port="4444" timeout="30000" />
@heddn
heddn / example.drush.inc
Created October 25, 2012 20:53
Index non-drupal content
<?php
/**
* @file
* example drush commands.
*/
/**
* Implementation of hook_drush_command().
*
@heddn
heddn / config.xml
Created October 30, 2012 23:52
Jenkins build template
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description>Simple Selenium Driver</description>
<logRotator>
<daysToKeep>-1</daysToKeep>
<numToKeep>10</numToKeep>
<artifactDaysToKeep>-1</artifactDaysToKeep>
<artifactNumToKeep>-1</artifactNumToKeep>
</logRotator>
/**
* Implements hook_url_outbound_alter().
*/
function MODULE_url_outbound_alter(&$path, &$options, $original_path) {
preg_match('@^search/(.+)@', $path, $matches);
// Only tack on a color nid facet if there isn't one already selected.
if (FALSE === strpos($matches[1],'/')) {
// The alias path will be the letter 'c'
$path .= '/c/' . color_selector($_COOKIE['color']);
}