Skip to content

Instantly share code, notes, and snippets.

View gnuget's full-sized avatar

David Valdez gnuget

View GitHub Profile
def recu(x):
li = []
lista = []
li.append('numero')
while x > 1:
if x % 2:
x = x * 3 + 1
lista.append(x)
else:
x = x / 2
<?php
//old way (and with this doesn't work the drag and drop order feature)
$my_group = getGroupDuplicates("some_field");
for($i=1;$i <= $my_group;$i++){
echo get('some_Field',$i);
}
//new way
$the_order = getGroupOrder('some_field');
<?php
/**
* Magic Fields's debug Class
*
* @package Magic Fields
* @subpackage tools
*/
class Debug{
/**
@gnuget
gnuget / Hide the posts created using a write panel
Created October 5, 2009 09:12
Hide the posts created using a write panel
function exclude_writepanels_posts($where){
global $wpdb, $parent_file;
if( $parent_file != 'edit.php' ) return $where;
if (empty($_GET['filter-posts'])){
$where = $where . " AND 0 = (SELECT count($wpdb->postmeta.meta_value)
FROM $wpdb->postmeta WHERE $wpdb->postmeta.post_id = $wpdb->posts.ID and $wpdb->postmeta.meta_key = '_mf_write_panel_id')";
}
return $where;
<?php
function yourfunction($atts) {
//get the value of the custom field.
$value = get("yourfieldname");
return $value;
}
add_shortcode('your_shortcode', 'yourfunction');
?>
#! /usr/bin/env python
# -*- coding: utf-8 -*-
version = "1.0"
__module_name__ = "forceutf-8.py"
__module_version__ = version
import xchat
#! /usr/bin/env python
#http://fitorec.wordpress.com/2009/12/18/deteccion-de-intrusos-en-nuestra-wi-fi/
import urllib2
import re
opener = urllib2.Request('http://home/',None,{})
response = urllib2.urlopen(opener)
response = response.read()
#obteniendo el nombre de las maquinas
<?php
function multiline_with_more($multiline_name){
global $post;
///Get the content of the multiline custom field
$multiline = get('multiline');
//if the page is_Single we replace the <!--more--> tag for:
//<span id="more-9-{$custom_Field_name"></span>
if(is_single($post->ID)){
preg_match('/(.*)(\<\!\-\-more\-\-\>)(.*)/is',$multiline,$matches);
return $matches[1]."<span id='more-{$post->ID}-{$multiline_name}'></span>".$matches[3];
brew install bash-completion
#bash completion
if [ -f /usr/local/Cellar/bash-completion/1.2/etc/bash_completion ]; then
. /usr/local/Cellar/bash-completion/1.2/etc/bash_completion
fi