Skip to content

Instantly share code, notes, and snippets.

Avatar
🎸
Working from home

Jose Diaz-Gonzalez josegonzalez

🎸
Working from home
View GitHub Profile
@josegonzalez
josegonzalez / post_cake_admin.php
Created Sep 17, 2010
CakeAdmin, the Answer to DjangoAdmin, but for CakePHP
View post_cake_admin.php
<?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 Oct 1, 2010
CakeForm, an easy way to define custom cakephp forms
View cake_form.php
<?php
class CakeForm {
var $_boundValues = array();
var $_errors = null;
var $_formHelper = null;
var $_execute = null;
var $_format = 'ul';
@josegonzalez
josegonzalez / users_controller.php
Created Oct 2, 2010
Example usage of CakeForm
View users_controller.php
<?php
class UsersController extends AppController {
/**
* Automagic login via AuthComponent
*
* @return void
* @author Jose Diaz-Gonzalez
*/
function login() {
@josegonzalez
josegonzalez / deploy.rb
Created Oct 23, 2010
Capistrano Deploy Script for CakePHP applications using GIT (Update the $config hash))
View deploy.rb
$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 Mar 17, 2011
delete all tags but the last 100 in a git repository
View gist:874832
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 Mar 17, 2011
PHP Variables, method names, and class names are ridiculous
View unholy.php
<?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 Mar 26, 2011
thoughts on cakepackages
View gist:888471

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 Nov 17, 2018
Example Readme for CakePHP plugins that use MIT license
View readme.md

[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 Apr 10, 2011
cakepackages control file
View control
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 Dec 19, 2011
subdomain component for cakephp that depends on a model
View subdomain.php
<?php
class SubdomainComponent extends Object {
var $__settings = array(
'base' => 'example.com',
'domains' => array(),
'param' => 'subdomain',
'redirect' => true,
'redirectTo' => 'http://example.com',
'model' => 'DomainPrefix',