Skip to content

Instantly share code, notes, and snippets.

View gnuget's full-sized avatar

David Valdez gnuget

View GitHub Profile
@gnuget
gnuget / gist:56765
Created February 2, 2009 03:18
Testing
<?php
echo "Hola Mundo";
?>
/**
* Search Videos
* @param array $params
*
*/
function search($params){
$params = $this->__paramsToUrl($params);
$this->socket = new HttpSocket();
$uri = "http://gdata.youtube.com/feeds/api/videos".$params;
$request = array(
@gnuget
gnuget / gist:57605
Created February 3, 2009 16:32
Esta función es parte de un componente de cakephp y obtiene un feed de una busqueda en youtube
<?php
/**
* Search Videos
* @param array $params
*
*/
function search($params){
$params = $this->__paramsToUrl($params);
$this->socket = new HttpSocket();
$uri = "http://gdata.youtube.com/feeds/api/videos".$params;
@gnuget
gnuget / ajax.js
Created February 8, 2009 02:19
Simple ajax call in jquery
//Amarramos a las anchors un evento
$(document).ready(function(){
$("a").click(function(){
alert("hola mundo!");
});
});
//hacemos una llamada ajax
$.ajax({
type: "POST",
@gnuget
gnuget / ajax.js
Created February 8, 2009 02:21
example about how use livequery (jquery plugin)
//Amarramos a las anchors un evento
$(document).ready(function(){
$("a").livequery('click',function(event){
alert("hola mundo!");
});
});
//Con livequery unicamente nos preocupamos por hacer nuesta llamada
//live query se encarga de re-ligar los eventos :D
$.ajax({
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#Author: David Valdez
#Correo: david.valdez210[arroba]gmail.com
#Commands:
# rola.py
version = "1.0"
@gnuget
gnuget / gist:130856
Created June 16, 2009 19:57
get your ip address using python
#!/usr/bin/env python
import re
import urllib2
class get_ip:
def __init__(self):
pass
<?php
function getGroupOrder($field){
global $post,$wpdb;
$elements = $wpdb->get_results("SELECT group_count FROM ".RC_CWP_TABLE_POST_META." WHERE post_id = ".$post->ID." AND field_name = '{$field}' ORDER BY order_id ASC");
foreach($elements as $element){
$order[] = $element->group_count;
}
<?php
$my_field_order = getGroupOrder('field');
foreach($my_field_order as $value){
$element = get('field',$value);
}
?>
#getting all posts related with a write panel in magicfields
select * from wp_posts where wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'future' OR wp_posts.post_status = 'draft' OR wp_posts.post_status = 'pending' OR wp_posts.post_status = 'private') AND 0 < (SELECT count(wp_postmeta.meta_value) FROM wp_postmeta WHERE wp_postmeta.post_id = wp_posts.ID and wp_postmeta.meta_key = '_rc_cwp_write_panel_id' and wp_postmeta.meta_value = '{$write_panel_id}');