Skip to content

Instantly share code, notes, and snippets.

View huoxito's full-sized avatar
🏊‍♂️

Washington L Braga Jr huoxito

🏊‍♂️
View GitHub Profile
@huoxito
huoxito / image_uploader.php
Created July 4, 2011 18:48
Uploading files in cakephp
<?php
/*
* Exmplo de uso no model
*
* var $actsAs = array(
* 'ImagemUpload' => array(
* 'width' => 550,
* 'height' => 356,
* 'thumb' => true,
@huoxito
huoxito / vimrc
Created August 1, 2011 19:52
Vimrc file
" Plugin: pathogen.vim: manage your runtimepath
call pathogen#infect()
filetype plugin indent on
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
"set smartcase " Do smart case matching
set incsearch " Incremental search
@huoxito
huoxito / .bashrc
Created August 18, 2011 03:54
aliases to bashrc
# vim alias
alias g='gvim --remote-silent'
# ssh linode alias
alias linode='ssh huoxito@huoxito.com.br'
@huoxito
huoxito / slug_on_before_save
Created August 25, 2011 14:48
Slug on cakephp
<?php
function beforeSave(){
$slug = Inflector::slug($this->data['Servico']['nome'], '-');
$this->data['Servico']['slug'] = strtolower($slug);
return true;
}
?>
@huoxito
huoxito / posts.rb
Created September 1, 2011 17:55
Posts update
@posts = Post.find(params[:id])
@posts.update_attributes(params[:post])
@huoxito
huoxito / sssss.js
Created September 23, 2011 22:49
jquery json example
$(document).ready(function(){
$('#marca').change(function(){
var marca = $('#marca option:selected').val();
$.getJSON('static/javascripts/models/models?marca', function(json){
var items = '';
$.each(json, function(idx,value) {
if(marca == value['make']){
items += '<option value="' + value['model'] + '">' + value['model'] + '</option>';
}
});
@huoxito
huoxito / selects.js
Created September 25, 2011 01:02
jquerys
$('#model').change(function(){
var model = $('#marca option:selected').val();
var marca = $('#marca option:selected').val();
$.ajax({
url: 'http://quatrorodas.abril.com.br/compre-seu-carro/static/javascripts/price-table-years',
data: { make: marca, model: model, domain: "carro" },
success: function(data){
// monta os options com a var data
}
});
@huoxito
huoxito / jqueryex.js
Created September 25, 2011 01:34
jquery examples
$(document).ready(function(){
$('#marca').change(function(){
var marca = $('#marca option:selected').val();
$.getJSON('static/javascripts/models/models', function(data){
var items = '';
$.each(data, function(idx,value) {
if(marca == value['make']){
items += '<option value="' + value['model'] + '">' + value['model'] + '</option>';
}
});
@huoxito
huoxito / test.rb
Created September 25, 2011 16:29
test route
test "should get index" do
get :index, time_id: "1"
assert_response :success
end
@huoxito
huoxito / rdebug.sh
Created September 25, 2011 16:40
Rdebug test
rdebug -Itest test/functionals/projetos_controller_test.rb