Skip to content

Instantly share code, notes, and snippets.

View ringmaster's full-sized avatar

Owen Winkler ringmaster

View GitHub Profile

Habari Hosting

We are working on producing a platform that will allow users to sign up for hosted Habari service, much like sites such as wordpress.com or tumblr.com. To do this, we would like to produce a single page sell sheet that briefly explains the platform and provides a form for the user to submit that will immediately configure their hosted Habari site and direct them to it.

This sell sheet should be one page, and have coloring conistent with the Habari brand (monochrome, gray). It should at a minimum include a Habari logo at the top, some description of the service provided in a paragraph below, and a form to sign up for service. A large call to action at the top of the page could draw a visitor's attention to the signup form elsewhere on the page. Some quotes of recommendation, screenshots, or other graphic embellishments would be welcome flourishes.

if ( $token['type'] == HTMLTokenizer::NODE_TYPE_ELEMENT_CLOSE ) {
if(count($stack) > 0 && in_array($token['name'], Utils::array_map_field($stack, 'name'))) {
do {
$end = array_pop( $stack );
$end['type'] = HTMLTokenizer::NODE_TYPE_ELEMENT_CLOSE;
$end['attrs'] = null;
$end['value'] = null;
$summary[] = $end;
} while ( ( $bail || $end['name'] != $token['name'] ) && count( $stack ) > 0 );
}
@ringmaster
ringmaster / gist:5065881
Created March 1, 2013 16:35
Get Habari posts ordered by how many comments they have
$presets['most_comments'] = array(
'on_query_built' => function(Query $query) {
$query->join('LEFT JOIN {comments} c ON c.post_id = {posts}.id');
$query->groupby('{posts}.id');
$query->orderby('count(c.id) DESC');
}
);
@ringmaster
ringmaster / dabblet.css
Created March 17, 2013 04:32 — forked from michaeltwofish/dabblet.css
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;
}
img {
max-width: 100%;
@ringmaster
ringmaster / form.php
Last active December 15, 2015 03:19
Form Sample Code
<?php
FormUI::register('registered_form', function(FormUI $form) {
$wrap = $form->append(FormControlWrapper::create('wrap')->set_wrap_each('<div>%s</div>'));
$wrap->append(FormControlLabel::wrap('Sample 1:', new FormControlText('sample1', 'sample1')));
$wrap->append(FormControlLabel::wrap('Right-side label', new FormControlText('sample2', 'sample2'))->set_template('control.label.onright'));
$wrap->append(FormControlLabel::wrap('Custom right-side label', new FormControlText('sample3', 'sample3'))->set_template_html(function($theme, $control) {
return $theme->content . '<label ' . $theme->_attributes . '>' . $theme->label . '</label>';
}));
});
/**
* Add objects or functions to the post-processing queue, executed via self::process_queue()
* @param QueryRecord|Callable $fn A QueryRecord to call ->update() on, or a function to execute
* @param null|string $name An index to save the queue under, defaults to the SPL object hash for objects
*/
public static function queue($fn, $name = null)
{
if(is_null($name) && is_object($fn)) {
$name = spl_object_hash($fn);
}
@ringmaster
ringmaster / test.plugin.php
Created April 26, 2013 17:46
Add tests to a plugin.
public function filter_list_unit_tests($tests)
{
$unit_tests = glob(dirname(__FILE__). '/units/test_*.php');
$tests = array_merge($tests, $unit_tests);
return $tests;
}
@ringmaster
ringmaster / test.plugin.php
Last active December 16, 2015 20:19
Alter the login form.
<?php
public function action_modify_form_habari_login(FormUI $form) {
// Remove the reset message
$form->remove($form->reset_message);
// Create a ul wrapper that wraps its children in li's
$buttons = $form->append(FormControlWrapper::create('buttons')->set_setting('wrap_element', 'ul')->set_setting('wrap_each', '<li>%s</li>'));
// Move the login button from the dropbutton to the button wrapper we just created
$form->move_into($form->login, $buttons);
// Remove the dropbutton
$form->remove($form->submit_button);
$form->insert($form->label_for_habari_username, $inputs = FormControlFieldset::create('inputs'));
$form->move_into($form->label_for_habari_username, $inputs);
$form->move_into($form->label_for_habari_password, $inputs);
public function action_before_act_admin( ) {
$this->add_template('dashboard', dirname(__FILE__) . '/templates/dash.php', true);
}