Skip to content

Instantly share code, notes, and snippets.

@tarnus
tarnus / gist:4569822
Created January 19, 2013 00:22
.zshrc file
setopt prompt_subst
autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr 'M'
zstyle ':vcs_info:*' unstagedstr 'M'
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' actionformats '%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
zstyle ':vcs_info:*' formats \
'%F{5}[%F{2}%b%F{5}] %F{2}%c%F{3}%u%f'
zstyle ':vcs_info:git*+set-message:*' hooks git-untracked
zstyle ':vcs_info:*' enable git
@tarnus
tarnus / gist:4720431
Created February 6, 2013 04:51
superfish bare css
/*************************************************************
* menus
*************************************************************/
div#zone-menu-wrapper{
position:relative;
top: 0;
}
div#region-menu.grid-10{
margin-left: 0px;
@tarnus
tarnus / gist:5161607
Created March 14, 2013 14:08
yum.conf
[main]
exclude=apache* bind-chroot courier* dovecot* exim* filesystem httpd* mod_ssl* m
ydns* mysql* nsd* perl* php* proftpd* pure-ftpd* ruby* spamassassin* squirrelmai
l*
tolerant=1
errorlevel=1
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
@tarnus
tarnus / token_functionality_in_fields
Last active December 15, 2015 00:29
Drupal Hook to add token functionality to default values of fields
/**
* Implements hook_field_widget_form_alter().
*/
function MODULENAME_hook_field_widget_form_alter(&$element, &$form_state, $context) {
// Prevent replace tokens on field admin ui form.
if (!is_null($element['#entity'])) {
// Determine the $user. If entity has uid, try to load. If can't, use the
// global $user.
if (isset($element['#entity']->uid)) {
@tarnus
tarnus / drupalautomate
Created April 23, 2013 17:35
drupal automation install
#!/bin/bash
cd base_install
cp local.make.example ../drush.make
cp drupal-org.make ../
cd ..
drush make drush.make
cd sites/default
cp default.settings.php settings.php
chmod 777 settings.php
mkdir files
@tarnus
tarnus / preprocess-html.inc
Created July 17, 2013 15:06
preprocess-html hook to force IE out of compatibility mode
// Using Omega theme copy this to preprocess-html.inc
$data = array(
'#tag' => 'meta',
'#attributes' => array(
'http-equiv' => "X-UA-Compatible",
'content' => "IE=edge,chrome=1",
)
);
@tarnus
tarnus / gist:6253311
Created August 16, 2013 20:34
custom formatter to include phone and fax using addressfield_phone
$formatter = new stdClass();
$formatter->disabled = FALSE; /* Edit this to true to make a default formatter disabled initially */
$formatter->api_version = 2;
$formatter->name = 'my_address';
$formatter->label = 'My Address';
$formatter->description = '';
$formatter->mode = 'php';
$formatter->field_types = 'addressfield';
$formatter->code = ' $address="";
foreach ($variables[\'#items\'] as $item) {
@tarnus
tarnus / entityfield query
Created September 28, 2013 14:36
Entity field query example
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'event')
->propertyCondition('status', 1);
$noderesult = $query->execute();
if (isset($noderesult['node'])) {
$kb_items_nids = array_keys($noderesult['node']);
$kb_items = entity_load('node', $kb_items_nids);
// dsm($kb_items);
@tarnus
tarnus / sample.nginx.conf
Created April 2, 2014 13:06
Sample nginx config
server {
listen 80;
server_name shoptest.snethosting.com;
access_log /var/log/nginx/shoptest.snethosting.com.access.log;
root /home/shoptest;
index index.php;
location / {
try_files $uri $uri/ @drupal;
}
.me-team .slide-item-wrap img {
border-radius: 50%;
display: block;
margin: 0 auto;
max-width: 100%;
transition: all 0.18s linear 0s;
}