Skip to content

Instantly share code, notes, and snippets.

@asanchez75
asanchez75 / mixins
Created September 23, 2012 01:01
mixins
// http://stackoverflow.com/questions/6902944/sass-mixin-for-background-transparency-back-to-ie8
@mixin transparent($color, $alpha) {
$rgba: rgba($color, $alpha);
$ie-hex-str: ie-hex-str($rgba);
background-color: transparent;
background-color: $rgba;
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#{$ie-hex-str},endColorstr=#{$ie-hex-str});
zoom: 1;
}
@asanchez75
asanchez75 / gist:3773841
Created September 24, 2012 02:14
conceptual notes (Drupal)
features >> context >> panels >> views >> fields
@asanchez75
asanchez75 / gist:3794288
Created September 27, 2012 14:26
emogrifier
<?php
//print boletin_correo($build['#node']->nid)
require_once(libraries_get_path('emogrifier') . '/emogrifier.php');
// using emogrify, loading css from file
$css = file_get_contents(drupal_get_path('theme', 'rubbersoul') . '/css/boletin.css');
$emo = new Emogrifier();
$emo->setCSS($css);
$emo->setHTML(boletin_correo($build['#node']->nid));
print $emo->emogrify();
@asanchez75
asanchez75 / gist:3795097
Created September 27, 2012 16:55
Views
print only fields free for html tags
$view = views_get_view('noticias');
$view->set_display('block_2');
$view->execute();
dpm($view->result);
print full output of field with html tags
$view = views_get_view('noticias');
\documentclass[10pt,a4paper,twoside]{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{lmodern}
%http://lexfridman.com/blogs/research/2011/03/06/prevent-figures-from-floating-outside-sections-in-latex/
\usepackage[section,subsection,subsubsection]{extraplaceins}
@asanchez75
asanchez75 / gist:3809570
Created October 1, 2012 05:13
Drupal snippets
URI
file_create_url($uri)
MAP HTML TAG
function bcrp_html_map_code($mapname, $shape, $coords, $href, $alt, $title) {
$area = theme('html_tag', array(
'element' => array(
'#tag' => 'area',
'#attributes' => array(
@asanchez75
asanchez75 / gist:3872218
Created October 11, 2012 13:18
Drupal geofield
1. Descargar geofield e instalar con su dependencia geophp
2. Descargar Openlayers y activar
3. Aparecerá Openlayers como widget en el geofield
4. Ir a panelizer (Select a formatter) y seleccionar "Geofield Map" (no openlayers), eso permitirá setear el preset del mapa
@asanchez75
asanchez75 / gist:3872985
Created October 11, 2012 15:00
Drupal formatters
$items = $variables['#items'];
foreach ($items as $item) {
$uids[] = $item['uid'];
}
$args = implode(',', $uids);
if (module_exists('views')) {
return views_embed_view('staff', 'block', $args);
}
else {
return drupal_set_message(t('You have to enable Views module and create a views block named equipo with table style'));
@asanchez75
asanchez75 / gist:3885436
Created October 13, 2012 17:21
Drupal renderable array
1.
$x = array(
'#type' => 'html_tag',
'#value' => 'hola',
'#tag' => 'div',
);
2.
dpm(drupal_render($x));
@asanchez75
asanchez75 / Drupal autocomplete
Created October 16, 2012 20:53
Drupal autocomplete
http://drupal.org/project/multiple_selects
http://drupal.org/project/finder
http://drupal.org/project/autocomplete_widgets
http://drupal.org/project/text_noderef