Skip to content

Instantly share code, notes, and snippets.

@cravecode
cravecode / Drush-7-Install.sh
Created August 3, 2011 17:08
Shell Drush Install Script
#!/bin/bash
# Update user
echo "Drush is now downloading via HTTP"
# move to home dir
cd ~
# remove current drush (if existent)
rm -rf ~/.drush/
# create drush directory (and hide it)
@cravecode
cravecode / apache_drupal_host
Created August 17, 2011 22:16
Apache Drupal Template Host File
# $Id: dist-apache2.conf,v 1.2 2009/09/16 07:37:27 deniver Exp $
#
# Keywords used by the densite script:
#
# server_name
# document_root
# allow_ip
# site_root
#
<VirtualHost *:80>
@cravecode
cravecode / civicrm-issue-549.patch
Last active December 28, 2015 01:29
Corrects the issue that causes non-billing primary address from showing in the my account drupal profile fields.
diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php
index e721f2c..25c50c3 100644
--- a/CRM/Core/BAO/UFGroup.php
+++ b/CRM/Core/BAO/UFGroup.php
@@ -2128,6 +2128,16 @@ AND ( entity_id IS NULL OR entity_id <= 0 )
$defaults[$fldName] = $details[$name];
}
}
+ else if($locTypeId == 1 && is_string($value)) {
+ $trimmed_field_name = str_replace('-Primary', '', $fldName);
7f06b9f0cbe390c71fe7e2697536ad8b5eba03ac
CRM/Contribute/BAO/Contribution.php | 4 ++--
CRM/Contribute/Form/AdditionalInfo.php | 4 ++--
CRM/Contribute/Form/Contribution.php | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php
index d133641..09717c3 100644
--- a/CRM/Contribute/BAO/Contribution.php
+++ b/CRM/Contribute/BAO/Contribution.php
@cravecode
cravecode / find-php-reference.md
Created May 19, 2014 22:33
Find '&' incorrectly used as passing a variable by reference instead of it being used as the function's arguments.
^((?!(?:function|\*|\/\/)).)*\(.*?\&\$.*$
$content = array(
'member_id_row' => array(
'#type' => 'container',
'#attributes' => arra(),
'label' => array(
'#markup' => '<label>' . t('Member ID') . '</label>',
),
'value' => array(
'#markup' => '<span>' . $GLOBALS['user']->name . '</span>',
)
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: GPGTools - https://gpgtools.org
mQINBFVnEeYBEADgRodb7om/S83TuYWZJtVhAcP2R91yi1+trwmKqftAJY0tChKa
2uM9uHtYvU6aKOyNhVaDiU9agm+PKVAuQqnpysVHWA2VokAYIePHtjHTjBorGudn
mid7mfIVaoWW+uJSMFbpxTEj5FH0WpeeNO51Jfpcq6T5jR87EXCHzkU7J2jBMWBw
pQS19Z0XB91pCru/TElY9komRcVvR1JQ2nVDDh6eVn3kLRalYUBYfLFjzMxO22G/
xXPXfATtLAZsh8/RUnuXzmZnMFa0jTbeQgGx9SlQQudr+rGWSVc3dMMA7G1DKE7F
5MKWBUFAIhCQL7VJQ8iLG38R4lGS0ZG3DgcFYUr5RgC/OojIROC1j1dkH7u2eRaR
3eXrRb7siH2dU8TxoVZjkButaFdpb7pM5OgbpVIEMNhuPjMuYaCaQBa7dSrps9he
#!/bin/bash
path=${1%/}
user=${2}
group="www-data"
help="nHelp: This script is used to fix permissions of a drupal installationnyou need to provide the following arguments:nt 1) Path to your drupal installationnt 2) Username of the user that you want to give files/directories ownershipnNote: "www-data" (apache default) is assumed as the group the server is belonging to, if this is different you need to modify it manually by editing this scriptnnUsage: (sudo) bash ${0##*/} drupal_path user_namen"
if [ -z "${path}" ] || [ ! -d "${path}/sites" ] || [ ! -f "${path}/modules/system/system.module" ]; then
echo "Please provide a valid drupal path"
echo -e $help
@cravecode
cravecode / civicrm-remove-dupecheck-trxn.patch
Last active August 29, 2015 14:27
Removes the duplication check for a transaction via trxn_id or invoice_id from a CiviCRM contribution.
--- a/CRM/Contribute/BAO/Contribution.php 2015-08-10 12:54:11.213977480 -0400
+++ b/CRM/Contribute/BAO/Contribution.php 2015-08-10 12:54:31.000000000 -0400
@@ -773,6 +773,7 @@
* static
*/
static function checkDuplicate($input, &$duplicates, $id = NULL) {
+ return FALSE;
if (!$id) {
$id = CRM_Utils_Array::value('id', $input);
}
@cravecode
cravecode / prepare-commit-msg
Created September 24, 2015 16:28
Adds a GitHub Issue number to a commit message based on the branch name. I.e.: branch-name-123
#!/bin/bash
branchPath=$(git symbolic-ref -q HEAD) #Somthing like refs/heads/myBranchName
branchName=${branchPath##*/} #Get text behind the last / of the branch path
issueNumber=$(echo "$branchName" | grep -Po "\-\d+$" | grep -Po "\d+")
# If there was a issue number in the branch name, append it to the commit message.
if [ -n "$issueNumber" ]; then
# Write the issue number to the commit message.
echo "Issue: #$issueNumber" >> $1