Skip to content

Instantly share code, notes, and snippets.

@gagarine
gagarine / template.php
Created September 24, 2010 13:16
remove Drupal module and core default CSS
<?php
function theme_preprocess_page(&$vars) {
//remove drupal default system CSS (IE can only take 31 CSS files)
$css = drupal_add_css();
$rm_css = array(
'modules/node/node.css',
'modules/poll/poll.css',
'modules/system/defaults.css',
//'modules/system/system.css',
//'modules/system/system-menus.css',
@gagarine
gagarine / drupal-fast-starting-scrit.sh
Created December 25, 2010 16:49
Drupal fast starting script
#Download drupal core
drush dl --drupal-project-rename=PROJECTNAME
cd PROJECTNAME/sites/all/
mkdir modules themes modules/contrib modules/features modules/costum
#Basic
drush dl cck views filefield imagefield imageapi imagecache backup_migrate pathauto token webform webformblock advanced_help diff jquery_ui logintoboggan date content_profile account_profile calendar
@gagarine
gagarine / gist:794193
Created January 24, 2011 23:18
geo field
[field_geo_latlon] => Array
(
[0] => Array
(
[geo] => —ij¢‘ 9@'‡©Ëí/M@
[gis type] => point
[wkb] => —ij¢‘ 9@'‡©Ëí/M@
[wkt] => POINT(25.627222222222 58.374444444444)
[lat] => 23.234234234
[lon] => 2.234234234
@gagarine
gagarine / mysql_multiple_import.bash
Created February 24, 2011 22:34
Import multiple sql file in a mysql database
#!/bin/bash
db=$1
user=$2
passwd=$3
if [ "$db" = "" ]; then
echo "Usage: $0 db_name user password"
exit 1
fi
clear
for sql_file in *.sql; do
; This file was auto-generated by drush_make
core = 7.x
api = 2
projects[drupal][version] = "7.0"
; Profiles
; Please fill the following out. Type may be one of get, cvs, git, bzr or svn,
; and url is the url of the download.
projects[standard][download][type] = ""
@gagarine
gagarine / easybox_sip_passwd.pl
Created July 23, 2011 18:20 — forked from wose/easybox_sip_passwd.pl
arcor/vodafone won't give you your sip password for free, but i will: capture an incoming call (WAN VC2) with the diagnostic tool in your easybox, load the .cap file in wireshark and search for SIP/SDP Request:INVITE, Message Header -> Proxy-Authorization
#!/usr/bin/env perl
use strict;
use warnings;
use Digest::MD5 'md5_hex';
print_usage() unless($#ARGV==5);
my ($method, $uri, $user, $realm, $nonce, $response) = @ARGV;
my $hash_method_uri = md5_hex(join(':', $method, $uri));
<?php
function hook_views_pre_render(&$view) {
if ($view->name == 'ranges_by_room') {
//we order the view by node_node_data_field_pim_offer_title
//and we want the offer information only one time
$preview_offer = FALSE;
foreach ($view->result as $key => $value) {
if ($preview_offer == $view->result[$key]->node_node_data_field_pim_offer_nid) {
unset($view->result[$key]->node_node_data_field_pim_offer_node_data_field_pim_description_field_pim_description_value);
unset($view->result[$key]->node_node_data_field_pim_offer_node_data_field_pim_image_field_pim_image_value);
@gagarine
gagarine / theme.inc
Created August 17, 2011 20:01
views theme.inc arround line 500
<?php
function template_preprocess_views_view_unformatted(&$vars) {
$view = $vars['view'];
$rows = $vars['rows'];
$vars['classes'] = array();
// Set up striping values.
foreach ($rows as $id => $row) {
$row_classes = array();
@gagarine
gagarine / disable_google_fade-in
Created August 23, 2011 13:26
greasmonkey script to Disable Google Fade-in Homepage on background image
// ==UserScript==
// @name Disable Google Fade-in Homepage
// @namespace http://googlesystem.blogspot.com
// @description Disable Google's new homepage
// @include http://www.google.*/
// @include http://www.google.*/webhp*
// @include http://www.google.*/#*
// @include https://www.google.*/
// @include https://www.google.*/webhp*
// @include https://www.google.*/#*
@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