Skip to content

Instantly share code, notes, and snippets.

@MattRead
MattRead / epiphany-add_to_toolbar.js
Created September 7, 2010 02:54
Add a menu entry and toolbar item to epiphany
// create the tomboy icon
var f = new Gtk.IconFactory();
f.add('tomboy', new Gtk.IconSet.from_pixbuf(
new GdkPixbuf.Pixbuf.from_file('/usr/share/icons/hicolor/scalable/apps/tomboy.svg')
));
f.add_default();
// Create the action and group to add to menubar
var action = new Gtk.Action({
name: 'TomboyNote',
<?php
class Prototype
{
protected static $prototype_methods = array();
protected static $prototype_properties = array();
protected $prototype_obj_properties = array();
public static function add_method()
@MattRead
MattRead / lp.sh
Created August 24, 2011 19:50
update Habari POT and sync translations to etras-repo
#!/bin/bash
# setup tmp files from tar.gz's
cd /home/matt/habari-locales/bzr/
bzr merge
bzr add locale/*
bzr commit -m "lp sync"
cd ../
# check fo .po
@MattRead
MattRead / gist:1385848
Created November 22, 2011 14:56
weather
<?php
public function onDoWeather($where, $day = null)
{
$target = $this->event->getNick();
$opts = array(
'http' => array(
'timeout' => 3.5,
'method' => 'GET',
'user_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12'
@MattRead
MattRead / gist:2838495
Created May 30, 2012 19:41
realted posts by tag
<?php
public function add_template_vars()
{
if ( isset($this->posts) && count($this->posts) ) {
$post = $this->post instanceof Post ? $this->post : $this->posts[0];
if ( $this->post instanceof Post && count($this->posts) == 1 ) {
$this->set_title( $post->title );
if ( $post->typename == 'entry' ) {
$this->assign( 'next', $post->ascend() );
$this->assign( 'previous', $post->descend() );
object(Terms)#18 (1) {
["storage":"ArrayObject":private]=>
object(Terms)#171 (1) {
["storage":"ArrayObject":private]=>
array(1) {
[0]=>
object(Term)#11 (5) {
["inforecords":protected]=>
NULL
["fields":protected]=>
array(1) {
[0]=>
object(Term)#11 (5) {
["inforecords":protected]=>
NULL
["fields":protected]=>
array(6) {
["id"]=>
string(3) "218"
["term"]=>
I'm Matt Read, a 32 year old male from Ottawa, Canada. That's the capital of Canada for all you who don't know that already. I enjoy skateboarding, playing hockey and soccer, and working on my website.
<img src="/user/themes/greeny/images/BigJibby.jpg" alt="A picture of me" style="float:right;" /> My favourite TV show of all time is MacGyver, and Good Will Hunting is my favorite movie. I program in PHP, MySQL, Javascript, and Bash Scripting, and I love playing with Python. I'm a bit pedantic about producing **semantic** (X)HTML (and no, valid does not mean semantic).
### About This Site
This site is my personal website since June 2003. This site is powered by Habari. It contains my (almost) daily web log about my life and stuff I find on the Internet. For more information and help in browsing this site, visit the links below.
- [Frequently Asked Questions](/faq)
- [Accessibility Statement](/accessibility)
<?php
public function filter_post_content_out_1($content, $post) {
if (strpos($content, '<!--break-->') !== false){
$pages = explode('<!--break-->', $content);
$page = Controller::get_var('page', 1) - 1;
if ( array_key_exists($page, $pages) ) {
return $pages[$page];
}
}
return $content;
@MattRead
MattRead / gist:3491900
Created August 27, 2012 20:16
providers
<?php
class Providers extends Plugin {
/**
*
*/
public function filter_admin_access( $access, $page, $post_type ) {
if ( $page != 'providers' ) {
return $access;