Skip to content

Instantly share code, notes, and snippets.

$.fn.equalize = function(options)
{
var self = this;
function equalize () {
var elements = $(self);
// calculate the max height
var maxHeight = Math.max.apply(null, elements.map(function () {
return $(this).height();
@jaggy
jaggy / log_queries.php
Last active August 29, 2015 14:00
Log CakePHP 2.x queries. Line 455
$references = array(
'SELECT' => 'yellow',
'deleted' => 'red',
'DELETE' => 'red',
'UPDATE' => 'blue',
'INSERT' => 'green',
);
$excludes = array('SHOW FULL COLUMNS', 'Aro', 'Aco', 'Permission', 'SHOW TABLES', 'SELECT CHARACTER_SET_NAME', 'SELECT COUNT');
$print = true;
{
"name": "",
"repositories": [
{
"type": "pear",
"url": "http://pear.cakephp.org"
},
{
"type": "vcs",
"url": "https://github.com/jaggyspaghetti/rake-db-migrator.git"
@jaggy
jaggy / jquery.boilerplate.js
Last active January 29, 2017 04:03
jQuery boilerplate
/*
|--------------------------------------------------------------------------
| jQuery Boilerplate based on http://gregfranko.com/jquery-best-practices/#/8
| Author: jaggyspaghetti
| Gist at https://gist.github.com/jaggyspaghetti/10555076
|--------------------------------------------------------------------------
*/
(function(application) {
// avoid jQuery conflicts
@jaggy
jaggy / disable_cando.conf
Created April 11, 2014 18:54
Disable Cando 11.6 on /etc/X11/xorg.conf
Section "InputClass"
Identifier "disable broken device"
MatchIsTouchscreen "on"
MatchProduct "Cando 11.6"
Option "Ignore" "on"
EndSection
<?php
/**
* A wordpress rewrite wrapper
*
* @param string $alias
* @param string $url
* @return null
*/
function connect( $alias, $url )
<?php
function sc_dropdown( $field, $repeater )
{
$plural = array();
foreach(get_field( $field ) as $singular){
$plular = $singular[ $repeater ];
}
@jaggy
jaggy / PageableBehavior.php
Created March 22, 2014 23:54
CakePHP paging behavior to complement with my REST plug-in
<?php
class PageableBehavior extends ModelBehavior
{
/**
* A custom paginate
*
* @group scope
<?php
/**
* Set up the application permissions
*
* @http_request(GET, /setup)
* @return void
*/
public function setup()
{
@jaggy
jaggy / SetupShell.php
Created March 19, 2014 23:21
Just a quick setup for everything
<?php
class SetupShell extends AppShell{
function main(){
system('./Console/cake acl create aco root controllers');
system('./Console/cake AclExtras.AclExtras aco_sync');
$handle = curl_init();