Skip to content

Instantly share code, notes, and snippets.

@welly
welly / node--services--full.tpl.php
Created May 19, 2015 03:51
looping field collection
$collections = array();
$field_collection_fields = field_get_items('node', $node, 'field_services');
$ids = array();
// Extract the field collection item ids
$ids = array();
foreach ($field_collection_fields as $fc_field) {
$ids[] = $fc_field['value'];
}
@welly
welly / demo.module
Last active August 29, 2015 14:18 — forked from pascalduez/demo.module
<?php
/**
* @file
* Demo module, Basic Ajax form submit (Ajax framework).
*/
/**
* Implements hook_menu().
*/
@welly
welly / gist:30687db6695733e9eb56
Created March 12, 2015 01:26
drush alias entry for vagrant
$aliases['site.vm'] = array(
'env' => 'dev',
'site' => 'site',
'uri' => 'site.vm',
'root' => '/vagrant/www',
'remote-host' => 'site.vm',
'remote-user' => 'vagrant',
'ssh-options' => '-i ~/Clients/site/puphpet/files/dot/ssh/id_rsa',
'command-specific' => array(
'sql-dump' => array(
@welly
welly / loop.sh
Created March 10, 2015 06:35
Loops through a bunch of sites, git init, git add, git commit, git push to remote repo
#!/bin/bash
while read p; do
if [ -d "/home/$p" ]; then
echo $p
if [ -d "/home/$p/public_html" ]; then
cd /home/$p/public_html
git init
git add .
git commit -am "first commit"
server {
server_name [host];
root /var/www/[document_root]; ## <-- Your only path reference.
# Enable compression, this will help if you have for instance advagg module
# by serving Gzip versions of the files.
gzip_static on;
location = /favicon.ico {
@welly
welly / settings.php
Created July 30, 2014 09:10
New Drupal 7 settings file
<?php
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'uat_iapo_drupal',
'username' => 'uat_dba',
'password' => '3W5LcJQv26DpxGMm',
@welly
welly / gist:83b3325022b9eb1a249d
Created June 18, 2014 16:16
Jenkins deploy script
#!/bin/bash
if [[$BRANCH == '']]; then
GIT_BRANCH = "master"
else
GIT_BRANCH = $BRANCH
if
if [ -d "/tmp/clone/"]; then
rm -rf "/tmp/clone"
#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
Order allow,deny
</FilesMatch>
# Don't show directory listings for URLs which map to a directory.
@welly
welly / settings.php
Last active August 29, 2015 14:01
Standard, semi-minimised settings file for Drupal 6
<?php
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'uat_iapo_drupal',
'username' => 'uat_dba',
'password' => '3W5LcJQv26DpxGMm',
@welly
welly / .gitignore
Created May 2, 2014 11:22
Drupal gitignore
# Ignore system files etc.
.DS_Store
.htaccess
.idea
whitefusestub.make
# Ignore paths that contain user-generated content.
sites/*/files
sites/*/private