Skip to content

Instantly share code, notes, and snippets.

View isholgueras's full-sized avatar

Ignacio Sánchez isholgueras

View GitHub Profile
@isholgueras
isholgueras / ColorCSSMetroMadridCartoDB.css
Created September 30, 2015 11:38
Colores CSS para las líneas del metro de Madrid
#plano_real[name="Línea 1"] {
line-color: #30a3dc;
}
#plano_real[name="Línea 2"] {
line-color: #cd031f;
}
#plano_real[name="Línea 3"] {
line-color: #ffe114;
}
#plano_real[name="Línea 4"] {
@isholgueras
isholgueras / gist:1993676
Created March 7, 2012 15:03
Transliteration in javascript
var normalize = (function() {
var from = "ÃÀÁÄÂÈÉËÊÌÍÏÎÒÓÖÔÙÚÜÛãàáäâèéëêìíïîòóöôùúüûÑñÇç",
to = "AAAAAEEEEIIIIOOOOUUUUaaaaaeeeeiiiioooouuuunncc",
mapping = {};
for(var i = 0, j = from.length; i < j; i++ )
mapping[ from.charAt( i ) ] = to.charAt( i );
return function( str ) {
var ret = [];
for( var i = 0, j = str.length; i < j; i++ ) {
var c = str.charAt( i );
@isholgueras
isholgueras / group-by-with-pager.sql
Created July 17, 2012 13:56
Consulta que la pone dura. Posiblemente muy poco eficaz.
SELECT DISTINCT `title`
FROM `aggregator_item`
WHERE `title` IN
(SELECT *
FROM
(SELECT DISTINCT `title`
FROM {aggregator_item} ORDER BY `iid` desc limit $first_page, $last_page) as titles)
@isholgueras
isholgueras / gist:3271864
Created August 6, 2012 07:14
Add fields of an entity to a form
<?php
$form['#prefix'] = '<div id="wrapper-form">';
$form['#suffix'] = '</div>';
$form['hidden_tipo'] = array(
'#type' => 'hidden',
'#value' => $tipo,
);
@isholgueras
isholgueras / Config_Debian_Proxy.sh
Created October 23, 2012 08:05
Configuración de servidores Debian 6 después de instalar el SO si están detrás de proxy para hacer cosas turbias con Drupal
##### Meter en el .bashrc ################################
export PATH="$PATH:/usr/local/share/drush:/usr/local/bin"
export http_proxy=http://user:pass@IP:Port
export ftp_proxy=http://user:pass@IP:Port
## Recargar el fichero .bashrc sin tener que reiniciar la consola
source ~/.bashrc
##### Meter en el /etc/apt/sources.list ##################
# non free packages
deb http://ftp.fr.debian.org/debian/ squeeze non-free
@isholgueras
isholgueras / drubox.make
Created October 25, 2012 09:19
Drupal make from the scratch
; This file was auto-generated by drush make
core = 7.x
api = 2
projects[drupal][version] = "7.x"
; Profiles
; Please fill the following out. Type may be one of get, git, bzr or svn,
; and url is the url of the download.
projects[soc][download][type] = ""
@isholgueras
isholgueras / start.sh
Last active December 16, 2015 05:09
Tune up my Linux Mint DE
# Installing ia32-libs
apt-get install ia32-libs
# Installing LAMP
apt-get install mysql-server
apt-get install phpmyadmin
# Installing browsers
apt-get install chromium
@isholgueras
isholgueras / configure.sh
Last active December 16, 2015 05:09
Configure some things of Linux Mint DE
# Configurations of editor and bash
# as root, in /etc/vim/vimrc uncomment
syntax on
# as root, in /etc/bash.bashrc add after 'alias ls'
alias ll='ls -l --color=auto'
# Config for apache, php, mysql,...
cd /etc/apache2/mods-enabled/
ln -s ../mods-available/rewrite.load
<?php
/**
* @file
* Fichero de funcionalidad de módulo de lowercase.
*/
define("LOWERCASE_BY_DEFAULT", 0);
define("LOWERCASE_CACHE_PREFIX", "idn_lw1_");
define("LOWERCASE_CACHE_PREFIX_2", "idn_lw2_");
@isholgueras
isholgueras / .htaccess_uploads_directory
Last active February 15, 2017 08:17
.htaccess to add inside the wp-content/uploads folder in wordpress to avoid php (and others scripts) execution
RewriteEngine on
#if the file does not have one of theses extensions
RewriteCond %{REQUEST_URI} !\.(png|jpg|jpeg|gif|js|css|zip|pdf)$
#then it should be marked as forbidden.
RewriteRule .*$ - [F]