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
<html>
<body>
Awesome stuff etc.
<?php $theme->add_stuff(); ?>
</body>
</html>
public function edit() {
$item = Item::find('first');
if ($this->request->data) {
$data = array('confirmed' => true, 'token' => null);
if ($item && $item->save($data, array('validate' => false))) {
$this->redirect('Items::index');
}
/**
* Magic function __isset returns true or false depending on if the given property is set for this object.
* Potential valid properties:
* field: A valid unique name for this control in HTML.
* value: The value of the control, whether the default or submitted in the form
*
* @param string $name The parameter to check
* @return Boolean Whether the parameter is set
*/
public function __isset($name)
@michaeltwofish
michaeltwofish / gist:735421
Created December 9, 2010 22:14
Input that breaks HTMLTokenset
What started out a simple launch of our 2010 Print Commission prints at Handmark Gallery expanded in to a rather full on five day event of print activity and meeting with the rich array of print artists in Hobart.
Print events that took place during the week 9-12 Sept included the opening of The Watercourse Way at the welcoming and dynamic Church Studio in Franklin. Pat &amp; Charles Zuber are to be congratulated for their venture in setting up both an exhibition space and an artist in residency facility. Artists in the Watercourse exhibition from the D'Entrecasteaux Channel area included Annick Ansselin, Rowena Bond, John Farrow Cath de Little, Ros Meeker, Deborah Wace, Michael Schlitz, as well as the Zuber's.
The strong crowd of 80 or so were delighted by the opening address of Councillor Rosalie Woodruff who delivered one of the best researched and well presented addresses I have ever heard.
Friday was a huge print day in Hobart with a succession of events taking place during the day. Melissa Smith clo
require 'java'
java_import 'weka.experiment.CrossValidationResultProducer'
java_import 'java.beans.PropertyDescriptor'
# Java was
# new PropertyDescriptor("splitEvaluator", CrossValidationResultProducer.class)
PropertyDescriptor.new("splitEvaluator", CrossValidationResultProducer)
# Produces
# no constructor with arguments matching [class org.jruby.RubyString, class org.jruby.RubyClass] on object #<Java::JavaBeans::PropertyDescriptor:0x86f847> (NameError)
> data
Length Method Naive.Bayes
1 500 default 0.9072
2 500 stopping 0.8788
3 500 stemming 0.9038
4 500 word counts 0.8992
5 500 normalise length 0.8747
6 500 count and normalise 0.9074
7 500 TF/IDF 0.8993
8 1000 default 0.9068
/**
* Constructor for the Tags class.
* @param mixed $tags String or array of tags
*/
public function __construct( $tags = array() )
{
if ( is_string( $tags ) && ( '' !== $tags ) ) {
// dirrty ;)
$rez = array( '\\"'=>':__unlikely_quote__:', '\\\''=>':__unlikely_apos__:' );
$zer = array( ':__unlikely_quote__:'=>'"', ':__unlikely_apos__:'=>"'" );
public function test_create_post()
{
$tags = array('one', 'two', 'THREE');
$params = array(
'title' => $this->get_title(),
'content' => $this->get_content(1, 3, 'some', array('ol'=>1, 'ul'=>1), 'cat'),
'user_id' => $this->user->id,
'status' => Post::status('published'),
'content_type' => Post::type('entry'),
'tags' => 'one, two, THREE',
public function test_get_posts_by_tag()
{
// Create some tagged posts
$user = User::get_by_name( 'posts_test' );
$time = time() - 160;
$tagged_posts = array();
$tag_sets = array(
array('one'),
postgres 3632 0.0 0.9 65876 3080 pts/23 S+ 04:12 0:00 /usr/lib/postgresql/8.4/bin/psql
postgres 3633 0.0 1.1 99728 3912 ? Ss 04:12 0:00 postgres: postgres postgres [local] idle
postgres 3677 0.0 2.6 52256 8672 pts/21 T 04:25 0:00 vim /etc/postgresql/8.4/main/postgresql.conf
postgres 3684 0.0 1.7 91928 5868 pts/21 S 04:27 0:00 /usr/lib/postgresql/8.4/bin/postgres -D /usr/lib/postgresql/data
postgres 3686 0.0 0.4 91928 1596 ? Ss 04:27 0:00 postgres: writer process
postgres 3687 0.0 0.4 91928 1380 ? Ss 04:27 0:00 postgres: wal writer process
postgres 3688 0.0 0.4 92064 1572 ? Ss 04:27 0:00 postgres: autovacuum launcher process
postgres 3689 0.0 0.4 63468 1320 ? Ss 04:27 0:00 postgres: stats collector process