Skip to content

Instantly share code, notes, and snippets.

View wescleymatos's full-sized avatar
:octocat:
I'm ready!

Wescley Matos wescleymatos

:octocat:
I'm ready!
View GitHub Profile
@wescleymatos
wescleymatos / autocomple.txt
Created December 1, 2011 19:13
autocomplete com cake e jqueryUI
function admin_busca(){
$this->layout = "ajax";
$list = $this->Car->find('list',array('fields' => array('Car.id', 'Car.type')));
foreach($list as $key => $value){
$array[] = array("label" => $value, "value" => $value, "id" => $key);
}
echo json_encode($array);
}
========================================
<div class="ui-widget">
@wescleymatos
wescleymatos / innerjoin.txt
Created November 30, 2011 14:34
Relação Entre inner join SQL e no Cakephp
--
-- Estrutura da tabela `cars`
--
CREATE TABLE IF NOT EXISTS `cars` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`kind_id` int(11) NOT NULL,
`album_id` int(11) DEFAULT NULL,
`type` set('novo','usado') DEFAULT NULL,
`year` varchar(45) DEFAULT NULL,
@wescleymatos
wescleymatos / gist:1376621
Created November 18, 2011 14:39
Codigo para pegar feeds do youtube
<?php
// Seu usuário do YouTube
$usuario = 'username';
// URL do Feed RSS de vídeos de um usuário
$youTube_UserFeedURL = 'http://gdata.youtube.com/feeds/api/users/%s/uploads';
// Usa cURL para pegar o XML do feed
$cURL = curl_init(sprintf($youTube_UserFeedURL, $usuario));
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
@wescleymatos
wescleymatos / gist:1373001
Created November 17, 2011 12:02
Pegar timeline do twitter
<?php
function pegatwitter($usuario, $qtd = 10){
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'http://twitter.com/statuses/user_timeline/' . $usuario . '.json?count=' . $qtd,
CURLOPT_HEADER => false,
CURLOPT_RETURNTRANSFER => true)
);
$request = curl_exec($curl);
curl_close($curl);
@wescleymatos
wescleymatos / ajax.js
Created August 30, 2011 14:58
Requisição ajax com jquery
$(function(){
$("#UsuarioLogin").blur(function(){
$.ajax({
type: "GET",
url: "valido/" + $(this).val(),
dataType: "json",
beforeSend: function(){
console.log("carregando...");
},
success: function(text){
@wescleymatos
wescleymatos / .bashrc
Created May 2, 2011 13:06
Minhas alterações no .bashrc
#config rvm
[[ -s "/home/wescley/.rvm/scripts/rvm" ]] && source "/home/wescley/.rvm/scripts/rvm"
#config path java
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export PATH=/usr/lib/jvm/java-6-sun/bin:$PATH
#config path grails
export PATH=~/.grails/bin:$PATH
export GRAILS_HOME=~/.grails