Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am bryanhirsch on github.
  • I am bryanhirsch (https://keybase.io/bryanhirsch) on keybase.
  • I have a public key ASAnv3Ele96hQLLT1N2tvWFDARHckP6GM9Wx97O2AHJiIAo

To claim this, I am signing this object:

@bryanhirsch
bryanhirsch / gist:aeed6e26fc792903d38d
Created April 11, 2015 16:39
Serve files from prod if not found locally
# Serve files from prod if not available locally per:
# https://docs.acquia.com/articles/serving-files-production-development-environments
#
# If the request is to the files directory
RewriteCond %{REQUEST_URI} ^/sites/default/files/(.*)$
# If we are not on prod
RewriteCond %{ENV:AH_SITE_ENVIRONMENT} !^prod
# If we are not on stage
RewriteCond %{ENV:AH_SITE_ENVIRONMENT} !^test
# If the file or directory is not found
1. USE OF EXTERNAL OPEN SOURCE SOFTWARE
a) "Open Source Software" (OSS) is software that allows its recipients to modify and redistribute the source code; as such, "open source" is a copyright and distribution framework and makes no implications regarding technical support or indemnification. In almost all cases, OSS meets the definition of "commercial computer software" and shall be given appropriate statutory preference in accordance with 41 USC 264B (reference (b)) (see also FAR 2.101(b), 12_1.html 12.000, 12.101 (reference (c))).
b) Executive agencies, including CFPB, are required to conduct market research when preparing for the procurement of products or services by 41 USC Sec. 253a (reference (e)) (see also FAR 10.001. Market research for software should include OSS.
a. There are several positive aspects of OSS that should compel CFPB to seek out OSS when conducting market research on software for Bureau-wide use:
i. Publicly available source code enables continuous and broad peer review that
Problem/Motivation restated via user stories
If I download a distro from drupal.org, or if I write make files to accompany an install profile according to drupal.org's guidelines, and then I build my code base using the build-profile.make file I end up with a directory structure that looks like this:
docroot/profiles/my-profile/modules/contrib/views
docroot/profiles/my-profile/modules/contrib/ctools
docroot/profiles/my-profile/modules/contrib/some-contrib-project-i-maintain
docroot/profiles/my-profile/modules/contrib/etc.
docroot/sites/all/modules/ <-- empty
This is fine for someone who downloads a distro from d.o, installs it, and never contributes. But for maintainers, and potential contributors, this directory structure creates an huge amount of unnecessary friction.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Load Aloha Editor with require.js</title>
<!-- load the jQuery and require.js libraries -->
<script type="text/javascript" src="http://cdn.aloha-editor.org/latest/lib/vendor/jquery-1.7.2.js"></script>
<script type="text/javascript" src="http://cdn.aloha-editor.org/latest/lib/require.js"></script>
diff --git a/modules/custom/petitions_data/petitions_data.module b/modules/custom/petitions_data/petitions_data.module
index 78e1e86..0934db0 100644
--- a/modules/custom/petitions_data/petitions_data.module
+++ b/modules/custom/petitions_data/petitions_data.module
@@ -67,3 +67,23 @@ function petitions_data_form($form, &$form_state) {
return system_settings_form($form);
}
+
+function petitions_data_petition_is_open($petition_id){
@bryanhirsch
bryanhirsch / mongodb-7.x-1.0-rc2-persist.patch
Created September 4, 2012 20:40
Use persistent database connection by default.
diff --git a/mongodb.module b/mongodb.module
index c5e4afa..35b4527 100644
--- a/mongodb.module
+++ b/mongodb.module
@@ -31,6 +31,9 @@ function mongodb($alias = 'default') {
$db = $connection['db'];
if (!isset($mongo_objects[$host][$db])) {
try {
+ $options = variable_get('mongodb_options', array()) + array(
+ 'persist' => '1', // Use persistent connection by default.
@bryanhirsch
bryanhirsch / uuid-fix-undefined-variable-error.patch
Created March 4, 2012 20:25
Prevent undefined index warning. Note: This section is rewritten in the dev branch of uuid. So this patch shouldn't be necessary after 7.x-1.0-alpha3.
diff --git a/uuid.tokens.inc b/uuid.tokens.inc
index d1ec58e..8042e3a 100644
--- a/uuid.tokens.inc
+++ b/uuid.tokens.inc
@@ -92,5 +92,9 @@ function uuid_tokens($type, $tokens, array $data = array(), array $options = arr
break;
}
+ // Prevent undefined index warning. Note: This section is rewritten in the dev branch
+ // of uuid. So this patch shouldn't be necessary after 7.x-1.0-alpha3.
@bryanhirsch
bryanhirsch / services.spyc.patch
Last active October 1, 2015 10:18
From http://spyc.googlecode.com/svn/trunk/spyc.php for rest_server/lib/spyc.php (see Services module README.txt)
diff --git a/projects/services/servers/rest_server/lib/spyc.php b/projects/services/servers/rest_server/lib/spyc.php
new file mode 100644
index 0000000..e580de3
--- /dev/null
+++ b/projects/services/servers/rest_server/lib/spyc.php
@@ -0,0 +1,1045 @@
+<?php
+/**
+ * Spyc -- A Simple PHP YAML Class
+ * @version 0.5.1