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 / csv.ctp.php
Created November 20, 2009 13:14
a layout for csv
<?php
// the layout
header( 'Content-type: application/octet-stream' );
header( 'Content-Disposition: attachment; filename="my-data.csv"');
echo $content_for_layout;
?>
<?php
// the view to create csv's
$a = array_keys( ClassRegistry::init( Inflector::singularize( $this->name ) )->_schema );
$needed = array(
Inflector::singularize( $this->name ) => $a
);
$row = array();
if ( !empty( $data ) )
<?php
// Created by Guido Rossi <guidorossi@gmail.com>
// Date: 28/03/2008
// License: GNU General Public License v3
// Version: 1.1
class YahooFinance{
var $simbol;
@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',
<?php
/**
* Inflect Shell
*
* Inflect the heck out of your word(s)
*
* @category Shell
* @package Subway
* @version 0.1
* @author Jose Diaz-Gonzalez
@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
class ContactComponent extends Object {
/**
* components being used here
*/
var $components = array();
var $errors = null;
var $setup = array(
<?php
class VoucherComponent extends Object {
/**
* components being used here
*/
var $components = array();
/**
* The path to the voucher template
*/
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',
function setup( &$Model, $settings )
{
$this->settings[$Model->alias] = array_merge(
$this->settings[$Model->alias],
(array)$settings
);
$this->settings[$Model->alias]['model'] = $Model->alias;