Skip to content

Instantly share code, notes, and snippets.

@jonatanfroes
jonatanfroes / Form.html
Created September 29, 2012 16:58
Codeigniter + Jquery File Upload
<!-- configure a url que irá receber os dados -->
<input id="fileupload" type="file" name="Filedata" data-url="<?php echo site_url('admin/portfolio/save_photo/' . $gallery->id); ?>" multiple />
<div id="progress" class="progress progress-striped active">
<div class="bar" style="width: 0;"></div>
</div>
<div id="upload_result"></div>
<hr />
<!-- /end multiple upload -->
// service para buscar fotos
.factory('galleryService', function($http, $q){
//var url = 'http://www.pontovips.com.br/api.php';
var url = 'http://localhost/pontovips-app/www/api.php';
return {
getItems: function(nuItemsPerRequest, firstItem) {
return $http.get(url, {
params: {
@jonatanfroes
jonatanfroes / MY_Paginations.php
Created January 18, 2012 16:29
Extend CodeIgniter Pagination to add Query String
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* MY_Pagination Class
*
* Extends Pagination library
*
*/
class MY_Pagination extends CI_Pagination {
public $add_query_string = FALSE;
@jonatanfroes
jonatanfroes / gist:1935123
Created February 28, 2012 21:06
Buscar CEP CodeIgniter
//helper cep
if ( ! function_exists('buscar_endereco'))
{
function buscar_endereco($cep)
{
$cep = str_replace('.', '', $cep);
$cep = str_replace('-', '', $cep);
$url = 'http://republicavirtual.com.br/web_cep.php?cep='.urlencode($cep).'&formato=query_string';
@jonatanfroes
jonatanfroes / InstagramController.php
Created December 18, 2018 21:39
fix login required
/*
Jonatan Froes <jonatanfroes@gmail.com>
1. on InstagramController.php, remove this line:
$Account->set("login_required", 1)->update();
*/
/*
2. add this lines:
@jonatanfroes
jonatanfroes / MY_form_helper.php
Created June 4, 2013 14:07
Helper para gerar dropdown automaticamente a partir de uma consulta ao banco de dados (active record). #codeigniter
/**
* returns an array w/ key => value to populate a select
*
* @access public
*
* @param object active record result
* @param string field name that will be displayed
* @param string field name that will be used as option value
* @param array Add a value before result from db
* @param mixed remove a value from list
@jonatanfroes
jonatanfroes / MY_Form_validation.php
Created August 20, 2012 14:16
CodeIgniter My_Form_validation p/ validação de CPF e outros
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* MY_Form_validation Class
*
* Extends Form_Validation library
*
*/
class MY_Form_validation extends CI_Form_validation {
function __construct()