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
<?php | |
// requires the ip2cc module (http://drupal.org/project/ip2cc) | |
if (!function_exists('drupal_match_path')) { | |
// copy of http://api.drupal.org/api/function/drupal_match_path/6 | |
function drupal_match_path($path, $patterns) { | |
static $regexps; | |
if (!isset($regexps[$patterns])) { | |
$regexps[$patterns] = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($patterns, '/')) .')$/'; |
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
<sup><span rise="3000" font_desc="Droid Sans 7.5" color="#878787" weight="normal">%a %d %b</span></sup>%n<sub><span font_desc="Droid Sans 7.5" color="#878787" weight="bold">%I:%M %p</span></sub> |
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
#!/bin/sh | |
# Author : Dan Braghis <dan [at] zerolab.org> | |
# Date : 31/10/2009 | |
# depends: java, yuicompressor | |
# varsion: 1.0 | |
# Minifies the selected files using YUI Compressor (http://developer.yahoo.com/yui/compressor/). | |
# The script assumes yuicompressor.jar is located in /opt/ | |
IFS=' | |
' |
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
./configure --prefix=/usr \ | |
--sbin-path=/usr/sbin/nginx \ | |
--conf-path=/etc/nginx/nginx.conf \ | |
--error-log-path=/var/log/nginx/error.log \ | |
--http-log-path=/var/log/nginx/access.log \ | |
--pid-path=/var/run/nginx.pid \ | |
--lock-path=/var/lock/nginx.lock \ | |
--user=www-data \ | |
--group=www-data \ | |
--with-http_realip_module \ |
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
# Directory size | |
du --max-depth=1 ./ | sort -n -r | |
################################# | |
# full hard disk copy | |
dd if=/dev/hdx of=/dev/hdy | |
dd if=/dev/hdx of=/path/to/image | |
dd if=/dev/hdx | gzip > /path/to/image.gz |
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
<?php | |
// Drupal 5 | |
// Show block if a node has a specific taxonomy term | |
$show_block = FALSE; | |
if ( arg(0) == "node" && is_numeric(arg(1)) ) { | |
$node = node_load(arg(1)); | |
$section_term_id = 1334; // replace this to the corresponding term id | |
$show_block = ( is_array($node->taxonomy) && in_array($section_term_id, array_keys($node->taxonomy)) ); | |
} |
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
<?php | |
/** | |
* Mass delete nodes of $nodetype | |
* put the file in the Drupal root and adjust $nodetype and $limit as you like | |
*/ | |
error_reporting(E_ALL); | |
require_once './includes/bootstrap.inc'; | |
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); | |
$nodetype = "INSERT_NODETYPE_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
### Source: http://www.linuxjournal.com/content/resetting-gnomes-settings-ubuntu | |
cd ~ | |
rm -rf .gnome .gnome2 .gconf .gconfd .metacity |
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
<?php | |
/** | |
* Implements theme_menu_item_link() | |
* Courtesy of http://chrisshattuck.com/blog/how-use-images-menu-items-drupal-simple-preprocessing-function | |
*/ | |
function yourtheme_menu_item_link($link) { | |
// Allows for images as menu items. Just supply the path to the image as the title | |
if (strpos($link['title'], '.png') !== false || strpos($link['title'], '.jpg') !== false || strpos($link['title'], '.gif') !== false) { | |
$link['title'] = '<img alt="'. $link['description'] .'" title="'. $link['description'] .'" src="'. url($link['title']) .'" />'; | |
$link['localized_options']['html'] = 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
# Apache, Drupal - don't log static files | |
# http://2bits.com/drupal-performance/reducing-size-and-io-load-apaches-web-server-log-files.html | |
SetEnvIf Request_URI "\.(jpg|xml|png|gif|ico|js|css|swf|js?.|css?.)$" DontLog | |
CustomLog /var/log/apache2/access-example.com.log combined Env=!DontLog |
OlderNewer