Skip to content

Instantly share code, notes, and snippets.

View jbennett's full-sized avatar

Jonathan Bennett jbennett

View GitHub Profile
@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
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 / 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
*
*/
<?php
class ComCCIDatabaseBehaviorNotifiable extends KDatabaseBehaviorAbstract
{
/**
* Collection of emails.
*
* @var array
*/
protected $_emails;
@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;
@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:4475720
Last active December 10, 2015 18:38
Resources for getting started at CCI

Software

  • Alfred
  • OmniFocus
  • 1Password
  • Transmit
  • Sublime Text
  • MAMP
  • ssh/cli/cPanel
  • CodeKit
  • Dropbox
@jbennett
jbennett / debounce.js
Created February 19, 2014 14:41
Debounce
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
clearTimeout(timeout);
timeout = setTimeout(function() {
timeout = null;
if (!immediate) func.apply(context, args);
}, wait);
if (immediate && !timeout) func.apply(context, args);
var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat'),
filter = require('gulp-filter'),
gulpif = require('gulp-if'),
minify = require('gulp-minify-css'),
plumber = require('gulp-plumber'),
rename = require('gulp-rename'),
sass = require('gulp-sass')
uglify = require('gulp-uglify');
### Keybase proof
I hereby claim:
* I am jbennett on github.
* I am jbennett (https://keybase.io/jbennett) on keybase.
* I have a public key whose fingerprint is D348 CC45 ABAD D4FA 656D 65CC 5D35 198B 67D3 3F55
To claim this, I am signing this object: