Skip to content

Instantly share code, notes, and snippets.

View cam8001's full-sized avatar
💭
lol no

Cameron Tod cam8001

💭
lol no
  • Amazon Web Services
  • Wellington, New Zealand
  • 09:03 (UTC +12:00)
View GitHub Profile
@cam8001
cam8001 / gist:7069447
Created October 20, 2013 13:12
Publically available Drupal.org JSON endpoints (before D7 rollout).
# Git attribution string
https://drupal.org/user/129588/git-attribution
# Issue summary
https://drupal.org/node/2099611/project-issue/json
# Solr search
https://drupal.org/drupalorg-search/help/js/searchstring
@cam8001
cam8001 / csv_import.php
Created October 25, 2013 17:07
Back of the envelope PHP script to import CSV for Rohan.
#!/usr/bin/php
/**
* Imports a CSV file into a database.
*/
$file = $_ARGV[0];
$handle = fopen($file,"r");
$key = 0;
$query = "
@cam8001
cam8001 / block_yesware.sh
Last active December 26, 2015 23:59
Append some host entries to /etc/hosts
# Block Yesware tracking pixels.
127.0.0.1 yesware.com
127.0.0.1 apps.yesware.com
@cam8001
cam8001 / git-diff-highlight
Last active December 20, 2023 19:40
Use nice word-level highlighting in git.
#!/bin/bash
# See https://github.com/git/git/tree/master/contrib/diff-highlight
export PATH=$PATH:$(brew --cellar git)'/'$(git --version | sed 's/git version //')/share/git-core/contrib/diff-highlight
# Add this to your gitconfig.
[pager]
log = diff-highlight | less
show = diff-highlight | less
Demo Framework
Basics
The following DF modules are stored on D.O. as projects:
Assemble -- Panels, Views, Beans, Chaos Tools, Webform
Curate -- Inline Editing, Site Previews, Workbench, Revisioning
Import -- Migrate extensions and Feeds for injecting demo entities
All other DF modules are in this repo, they are:
@cam8001
cam8001 / drupal_install.sh
Created December 7, 2013 14:57
Drupal 8 install script.
#!/bin/bash
function drupal-install() {
sudo rm -rf sites/default;
sudo git checkout -- sites/default;
sudo chmod -R 777 sites/default;
sudo chown -R `whoami` sites/default;
sudo git checkout -- sites/default;
sudo chown -R `whoami` sites/default;
#exit;
@cam8001
cam8001 / commons-34_modules
Last active December 31, 2015 12:19
Modules installed in Commons 3.4. Generated with drush pml --status=enabled
Package Name Type Version
Acquia Network Connector Acquia agent (acquia_agent) Module 7.x-2.12
Acquia Network Connector Acquia search (acquia_search) Module 7.x-2.12
Acquia Network Connector Acquia Site Profile Information (acquia_spi) Module 7.x-2.12
Chaos tool suite Chaos tools (ctools) Module 7.x-1.3+4-dev
Chaos tool suite Page manager (page_manager) Module 7.x-1.3+4-dev
Chaos tool suite Views content panes (views_content) Module 7.x-1.3+4-dev
Commons - Building blocks Commons Activity Streams (commons_activity_streams) Module 7.x-3.4
<?php
class CacheFormDatabaseCache extends DrupalDatabaseCache {
pubic function __construct($bin) {
Database::setActiveConnection('myconnection');
$this->bin = $bin;
}
}
@cam8001
cam8001 / settings.local.patch
Created February 17, 2014 12:48
Patch to add settings.local.php support. Note that this won't work as a patch atm, it's just for reference.
commit f1f7f92eff14a56fd3eec137b4d25f8eae8b139c
Author: Cameron Tod <cameron.tod@gmail.com>
Date: Mon Feb 17 12:32:35 2014 +0000
Added local settings include, to ease debugging of memory issue.
diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,5 @@
@cam8001
cam8001 / .htaccess
Created February 17, 2014 13:00
Use .htaccess so that you request remote files from your production server.
### Apache Rewrite
RewriteEngine on
# Force image styles that have local files that exist to be generated.
RewriteCond %{REQUEST_URI} ^/sites/([^\/]*)/files/styles/[^\/]*/public/((.*))$
RewriteCond %{DOCUMENT_ROOT}/sites/%1/files/%2 -f
RewriteRule ^(.*)$ $1 [QSA,L]
# Otherwise, send anything else that's in the files directory to the
# production server.
RewriteCond %{REQUEST_URI} ^/sites/[^\/]*/files/.*$