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 | |
/** | |
* General utility variables: | |
* - $base_path: The base URL path of the Drupal installation. At the very | |
* least, this will always default to /. | |
* - $css: An array of CSS files for the current page. | |
* - $directory: The directory the template is located in, e.g. modules/system | |
* or themes/garland. | |
* - $is_front: TRUE if the current page is the front page. Used to toggle the mission statement. | |
* - $logged_in: TRUE if the user is registered and signed in. |
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 | |
function user_is_editor() { | |
global $user; | |
if(in_array(array('employee editor', 'administrator'), $user->roles) || $user->uid == 1) { | |
return TRUE; | |
} else { | |
return FALSE; | |
} | |
} |
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 | |
function blue_get_block($module, $delta, $subject = '') { | |
$block = new stdclass; // empty object | |
$array = module_invoke($module, 'block', 'view',$delta ); | |
// must be converted to an object | |
// @see block_list() | |
if (isset($array) && is_array($array)) { | |
foreach ($array as $k => $v) { | |
$block->$k = $v; | |
} |
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
/** | |
* overwrite all links with extra subkultura _GET parametr | |
* This is usefull for people that send link over IM's | |
* @param type $path | |
* @param type $options | |
* @param type $original_path | |
*/ | |
function custom_url_rewrite_outbound(&$path, &$options, $original_path) { | |
if(isset($_SESSION['subculture'])) { | |
if(!empty($options['query'])) { |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<config> | |
<!-- Sources --> | |
<sources ignoredDirs="CVS:.svn:tmp:.git:.hg:.bzr"> | |
<source name="drupal" scanPath="/var/www/versions/phoenix109-piotrek" documentRoot="/var/www/versions/phoenix109-piotrek" basePath="/" /> | |
</sources> | |
<!-- Servers --> | |
<servers> | |
<server name="rackspace" transporter="cumulus"> |
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 | |
/** | |
* Pluck an array of values from an array. (Only for PHP 5.3+) | |
* | |
* @param $array - data | |
* @param $key - value you want to pluck from array | |
* | |
* @return plucked array only with key data | |
*/ | |
function array_pluck($array, $key) { |
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
$ sudo easy_install Pygments | |
$ alias c='pygmentize -O style=monokai -f console256 -g' |
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/bash | |
# Set up ssh-agent | |
SSH_ENV="$HOME/.ssh/environment" | |
function start_agent { | |
echo "Initializing new SSH agent..." | |
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" | |
echo succeeded | |
chmod 600 "${SSH_ENV}" | |
. "${SSH_ENV}" > /dev/null |
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 | |
/** | |
* Render ATD node context inside lightbox. | |
*/ | |
function l_lightbox($nid, $text) { | |
return l($text, '/lightbo/'. $nid, array('attributes' => array('class' => 'lightbox', 'rel'=> 'libghtframe')) ); | |
} |
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/bash | |
# Save process name to search | |
PROCESS=$1 | |
# Change 'myapp' > '[m]yapp so grep don't count itself | |
GREP_PROCESS=`echo $PROCESS | sed 's/^\(.\)/[\1]/'` | |
# List processes, remove self command name and on the end count wanted process | |
COUNT=$(ps ax | grep -v $0 | grep -c -i $GREP_PROCESS) |
OlderNewer