Skip to content

Instantly share code, notes, and snippets.

View michaeltwofish's full-sized avatar

Michael C. Harris michaeltwofish

  • South Australia, Australia
View GitHub Profile
#!/bin/sh
#/ Usage: ghe-export-pages | ssh admin@enterprise -- ghe-import-pages
set -e
# Show usage.
if [ "$1" = "--help" ]
then grep '^#/' <"$0" |cut -c 4-
exit 2
fi
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@michaeltwofish
michaeltwofish / .htaccess
Created May 10, 2013 05:32
Example Habari .htaccess.
### HABARI START
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteBase /blog
RewriteRule . index.php [PT]
RewriteRule ^(system/(classes|locale|schema|$)) index.php [PT]
### HABARI END
Fatal error: Class 'Habari\TwitterOAuth' not found in /home/habari/public_html/habariproject.org/public/user/plugins/twitter/twitter.plugin.php on line 209
Error: Class 'Habari\TwitterOAuth' not found in user/plugins/twitter/twitter.plugin.php line 209
system/classes/error.php line 162:
Habari\Error::print_backtrace( )
system/classes/error.php line 47:
Habari\Error::error_handler( …1 args… )
[core] line 0:
Habari\Error::shutdown_handler( )
system/classes/method.php line 106:
call_user_func_array( …1 args… )
@michaeltwofish
michaeltwofish / dabblet.css
Last active December 15, 2015 01:29
tiger in the snow (HTML5)
/**
* tiger in the snow (HTML5)
*/
figure {
min-width: 178px;
/** outline: solid 1px red; /* uncomment rule to see figure outline */
position: relative;
opacity: 1.0;
}
figure:hover {
@michaeltwofish
michaeltwofish / git-branch-rm-merged
Created March 6, 2013 04:38
Script to remove branches that have been fully merged to master, except dev
#!/bin/sh
# Remove branches that have been fully merged to master, except dev
# Based on http://devblog.springest.com/a-script-to-remove-old-git-branches
# Helpber function to colourise output
# black='\E[0;30m' red='\E[0;31m' green='\E[0;32m' yellow='\E[0;33m'
# blue='\E[0;34m' magenta='\E[0;35m' cyan='\E[0;36m' white='\E[0;37m'
message() {
message=$1
@michaeltwofish
michaeltwofish / gist:5022635
Created February 24, 2013 04:44
The two things I wanted to achieve were: * Allow `delete` and `shift+delete` to navigate history if one of the pages happens to be a google search page. By default, google will hijack the keypress, regardless of focus, so you'll just delete in the search box. * Allow link highlighting and navigation with the `Keyboard Navigation` extension. I th…
// ==UserScript==
// @name Google Behave
// @namespace http://twofishcreative.com
// @description Stops the Google search page hijacking useful key events. Based on Zimzat's Arrow Key Guard http://userscripts.org./scripts/show/88447
// @match http://www.google.com/*
// @match https://www.google.com/*
// @match http://www.google.com.au/*
// @match https://www.google.com.au/*
// ==/UserScript==
$content .= $itemopen . '### [' . $bookmark->title . '](' . $bookmark->url . ") \n" . $bookmark->description . "\n";

Problem 1:

There is a big with the haabri markup plugin. Header links are not converted from markdown. Please see how this text looks in Byword or nvALT (if you use a Mac). Please update the plugin.

  • [What is The Key Method?][What is The Key Method?]

##What is The Key Method?

I get 10 times more traffic from [Google][] than from [Yahoo][] or [MSN][].

@michaeltwofish
michaeltwofish / gist:4113926
Created November 19, 2012 21:11
Last php error
lasterror () {
logpath=/usr/local/www-conf/logs/$1-phplog
error=(${(f)$(awk -F: '/PHP Fatal error|\[error\]/ { lines[last] = NR } END { print lines[last] }' $logpath)})
[[ -n $error ]] && tail -n +$error $logpath
}