Skip to content

Instantly share code, notes, and snippets.

View fabiancarlos's full-sized avatar
🚀
Go!

Fabian Carlos fabiancarlos

🚀
Go!
View GitHub Profile
@fabiancarlos
fabiancarlos / multi_up.php
Created May 27, 2012 19:37
upload the image ~ Kohana 3.2 com plugin multi.js
<?php
// validation file image
$files = Validation::factory($_FILES)
->rule('imagem', 'Upload::type', array(':value', array('jpg', 'png', 'gif')));
// if file image is not empty, just do it bob!!! =:^D
if ($files->check() && !empty($_FILES['imagem']['name'][0])){
// pega o ultimo ID do servicos
@fabiancarlos
fabiancarlos / enviar.php
Created May 25, 2012 23:07
exemplo enviar via get
<a href="teste.php?resposta=sim" >REPOSTA GET</a>
<?php
$resposta_get = $_GET['resposta'] ? $_GET['resposta'] : 'SEM PARAMETRO NA URL';
echo $reposta_get;
?>
@fabiancarlos
fabiancarlos / Pessoa.java
Created May 13, 2012 22:55
5 pessoas declaram suas cores favoritas
import java.util.ArrayList;
import java.util.Iterator;
import javax.swing.JOptionPane;
public class Pessoa {
public static void main(String[] args) {
String[] pessoas = new String[5];
@fabiancarlos
fabiancarlos / image_upload_kohana.php
Created May 13, 2012 09:11
upload the image ~ Kohana 3.2 ~ FIX BUG "Kohana_Exception [ 0 ]: Not an image or invalid image:"
<?php
# protected $_path = 'media/images/uploads/produtos/';
# $produtos = new Model_Produtos;
# $time_now = new DateTime();
// validation file image
$files = Validation::factory($_FILES)
->rule('imagem', 'Upload::not_empty')
->rule('imagem', 'Upload::type', array(':value', array('jpg','jpeg','png','gif','JPG','JPEG','PNG','GIF')))
->rule('imagem', 'Upload::image');
@fabiancarlos
fabiancarlos / Conta.java
Created May 11, 2012 21:20
Pequena class de exemplo de incremento e decremento de um valor
public class Conta{
private double saldo;
public Conta(double saldo){
this.saldo = saldo;
}
public void depositar(double valor){