Skip to content

Instantly share code, notes, and snippets.

View robertbasic's full-sized avatar

Robert Basic robertbasic

View GitHub Profile
@robertbasic
robertbasic / gist:871412
Created March 15, 2011 20:32
extending dijit.tooltip
dojo.declare("app.errorTooltip", dijit.Tooltip, {
show: function() {
var elem = dojo.byId(this.connectId[0]);
if(dojo.isIE) {
elem.fireEvent('onfocus');
} else {
var e = document.createEvent("HTMLEvents");
e.initEvent('focus', false, true);
elem.dispatchEvent(e);
}
@robertbasic
robertbasic / gist:871416
Created March 15, 2011 20:34
showing the custom tooltips
var errors = dojo.query("form ul.errors").forEach(function(node, idx, nodes){
var id = node.parentNode.firstChild.getAttribute('for');
var label = "<ul class='errors'>" + node.innerHTML + "</ul>";
var tooltip = app.errorTooltip({
label: label,
connectId: [id]
});
document.body.appendChild(tooltip.domNode);
tooltip.show();
// these next 2 lines are for marking the connected fields as invalid
@robertbasic
robertbasic / gist:1066023
Created July 5, 2011 21:38
Zend\View and the Variables
<?php
use Zend\Controller\Action,
Zend\View\Variables;
use App\Model;
class IndexController extends Action
{
@robertbasic
robertbasic / Bootstrap.php
Created July 23, 2011 08:47
ZF2 loading plugins and helpers
<?php
// telling ZF where an action helper is
class Bootstrap extends Application\Bootstrap {
public function _initActionHelpers()
{
Zend\Loader\PluginClassLoader::addStaticMap(array('loggedinuser' => 'Planet\Controller\Helper\LoggedInUser'));
}
// registering FC plugins can be done like this
@robertbasic
robertbasic / Bootstrap.php
Created July 23, 2011 09:55
Another way of loading ZF2 action helpers
<?php
class Bootstrap extends Application\Bootstrap {
/**
* Initializing action helpers
*/
public function _initActionHelpers()
{
// instead of this...
// Zend\Loader\PluginClassLoader::addStaticMap(array('loggedinuser' => 'Planet\Controller\Helper\LoggedInUser'));
@robertbasic
robertbasic / index.php
Created July 23, 2011 17:05
Calling direct methods on ZF2 view helpers
<?php
// as in ZF2 there's no more automagical calling of view helpers
// things are a changed a bit...
$view->broker('helper', array(/*options to pass to the helper*/));
// or
$view->broker('helper')->direct(array(/*options to pass to the helper*/));
@robertbasic
robertbasic / Bootstrap.php
Created July 27, 2011 18:26
Loading action helpers with the prefix path loader
<?php
class Bootstrap {
public function _initActionHelpers()
{
$this->bootstrap('FrontController');
$fc = $this->getResource('FrontController');
$fc->getHelperBroker()
->setClassLoader(new \Zend\Loader\PrefixPathLoader(
array(
array(
@robertbasic
robertbasic / ContactTest.php
Created August 12, 2011 13:12
Unit testing symfony2 forms
<?php
class ContactTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
$ext = new CoreExtension();
$message = new Message();
$factory = new FormFactory(array(
$ext
@robertbasic
robertbasic / gist:1583051
Created January 9, 2012 13:55
PHP 5.4 rc5 test summary
=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped : 51
Exts tested : 26
---------------------------------------------------------------------
Number of tests : 11999 8158
Tests skipped : 3841 ( 32.0%) --------
Tests warned : 0 ( 0.0%) ( 0.0%)
(debug)
(if
(is (application_name) "Firefox")
(begin
(set_workspace 1)
(maximize)
)
)