Skip to content

Instantly share code, notes, and snippets.

View jbennett's full-sized avatar

Jonathan Bennett jbennett

View GitHub Profile
@jbennett
jbennett / SizeWatch.html
Created August 27, 2012 13:10
Watches for screen size to change and triggers named events are specified sizes
<!DOCTYPE html>
<html>
<head>
<title>Size Watch</title>
<script src="http://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js"></script>
<script src="file:///Users/jbennett/Desktop/SizeWatch.js"></script>
</head>
<body>
@jbennett
jbennett / gist:1324331
Created October 29, 2011 10:51
Patch for Nooku authorizations
Index: administrator/components/com_default/controllers/behaviors/executable.php
===================================================================
--- administrator/components/com_default/controllers/behaviors/executable.php (revision 4344)
+++ administrator/components/com_default/controllers/behaviors/executable.php (working copy)
@@ -58,7 +58,7 @@
if(parent::canAdd())
{
if(version_compare(JVERSION,'1.6.0','ge')) {
- $result = JFactory::getUser()->authorise('core.create');
+ $result = JFactory::getUser()->authorise('core.create') === true;
<?php
class ComCCIDatabaseBehaviorNotifiable extends KDatabaseBehaviorAbstract
{
/**
* Collection of emails.
*
* @var array
*/
protected $_emails;
@jbennett
jbennett / database_behavior_relatable.php
Created July 6, 2011 04:26
Mixins and Table Behaviours
<?php
/**
* Relatable Behavior
*
* The relatable behavior provides a riby-esk has_many/belongs_to relationship model.
*
* @author jbennett
*
*/
Relevant URLS:
Full JSON dataset: option=com_gives&view=opportunities&format=json
Reduced JSON dataset: option=com_gives&view=opportunities&format=json&detail=short
@jbennett
jbennett / rollover.js
Created March 2, 2011 16:23
simple image swap/preload script for Joomla/Mootools 1.11
(function (window, document, undefined) {
window.addEvent('load', function() { // dont need to fill domready
$$('img').each(function(img) {
var normal, rollover;
if (img.src.indexOf('_normal') === -1)
return; // do nothing if image doesn't have _normal in name
normal = img.src;
rollover = img.src.replace('_normal', '_rollover'); // get both filenames