Skip to content

Instantly share code, notes, and snippets.

View amcgowanca's full-sized avatar

Aaron McGowan amcgowanca

View GitHub Profile
@amcgowanca
amcgowanca / gist:5068900
Created March 1, 2013 23:57
A sloppy LinkedList<TVal>.Remove(ILinkedNode<int, TVal> node) method.
public bool Remove(ILinkedNode<int, TVal> node)
{
if (this.Count.Equals(0))
{
return false;
}
bool removed = false;
if (this.First.Equals(node))
{
@amcgowanca
amcgowanca / gist:5095828
Created March 6, 2013 00:54
Fanshawe College, INFO-5094: LAMP 2, Project 1 - IteratorMode examples of using Bitwise operators
<?php
class IteratorMode
{
const KEEP = 1;
const DELETE = 2;
const FIFO = 4;
const LIFO = 8;
public static function isKeep($mode)
@amcgowanca
amcgowanca / 1356276-D7-inheritable-profiles
Created August 9, 2013 06:51
Allows for a single base installation profile to exist in Drupal 7.
diff --git a/includes/common.inc b/includes/common.inc
index 262e1c5..5523ada 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -232,6 +232,29 @@ function drupal_get_profile() {
return $profile;
}
+/**
+ * Gets the name of the currently active installation profile's base profile.

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@amcgowanca
amcgowanca / 1356276-D7-inheritable-profiles-multi
Last active December 22, 2015 08:19
Allows for a multiple inheritance of installation profiles to exist in Drupal 7.
diff --git a/includes/common.inc b/includes/common.inc
index 262e1c5..b38425a 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -232,6 +232,24 @@ function drupal_get_profile() {
return $profile;
}
+/**
+ * Returns an array of the installation profile hierarchy.
@amcgowanca
amcgowanca / answers-block-node-add-2079955-2.patch
Created September 19, 2013 13:27
Drupal 7 contrib module Answers patch: answers-block-node-add-2079955-2.patch
diff --git a/answers.module b/answers.module
index ed2364b..43209f4 100644
--- a/answers.module
+++ b/answers.module
@@ -140,6 +140,12 @@ function answers_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'answers_answer_node_form') {
// Disallow manually assigning an answer to a question.
hide($form['answers_related_question']);
+ $node = $form['#node'];
+ if (!isset($node->answers_related_question[LANGUAGE_NONE][0]['target_id'])) {
#!/bin/bash
if [ $(id -u) != 0 ]; then
printf "This script must be run as root.\n"
exit 1
fi
drupal_path=${1%/}
drupal_user=${2}
httpd_group="${3:-www-data}"
@amcgowanca
amcgowanca / gist:6827696
Created October 4, 2013 15:19
PHP's break; with numeric indicator of number of scope structures to break.
<?php
do {
for ($i = 0; $i < 10; $i++) {
print $i . ', ';
if ($i == 1) {
break 2;
}
}
}

GNU GENERAL PUBLIC LICENSE

Version 2, June 1991

Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

Preamble

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to

diff --git a/vote_up_down/vud_node/README.txt b/vote_up_down/vud_node/README.txt
new file mode 100644
index 0000000..31c622c
--- /dev/null
+++ b/vote_up_down/vud_node/README.txt
@@ -0,0 +1,81 @@
+Aug 5, 2013
+
+This README addresses the *Port vud_node to D7* issue
+