Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / .gitconfig
Created September 5, 2010 07:45
My ~/.gitconfig
[user]
name = MY_NAME
email = MY_EMAIL_ADDRESS
[git-tmbundle]
gitnub-path = /Applications/GitNub.app
gitx-path = /Applications/GitX.app
show-diff-check = yes
[github]
user = GITUB_USER
token = GITHUB_TOKEN
@josegonzalez
josegonzalez / category.rb
Created August 14, 2010 21:41
Category plugin for Jekyll
module Jekyll
class CategoryIndex < Page
def initialize(site, base, dir, category)
@site = site
@base = base
@dir = dir
@name = 'index.html'
self.process(@name)
self.read_yaml(File.join(base, '_layouts'), 'category_index.html')
@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