Skip to content

Instantly share code, notes, and snippets.

@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 / 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: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 / 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 / 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 / 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 / app_helper.php
Created April 24, 2010 07:58
AppHelper replacement to use named urls like @prefix_plugin_controller_action
<?php
/**
* Short description for file.
*
* This file is application-wide helper file. You can put all
* application-wide helper-related methods here.
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
b30d30e56991fe459c2292783185769bbe57f7da8f5b84d6934640263ec9b170258c8ff39556368ae50e5a629d657d4d0d7cf2976b0214c6abc9370711257d82
@josegonzalez
josegonzalez / searchable.php
Created March 22, 2010 03:59
One of many iterations on a helper for the Searchable plugin
<?php
class SearchableHelper extends AppHelper {
var $helpers = array('Html', 'Text');
function snippets($data) {
$data = json_decode($data, true);
$term = (isset($this->data['SearchIndex']['term'])) ? trim($this->data['SearchIndex']['term']) : '';
$snippets = '';
while (strlen($snippets) < 255 && $value = next($data)) {
$snippets .= $this->Text->highlight($this->Text->excerpt($value, $term, 20), $term);