Skip to content

Instantly share code, notes, and snippets.

array(1) {
[0]=>
object(Term)#11 (5) {
["inforecords":protected]=>
NULL
["fields":protected]=>
array(6) {
["id"]=>
string(3) "218"
["term"]=>
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]=>
@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() );
@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 / 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
<?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 / 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',