Skip to content

Instantly share code, notes, and snippets.

View andrebian's full-sized avatar

Andre Cardoso andrebian

View GitHub Profile
@andrebian
andrebian / fabfile.py
Last active December 28, 2015 04:19
Script para deploy de aplicações em Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Criado originalmente po Arthur Furlan - http://arthurfurlan.org/
from fabric.api import *
env.hosts = ['user@host']
env.path = '/home/user_path/public_html'
<?php
echo date('m', strtotime('-3month'));
@andrebian
andrebian / User.php
Created October 20, 2013 23:05
Modelo de usuários
<?php
App::uses('AppModel', 'Model');
/**
* User Model
*
* @property Group $Group
*/
class User extends AppModel {
@andrebian
andrebian / xorg.conf
Created October 12, 2013 00:47
Xorg Conf para a placa de vídeo Nvidia 7600GT no Debian
# /etc/X11/xorg.conf (Xorg X Window System server configuration file)
#
# This file was generated by fll_xorgconfig, the F.U.L.L.S.T.O.R.Y.
# Xorg Configuration tool.
#
# Edit this file with caution, and see the xorg.conf(5) manual page.
# (Type "man xorg.conf" at the shell prompt.)
Section "ServerLayout"
Identifier "Xorg Configured"
<?php
$this->Js->buffer('$(\'.'.$this->request->params['controller'].'\').addClass(\'current\');');
if (class_exists('JsHelper') && method_exists($this->Js, 'writeBuffer')) {
echo $this->Js->writeBuffer();
}
// ...
?>
<?php
/**
* This is the PHP base ACL configuration file.
*
* Use it to configure access control of your Cake application.
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
<?php
// $q variable
WP_Query Object
(
[query] => Array
(
[post_type] => product
)
[query_vars] => Array
<?php
App::uses('AppController', 'Controller');
/**
* Usuarios Controller
*
* @property Usuario $Usuario
*/
class UsuariosController extends AppController {
<?php
App::uses('AppController', 'Controller');
class UsuariosController extends AppController {
public function login() {
if ($this->request->is('post')) {
if ($this->Auth->login()) {
$this->redirect($this->Auth->redirectUrl());
<?php
// código de sua View
echo $this->Form->input('email.');
// importantíssimo existir o ponto após o nome do campo, ele quem determinará que é um array
// código do Controller