Skip to content

Instantly share code, notes, and snippets.

@investic
investic / gist:538267
Created August 19, 2010 16:21
invocar a un node form desde un nodo, "guarrismo" pero donde manda patron no manda marinero :)
<?php
//tiene mas peligro que una escopeta de feria pero yo que se por guardarlo todo como las urracas
global $user;
$type = 'garden';
$node = array('uid' => $user->uid, 'name' => $user->name,
'type' => $type);
module_load_include('inc', 'node', 'node.pages');
$form = drupal_get_form($type .'_node_form', $node);
@investic
investic / gist:536295
Created August 18, 2010 21:49
Processing con android osc
// sacado de este snipsets y cambiado las rutas de osc para que pille el programa andorid osc.
import processing.opengl.*;
import oscP5.*;
OscP5 oscP5;
float xrot = 0;
float zrot = 0;
float xrot_targ = 0;
@investic
investic / gist:515755
Created August 9, 2010 17:33
Consulta de dos o mas rss con el servicio de yahoo yql
select channel.title, channel.link, channel.item.title, channel.item.link, channel.item.description, channel.item.guid
from xml where url in( 'http://karlosgliberal.investic.net/blog/feed', 'http://miren.investic.net/blog/feed') and channel.item.title like "%post%"
@investic
investic / gist:515693
Created August 9, 2010 16:48
Parser para json para el modulo feeds de drupal
<?
/**
* A parser for the Sitemap specification http://www.sitemaps.org/protocol.php
*/
class HontzafeedsParser extends FeedsParser {
public function parse(FeedsImportBatch $batch, FeedsSource $source) {
$string = $batch->getRaw();
$json = json_decode($string);
drupal_set_message(dprint_r($json,1));
#wget para hacer cron con user agent definido
wget --user-agent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" http://devinvestic.com/cron.php > /dev/null 2>&1
<?php
//Recortar un teaser (o campo de cck) sin que rompa las etiquetas
print drupal_substr(strip_tags($teaser), 0, 200).'leer más';
?>
<?
/**
* Implementation of hook_nodeapi().
* Drupal Crear dos nodos con un campo en comun
*/
function sorteo_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
switch ($op) {
case 'insert':
//crear dos nodos de quiz relacionados por su campo de nid
if($node->type == 'quiz' && !$node->field_identificador[0]['value']){
grep "Dec 10 10:" error.log
grep "10/Dec/2009:12" access.www | awk '{print $7}'
<?php
phpinfo();
?>