Skip to content

Instantly share code, notes, and snippets.

@pvalencia
pvalencia / gist:166672
Created August 12, 2009 19:03
twiteando con cakephp
<?php
function tweet($status) {
$username = 'TWITTER_USERNAME';
$password = 'TWITTER_PASSWORD';
App::import('Core', array('Xml', 'HttpSocket'));
$sckt = new HttpSocket();
$res = $sckt->request(
array(
'method' => 'POST',
@pvalencia
pvalencia / gist:166613
Created August 12, 2009 17:06
saving users with ACL in cakephp
<?php
/**
* Cambia el parent_id del aro asociado al correspondiente al nuevo grupo
*/
function afterSave($created) {
if(!$created && $this->id && isset($this->data['Usuario']['grupo_id'])) {
$aro = $this->Aro->find('first',
array(
'conditions' => array(
'model' => 'Usuario',
@pvalencia
pvalencia / gist:166334
Created August 12, 2009 05:04
como hacer trim de una url en cakephp con tr.im
<?php
/**
* Hacer tr.im de una URL en cakephp
*/
function trim($url) {
// Quizás esto debiese ir en un archivo de configuración
$username = 'TR.IM_USERNAME';
$password = 'TR.IM_PASSWORD';
App::import('Core', array('Xml', 'HttpSocket')); //Esto va acá?