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
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',
/**
* 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__:'=>"'" );
> 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
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)
@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
/**
* 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)
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');
}
<html>
<body>
Awesome stuff etc.
<?php $theme->add_stuff(); ?>
</body>
</html>
Exception thrown in -::lithium\data\source\database\adapter\{closure}() on line 342:
SELECT * FROM `units` AS `Unit` WHERE `name` = 'Unit 1' AND `0` = 'id != 1' LIMIT 1;: Unknown column '0' in 'where clause'
Trace:
lithium\core\Object::_filter(), line 245
lithium\data\source\database\adapter\MySql::_execute(), line 343
lithium\core\Object::invokeMethod(), line 169
lithium\data\source\{closure}, line 265
lithium\core\Object::_filter(), line 245
lithium\data\source\Database::read(), line 287
lithium\data\{closure}, line 455
/**
* Applies a callback to a copy of all data in the collection
* and returns the result.
*
* Overriden to load any data that has not yet been loaded.
*
* @param callback $filter The filter to apply.
* @param array $options The available options are:
* - `'collect'`: If `true`, the results will be returned wrapped
* in a new Collection object or subclass.