Skip to content

Instantly share code, notes, and snippets.

@tarnus
tarnus / godaddy_stuff
Created July 21, 2014 17:19
Godaddy Settings for Drush and php.ini
.drush/drush.ini:
memory_limit = 128M
error_reporting = E_ALL | E_NOTICE | E_STRICT
display_errors = stderr
in html folder file name php5.ini:
expose_php = Off
max_input_time = 60
variables_order = "EGPCS"
@tarnus
tarnus / gist:f5361d7f26a3e5201c56
Created June 6, 2014 16:45
Updated json cixx
var data2= new Array();
var items= new Array();
$.ajax({
dataType: "jsonp",
cache: true,
url: 'http://api.wunderground.com/api/c901ba8827136492/history_20000405/q/CA/San_Francisco.json',
data: data2,
success: function(data2){ // do something here
@tarnus
tarnus / gist:c46545ccded3520a62b3
Created June 5, 2014 16:35
Jquery to populate link locations
(function ($) {
Drupal.behaviors.appointment = {
attach: function(context, settings) {
//Begin my code
function arrayContains(needle, arrhaystack)
{
return (arrhaystack.indexOf(needle) > -1);
}
var statelist=new Array();
.me-team .slide-item-wrap img {
border-radius: 50%;
display: block;
margin: 0 auto;
max-width: 100%;
transition: all 0.18s linear 0s;
}
@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;
}
@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 / 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 / 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 / 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 / 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)) {