Skip to content

Instantly share code, notes, and snippets.

View twogood's full-sized avatar

David Eriksson twogood

View GitHub Profile
@twogood
twogood / sphinx.conf.part
Created January 4, 2012 13:10
sphinx åäö
source loppis_posts
{
type = mysql
sql_host = localhost
sql_user = user
sql_pass = pass
sql_db = loppis_dev
sql_port = 3306 # optional, default is 3306
@twogood
twogood / etc-dokuwiki-local.php
Created February 9, 2012 07:27
/etc/dokuwiki/local.php for multiple DokuWiki installations in Ubuntu
<?php
$host = strtolower($_SERVER['HTTP_HOST']);
$file['local'] = '/etc/dokuwiki/'.$host.'/local.php';
require_once($file['local']);
$prefix = '/var/lib/dokuwiki/'.$host.'/';
$conf['olddir'] = $prefix.'attic';
$conf['cachedir'] = $prefix.'cache';
$conf['lockdir'] = $prefix.'locks';
@twogood
twogood / gist:2820806
Created May 28, 2012 19:29
Uncaught Syntax error, unrecognized expression: [class^='add:the-comment-list':]
--- wp-lists.dev.js.orig 2009-11-29 11:29:12.000000000 +0100
+++ wp-lists.dev.js 2012-05-28 21:56:43.000000000 +0200
@@ -62,7 +62,7 @@
if ( !s ) { return false; }
- if ( !e.is("[class^=add:" + list.id + ":]") ) { return !wpList.add.call( list, e, s ); }
+ if ( !e.is("[class^='add:" + list.id + ":']") ) { return !wpList.add.call( list, e, s ); }
if ( !s.element ) { return true; }
@twogood
twogood / Result.java
Created June 1, 2012 13:14
The Result class
public class Result
{
public static final Result SUCCESS = new Result(true, "");
private boolean success;
private String message;
private Result(boolean success, String message)
{
this.success = success;
@twogood
twogood / AssertResult.java
Created June 1, 2012 13:16
TestNG Assert helpers for the Result class
import static org.testng.Assert.*;
public class AssertResult
{
static public void assertSucceeded(Result result)
{
assertTrue(result.succeeded(), result.getMessage());
}
static public void assertFailed(Result result)
@twogood
twogood / double_fork.cc
Created July 11, 2012 15:08
From a project I worked on back in 2004
#include "double_fork.hh"
#include <cstdlib>
#include <cerrno>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <fcntl.h>
int double_fork()/*{{{*/
'view_helpers' => array(
'invokables' => array(
'userIdentity' => 'Application\View\Helper\UserIdentity',
)
),
@twogood
twogood / CustomMenu.php
Created November 9, 2012 11:53
Customizing Zend\View\Helper\Navigation\Menu
<?php
namespace Application\View\Helper\Navigation;
use Zend\View\Helper\Navigation\Menu;
class CustomMenu extends Menu
{
// override methods as needed
}
$('label').click(function () {
$(this).next().focus();
});
@twogood
twogood / gist:4121473
Created November 20, 2012 21:53
.openshift/action_hooks/build for WordPress Multisite on OpenShift
#!/bin/bash
# This is a simple build script and will be executed on your CI system if
# available. Otherwise it will execute while your application is stopped
# before the deploy step. This script gets executed directly, so it
# could be python, php, ruby, etc.
WP_CONTENT=$OPENSHIFT_REPO_DIR/php/wp-content
for SUBDIR in plugins themes uploads blogs.dir; do