Skip to content

Instantly share code, notes, and snippets.

@josegonzalez
josegonzalez / subdomain.php
Created December 19, 2011 21:00
subdomain component for cakephp that depends on a model
<?php
class SubdomainComponent extends Object {
var $__settings = array(
'base' => 'example.com',
'domains' => array(),
'param' => 'subdomain',
'redirect' => true,
'redirectTo' => 'http://example.com',
'model' => 'DomainPrefix',
@nojimage
nojimage / ln.php
Created February 3, 2011 13:35
CakePHP LnShell - create plugin webroot symlink
<?php
/**
* Create symlink plugins and themes webroot to APP/webroot/
*
* CakePHP 1.3
* PHP versions 5
*
* Copyright 2011, nojimage (http://php-tips.com/)
*
// shorten/alias long canvas method names
// adapted from: http://marijn.haverbeke.nl/js1k.html
var Canv = document.body.children.c,
Gr = Canv.getContext("2d"),
prop
;
for (prop in Gr) {
Gr[ prop[0] + (prop[3]||"") + (prop[6]||"") ] = Gr[prop];
@mathiasbynens
mathiasbynens / jquery.togglefade.js
Created September 2, 2010 14:56
jQuery toggleFade()
jQuery.fn.toggleFade = function(speed, callback) {
speed = ~~speed || 400;
callback = callback || jQuery.noop;
return this.each(function() {
var $this = jQuery(this);
$this[$this.is(':hidden') ? 'fadeIn' : 'fadeOut'](speed, callback);
});
};
@mathiasbynens
mathiasbynens / toggleAttr() jQuery plugin
Created February 8, 2010 21:20
toggleAttr() jQuery plugin
/*!
* toggleAttr() jQuery plugin
* @link http://github.com/mathiasbynens/toggleAttr-jQuery-Plugin
* @description Used to toggle selected="selected", disabled="disabled", checked="checked" etc…
* @author Mathias Bynens <http://mathiasbynens.be/>
*/
jQuery.fn.toggleAttr = function(attr) {
return this.each(function() {
var $this = $(this);
$this.attr(attr) ? $this.removeAttr(attr) : $this.attr(attr, attr);