Skip to content

Instantly share code, notes, and snippets.

View dogmatic69's full-sized avatar
🎯
Building the new IKEA

Carl Sutton dogmatic69

🎯
Building the new IKEA
View GitHub Profile
@dogmatic69
dogmatic69 / .htaccess
Created October 3, 2010 21:26
Using other apps with CakePHP
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule (some_folder/.*) $1 [L] # adjust the regex to what you want.
# normal cake rules
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
<?php
class GoogleAppHelper extends AppHelper{
public function __construct($options = array()){
$default = array(
'cachePath' => dirname(dirname(dirname(__FILE__))).DS.'webroot'.DS.'img'.DS.get_class($this).DS,
'cacheImagePath' => '/google/img/'.get_class($this).'/'
);
$options = array_merge($default, $options);
<?php
// add this code to $ip/extentions/Gist/Gist.php
// include this in your LocalSettings.php require_once( "$IP/extensions/Gist/Gist.php" );
// Usage <gist>{id}</gist>
$wgHooks['ParserFirstCallInit'][] = 'efGistParserInit';
function efGistParserInit(&$parser) {
$parser->setHook( 'gist', 'efGistRender' );
function setup( &$Model, $settings )
{
$this->settings[$Model->alias] = array_merge(
$this->settings[$Model->alias],
(array)$settings
);
$this->settings[$Model->alias]['model'] = $Model->alias;
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
DROP TABLE IF EXISTS `access_permissions`;
CREATE TABLE `access_permissions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`model` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
`foreign_id` int(11) NOT NULL,
`uid` int(11) NOT NULL,
`gid` int(11) NOT NULL,
`perms` int(3) NOT NULL DEFAULT '0',
<?php
class VoucherComponent extends Object {
/**
* components being used here
*/
var $components = array();
/**
* The path to the voucher template
*/
<?php
class ContactComponent extends Object {
/**
* components being used here
*/
var $components = array();
var $errors = null;
var $setup = array(
@dogmatic69
dogmatic69 / range.php
Created December 10, 2009 12:49
needed for chart helper to generate ranges for x & y axyis
<?php
foreach(range('a', 'z') as $letter) {
echo $letter;
}
?>
This function will also work with numbers. This will print all the numbers from 1 to 12.
<?php
foreach(range(0, 12) as $number) {
<?php
/**
* Inflect Shell
*
* Inflect the heck out of your word(s)
*
* @category Shell
* @package Subway
* @version 0.1
* @author Jose Diaz-Gonzalez
@dogmatic69
dogmatic69 / google_charts_usage.php
Created November 25, 2009 14:57
how to use the chart helper
<h2>A test to make sure google is working</h2><?php
echo $this->Chart->test();
?><h2>Same as above but through the helper</h2><?php
echo $this->Chart->display(
'pie3d',
array(
'data' => '60,40',
'labels' => 'Hello,World',
'size' => '250,100',