Skip to content

Instantly share code, notes, and snippets.

#
# 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 / 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"
@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',
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 / 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"
@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 / 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 / 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'];
}
<?php
$adam = array(
'remote-host' => 'adammalone.net',
'root' => '/var/www/html/adammalone/docroot',
'uri' => 'adammalone.net',
'strict' => 0,
'path-aliases' => array(
'%dump-dir' => '/home/adammalone/.drush/dumps',
'%files' => 'sites/default/files',
function distanceGeoPoints ($long1, $lat1, $long2, $lat2) {
$lat = deg2rad($lat2 - $lat1);
$long = deg2rad($long2 - $long1);
$a = sin($lat/2) * sin($lat/2) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * sin($long/2) * sin($long/2);
$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
$d = 6371 * $c;
return $d;
}