Skip to content

Instantly share code, notes, and snippets.

@gagarine
gagarine / template.tpl.php
Created July 29, 2012 21:11
Working with drupal theme_menu_tree
<?php
/**
* Theme_menu_tree doesn't provide any context information
* THIS SUCKS
* But you can use hook_block_view_alter to change the theme wrapper
* OUF!
*/
function MYTHEME_menu_tree(&$variables) {
@gagarine
gagarine / .htaccess
Created June 19, 2012 10:46
.htaccess for drupal with browser language detection
#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$">
Order allow,deny
</FilesMatch>
# Don't show directory listings for URLs which map to a directory.
<?php
$result = db_query("SELECT name, filename FROM {system} WHERE type = 'module' AND status = 0 ORDER BY filename");
$bad_module = array();
while ($module = db_fetch_object($result)) {
//var_dump($module);
if (!file_exists($module->filename)) {
$bad_module[] = $module;
}
}
var_dump($bad_module);
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAu7cj9p+6TiYG8/TB6rBDSTSFHEYucqPytohs0GoMv+/NDxsde2/bR7f+TA80FzxRaRjUs5ypDl5mLvmsjp73DTYrrDFg+aoWRUKmRGySqHGa6bk3Xy0N6TBiVYD2T2Vy98oklhdfnhuQtuRKY3FtuoGiwaQwyB8AIybl/Y8MlBz295eX4696QMZtzcy6rYCE31iAneLHvaMcftaSsUY1wXW6lL25WFAY1qQLAm4wNNqueCv7ZbBEbx0PVhYvzH/ar5Q/7NKTCPe7csjBPim2soBKBbvOruYp41nnn+yyMXCNToe2sP3wU63fbRoZHkz4sFF7zlfWlsNNxTkLGHVr/Q== auquaverde@swisstxt-web.com
<p class="highlight" style="text-align: justify; line-height: 14px; margin-top: 0px; margin-bottom: 14px; font-family: Arial,Helvetica,sans;">TEST</p>
<p class="highlight" style="text-align: justify; line-height: 14px; margin-top: 0px; margin-bottom: 14px; font-family: Arial,Helvetica,sans;">sdf</p>
@gagarine
gagarine / drupal hébergement.md
Created May 26, 2012 13:11
drupal hébergement
@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;
}
@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 / .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]