Skip to content

Instantly share code, notes, and snippets.

<a id='like_12' href='#' onclick='function(this)'>curti!</a>
<a id='like' data-speaker-id='12' href='#'>curti!</a>
$('#like').live('click', function(event){
speaker_id = $(this).attr('data-speaker_id');
sendRequest('/like',{speaker:speaker_id},
'#vote_'+speaker_id);
return false;
});
@fabriziomachado
fabriziomachado / Layout.php
Created August 5, 2011 12:30
application/hook/Layout.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Layout
{
public $base_url;
public function initx(){
return 'ok!';
}
/**
* Metodo que executa as implementacoes.
@fabriziomachado
fabriziomachado / MY_Controller.php
Created August 5, 2011 12:32
application/core/MY_Controller.php
<?php
class MY_Controller extends CI_Controller
{
# public $layout = 'default';
public $title = 'Unesc - Universidade do Extremo Sul Catarinense';
public $css = array('application','libs/blueprint/screen');
public $js = array('application','libs/jquery-1.6.2.min','libs/modernizr-2.0.6');
public $data = array();
public $view = TRUE;
@fabriziomachado
fabriziomachado / default.html
Created August 5, 2011 12:34
application/views/layouts/default.php
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title>{title_for_layout}</title>
{css_for_layout}
{js_for_layout}
<!--[if lt IE 8]><link rel="stylesheet" href="assets/css/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]-->
</head>
<body>
@fabriziomachado
fabriziomachado / partials_helper.php
Created August 5, 2011 12:45
application/helpers/partials_helper.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
function render_partial($partial, $locals = null, $collection = null, $ajax = NULL) {
$partial = APPPATH .'views/'. $partial;
$contents = '';
foreach($locals AS $key => $value) {
${$key} = $value;
@fabriziomachado
fabriziomachado / peoples.php
Created August 5, 2011 17:25
application/controllers/peoples.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class People extends MY_Controller {
function __construct() {
parent::__construct();
}
function index()
{
@fabriziomachado
fabriziomachado / index.php
Created August 5, 2011 17:31
application/views/peoples/index.php
## conteúdo da view index.php
<h2>application::views::welcome::show</h2>
<h1>Rendering a partials with locals</h1>
<!-- inclui uma partial sem loop, apenas passando variaveis locais -->
<?= render_partial('people/_list_people.php', $locals_vars ); ?>
<h1>Rendering a collection of partials</h1>
<!-- passando uma collection o conteúdo da partial é inserida a cada linha do loop -->
<?= render_partial('people/_people.php',
@fabriziomachado
fabriziomachado / deploy.rb
Created August 10, 2011 23:09
Arquivo de configuração do capistrano
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
require "rvm/capistrano" # Load RVM's capistrano plugin.
set :rvm_ruby_string, '1.9.2@rails3' # Or whatever env you want it to run in.
set :rvm_type, :user
# bundler bootstrap
require 'bundler/capistrano'
#ssh_options[:auth_methods] = %w(password keyboard-interactive)
#default_run_options[:pty] = true
CREATE TABLE `academico_test`.`phone_carrier` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(150) ,
`txt_address` VARCHAR(150) ,
`txt_message_length` VARCHAR(150) ,
PRIMARY KEY (`id`)
)
ENGINE = MyISAM;
@fabriziomachado
fabriziomachado / database.php
Created September 5, 2011 23:00
application/config/database.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
#$active_group = 'default';
$enviroment = 'default';
if (ENVIRONMENT === 'testing') $enviroment .= '_test';
$active_group = $enviroment;
$active_record = TRUE;
// production enviromment