Skip to content

Instantly share code, notes, and snippets.

View quicksketch's full-sized avatar

Nate Lampton quicksketch

View GitHub Profile
@quicksketch
quicksketch / generic-site.conf
Created April 18, 2016 18:20
General setup instructions for Drupal/Backdrop on nginx
# Server configuration for example.com
server {
# Require HTTP authentication.
#auth_basic "Restricted";
#auth_basic_user_file /home/example/.htpasswd;
# Limit each user to 20 max connections.
limit_conn default 20;
# Set up ports and server address.
@quicksketch
quicksketch / admin_menu_d7_diff.diff
Last active August 29, 2015 14:01
Admin Menu Backdrop Port
diff --git a/admin_menu.admin.js b/admin_menu.admin.js
index 9ee9f36..fea1a54 100644
--- a/admin_menu.admin.js
+++ b/admin_menu.admin.js
@@ -5,7 +5,7 @@
*/
Drupal.behaviors.adminMenuLivePreview = {
attach: function (context, settings) {
- $('input[name^="admin_menu_components"]', context).once('admin-menu-live-preview')
+ $('input[name^="components"]', context).once('admin-menu-live-preview')
@quicksketch
quicksketch / gist:11124800
Last active February 28, 2016 08:22
Alter Webform outgoing e-mail
<?php
/**
* Implements hook_mail_alter().
*/
function mymodule_mail_alter(&$message) {
if ($message['id'] == 'webform_submission') {
// Use the From header as a Reply-to and set the From header to the site
// mail address. Trying to say e-mail is "From" other domains will get the
// mail marked as spam, so instead the e-mail is always from webform.com,
// but the reply address is the user-specified address.
@quicksketch
quicksketch / drupal.inc
Last active December 26, 2015 02:19
Sample drupal.inc file that demonstrates wrapping Drupal functions for backwards compatibility with Drupal 7 namespaces.
<?php
/**
* @file
* Contains constants and function wrappers for Drupal 7.x compatibility.
*/
/**
* @defgroup drupal_compatibility Drupal compatibility layer.
* @{
* These functions and classes are wrappers around Backdrop functions that allow
@quicksketch
quicksketch / format_benchmarks.php
Created September 16, 2013 00:09
Symfony YAML vs. Spyc YAML vs. JSON vs. PHP parsing times.
<?php
require_once __DIR__ . '/core/vendor/autoload.php';
require_once __DIR__ . '/core/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE);
$yaml_files = file_scan_directory('./test_yaml', '/\.yml$/');
$start = microtime(TRUE);
$yaml_contents = array();
@quicksketch
quicksketch / benchmark_yaml.php
Created September 15, 2013 01:40
Comparing spyc vs. Symfony vs. JSON parsing
<?php
require_once __DIR__ . '/core/vendor/autoload.php';
require_once __DIR__ . '/core/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE);
$yaml_files = file_scan_directory('./test_yaml', '/\.yml$/');
$start = microtime(TRUE);
$yaml_contents = array();
@quicksketch
quicksketch / YAML v. JSON
Created September 14, 2013 19:38
YAML vs. JSON decoding against Drupal config files.
<?php
require_once __DIR__ . '/core/vendor/autoload.php';
require_once __DIR__ . '/core/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE);
use Symfony\Component\Yaml\Parser;
$parser = new Parser();
$yaml_files = file_scan_directory('./test_yaml', '/\.yml$/');