This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Crop imagenes, las imagenes tienen buena resolucion pero no tienen un estandar en los anchos altos | |
// Se necesita imagenes cuadradas, actualmente la mayoria tienen espacio a los costados | |
// Paso 1, escalar todas los altos de todas las imagenes, el ancho debe ser proporcional | |
// Paso 2, reprocesar las imagenes escaladas posicionarse al centro con -gravity center, y tomar 2400px | |
// la imagen quedara cuadrada (rescalada) | |
// Se usa ImageMagick en macbook (Instalar con Brew: brew instal imagemagick) | |
// Se usan los siguientes comandos: | |
// (modificar los folderes a requerimiento, las imagenes procesadas se generan con el mismo nombre) | |
$ magick 'original/*.jpg' -quality 100 -set filename:f '%t' -scale x2400 x2400/'%[filename:f].jpg' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
//do jQuery stuff when DOM is ready | |
}); | |
jQuery(document).ready(function($) { | |
//do jQuery stuff when DOM is ready | |
}); | |
$(function(){ | |
//jQuery code here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* {@inheritdoc} | |
*/ | |
public function build() { | |
return [ | |
'#theme' => 'cfc_footer_block', | |
'#attributes' => [ | |
'class' => ['footer'], | |
], | |
'#cache' => [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function formatDate($date) | |
{ | |
$date = new \DateTime($date); | |
$date = $date->getTimestamp(); | |
return \Drupal::service('date.formatter')->format($date, '', 'd \d\e F \d\e Y'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for d in data %} | |
{% set text = d.resumen |split(' ') %} | |
{% set t2 = '' %} | |
{% if text|length > 10 %} | |
{% for t in text|slice(0, 10) %} | |
{% set t2 = t2 ~ ' ' ~ t %} | |
{% endfor %} | |
{% set t2 = t2 ~ '...' %} | |
{% else %} | |
{% set t2 = text|join(' ') %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getNodesByTaxonomyTermIds($termIds){ | |
$termIds = (array) $termIds; | |
if(empty($termIds)){ | |
return NULL; | |
} | |
$query = \Drupal::database()->select('taxonomy_index', 'ti'); | |
$query->fields('ti', array('nid')); | |
$query->condition('ti.tid', $termIds, 'IN'); | |
$query->distinct(TRUE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$query->condition('myfield', array(1, 2, 3), 'IN'); | |
$query->condition('myfield', array(5, 10), 'BETWEEN'); | |
$query->condition('myfield', array(1, 2, 3), 'NOT IN'); | |
$query->isNull('myfield'); | |
$query->isNotNull('myfield'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$date = new DateTime('now'); | |
$date->modify('last day of this month'); | |
echo $date->format('Y-m-d'); | |
$date->modify('last day of 1 month'); | |
echo $date->format('Y-m-d'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var str = '/?token=123ADV'; | |
var result = str.replace(/^(.*)?\=/g,''); | |
//result = 123ADV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
$.fn.getHiddenDimensions = function(boolOuter) { | |
var $item = this; | |
var props = { position: 'absolute', visibility: 'hidden', display: 'block' }; | |
var dim = { 'w':0, 'h':0 }; | |
var $hiddenParents = $item.parents().andSelf().not(':visible'); | |
var oldProps = []; | |
$hiddenParents.each(function() { | |
var old = {}; |
NewerOlder