Skip to content

Instantly share code, notes, and snippets.

@josegonzalez
josegonzalez / post_cake_admin.php
Created September 17, 2010 03:17
CakeAdmin, the Answer to DjangoAdmin, but for CakePHP
<?php
class PostCakeAdmin extends CakeAdmin {
/**
* Name of the model. Must be overridden in order to create a
* valid admin section, unless you want everything to reference
* a Cake Model
*
* @var string
*/
@josegonzalez
josegonzalez / cake_form.php
Created October 1, 2010 05:28
CakeForm, an easy way to define custom cakephp forms
<?php
class CakeForm {
var $_boundValues = array();
var $_errors = null;
var $_formHelper = null;
var $_execute = null;
var $_format = 'ul';
@josegonzalez
josegonzalez / users_controller.php
Created October 2, 2010 03:01
Example usage of CakeForm
<?php
class UsersController extends AppController {
/**
* Automagic login via AuthComponent
*
* @return void
* @author Jose Diaz-Gonzalez
*/
function login() {
@josegonzalez
josegonzalez / deploy.rb
Created October 23, 2010 16:40
Capistrano Deploy Script for CakePHP applications using GIT (Update the $config hash))
$config = {
"application" => "DOMAIN.TLD",
"repository" => "git@GITHOST:USERNAME/REPOSITORYNAME.git",
"remoteusername" => "REMOTEUSERNAME",
"cake_folder" => "/PATH/TO/CAKE",
"cake_version" => "cakephp1.3",
"plugin_dir" => "plugins",
"servers" => {
"prod" => {
"server" => "APPLICATION.TLD",
@josegonzalez
josegonzalez / gist:874832
Created March 17, 2011 18:16
delete all tags but the last 100 in a git repository
for tag in `git tag | sort | sed -e :a -e '$d;N;2,100ba' -e 'P;D'`; do git tag -d $tag && git push origin :refs/tags/$tag; done
@josegonzalez
josegonzalez / unholy.php
Created March 17, 2011 19:01
PHP Variables, method names, and class names are ridiculous
<?php
$classMap = array(
'AggregateRecordSales' => 'band_id',
'BandInfoDaily' => 'team_id',
'DivisionStandings' => 'team_id',
'TeambandPriceCache' => 'teamband_id',
);
$baseClassVar = 'baseClass';
$inflection = 'inflect';
foreach ($classMap as $baseClass => $fieldName) {
@josegonzalez
josegonzalez / gist:888471
Created March 26, 2011 17:43
thoughts on cakepackages

Anyhow, I wrote a blog post on the subject quite a while ago, which is pretty much a braindump of what I am attempting with CakePackages. I also wrote a post on what I thought The Chaw might have been had development on CakePHP not split.

I'm currently working on a smarter package classifier, one that uses the Reflection api, but unfortunately there are MANY bugs with my current approach. My current output (as of yesterday) is the following thus. I'd like to complete this before I continue working on CakePackages in the general sense.

Other things I'd like to do are default to showing an up to date readme, allow commenting/tagging/usage counters for given packages, supporting github organizations, as well as displaying forks on the site. I also have a non-working plugin installer (not the one on github) that I'm futzing with local

@josegonzalez
josegonzalez / readme.md
Last active November 17, 2018 16:16
Example Readme for CakePHP plugins that use MIT license

[PLUGIN NAME] Plugin

[ONE LINE DESCRIPTION OF PROJECT]

Background

[A PARAGRAPH DESCRIBING WHY YOU BUILT THIS]

[ANOTHER PARAGRAPH DESCRIBING YOUR IMPETUS FOR RELEASING THIS]

@josegonzalez
josegonzalez / control
Created April 10, 2011 22:53
cakepackages control file
Package: cakepackages
Source: git://github.com/josegonzalez/cakepackages.git
Type: application
Section: application
Description: An application that can be used
to index other cakephp applications and plugins
Pre-depends: CakePHP==1.3
Recommends:
Suggests:
Bugs: http://github.com/josegonzalez/cakepackages/issues
@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',