Skip to content

Instantly share code, notes, and snippets.

@gagarine
gagarine / template.php
Created August 26, 2011 03:35
Drupal: Group more than one fields in a view
<?php
/**
* overwrite theme_views_view_list
*
* Group more than one fields in a view
*
*/
function template_views_view_list__VIEWNAME($view, $group, $row) {
//the field we want to group
@gagarine
gagarine / my.cnf
Created August 26, 2011 09:58
/usr/local/etc/my.cnf to run Drupal on Hombrew's MySQL
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
bind-address = 127.0.0.1
port = 3306
socket = /tmp/mysql.sock
max_allowed_packet = 64M
table_cache = 4096
sort_buffer_size = 2M
@gagarine
gagarine / gist:1173424
Created August 26, 2011 13:39
xwiki search form
<form onsubmit="document.location.href=document.searchform.action+'#o%3As%3Ds%253Aresource%5Ef%3Do%253Aresource%253Do%25253Aterms%25253Ds%2525253A'+escape(escape(escape(escape((jQuery('#curriki-searchbox').val() !=='recherche')?jQuery('#curriki-searchbox').val()'')))); return false;" action="http://planete.sankore.org/xwiki/bin/view/Search/" class="search-box" name="searchform" id="searchform">
<input type="hidden" value="" name="area" class="hidden">
<input type="text" onblur="if (this.value=='') this.value='recherche'" onfocus="if (this.value=='recherche') this.value=''; else this.select()" value="recherche" class="input" name="brsqry" id="curriki-searchbox">
<button name="btn" id="searchbtn" type="submit">Aller</button>
</form>
@gagarine
gagarine / migrate_article.inc
Created August 28, 2011 23:09
Migrate class for drupal migrate module
<?php
abstract class SkCommonMigration extends Migration {
public function __construct() {
parent::__construct();
//$this->addFieldMapping('field_tags', 'tags');
}
/**
# Last modified: 2011 Oct 30
# Author: Simon Perdrisat
#### Binds
# Prefix
unbind C-b
set-option -g prefix C-a
bind a send-prefix
# Last active window
@gagarine
gagarine / myregex
Created January 3, 2012 01:36
useful regex
Some of the regex I think useful...
#That will match all blank lines except if the line is the very last line in the file.
^\s*[\r\n]+
@gagarine
gagarine / drupal_install.sh
Created February 12, 2012 18:40
install drupal in the very fast way
# Using version 4 of drush http://drush.ws/help
drush dl drupal
mv drupal-7.10 d7.dev
cd d7.dev
drush site-install standard --db-url=mysql://user:passwd@localhost/og --db-su=root --db-su-pw= --site-name=D7-Dev
@gagarine
gagarine / .htacess
Created February 20, 2012 22:53
Apache redirect according to browser language
## Tested on Drupal 7
## On frontpage redirect to /fr if the browser language start with fr
RewriteCond %{HTTP:Accept-Language} ^fr.*$ [NC]
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteCond %{QUERY_STRING} !(^q\=) [NC]
RewriteRule ^(.*)$ /fr [L,R=302]
@gagarine
gagarine / gist:2019386
Created March 12, 2012 02:42
sbb / cff API
SBB / CFF API mobile
xmlfahrplan.sbb.ch 194.150.245.139
Apparently this is the same crapy API than Deutsche Bahn.
### Client: POST xmlfahrplan.sbb.ch/bin/extxml.exe
<?xml version="1.0" encoding="iso-8859-1"?>
@gagarine
gagarine / my_mixin.less
Created May 23, 2012 12:12
mixin than I miss in twitter bootstrap
// mixin than I miss in twitter bootstrap
// Convert px to em
// For default context use the same value than @baseFontSize but without unit
.font-size( @target: @basefont, @context: 13 ) {
font-size: (@target / @context) + 0em;
}