Skip to content

Instantly share code, notes, and snippets.

View CashWilliams's full-sized avatar

Cash Williams CashWilliams

View GitHub Profile
@CashWilliams
CashWilliams / gist:8733693
Created January 31, 2014 15:03
Markdown Example

An exhibit of Markdown

This note demonstrates some of what [Markdown][1] is capable of doing.

Note: Feel free to play with this page. Unlike regular notes, this doesn't automatically save itself.

Basic formatting

Paragraphs can be written like so. A paragraph is the basic block of Markdown. A paragraph is what text will turn into when there is no reason it should become anything else.

@CashWilliams
CashWilliams / Drupal Fields Over Time
Created January 28, 2015 17:12
Chart from git repo to show Drupal field changes over time
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013-2015 Sébastien Helleu <flashcode@flashtux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
<?php
function getCodeNumberByName($name) {
switch ($name) {
case 'Edward Donne':
return 001;
case 'Scarlett Papava':
return 004;
case 'Stuart Thomas':
return 006;
function getCodeNumberByName($name) {
switch ($name) {
case 'Edward Donne':
return 001;
case 'Scarlett Papava':
return 004;
case 'Stuart Thomas':
return 006;
case 'James Bond':
return 007;
@CashWilliams
CashWilliams / install.hostmaster.inc
Created August 10, 2011 01:29
AEgir - hostmaster install for non-standard install (osx based)
<?php
/**
* This file helps install aegir on osx, not using the standard AEgir user
* create a host entry for your machine name (Cash-Williamss-MacBook-Pro.local)
* run drush hostmaster-install --aegir_root=/path/to/aegir
*/
/**
@CashWilliams
CashWilliams / bad_drupal_lib.inc
Created June 22, 2012 17:32
Bad Drupal database connection
...
if(strstr(ini_get('sendmail_from'), 'dev')) {
$config['datasources']['default']['hostname'] = 'localhost';
$config['datasources']['default']['username'] = 'root';
$config['datasources']['default']['password'] = 'root';
} else {
$config['datasources']['default']['hostname'] = 'badexample.com';
$config['datasources']['default']['username'] = 'badexample_user';
$config['datasources']['default']['password'] = 'badexample_pass';
}
@CashWilliams
CashWilliams / gist:3029850
Created July 1, 2012 22:23
Drupal feature stuck
/var/www/cashwilliams/sites/default# drush fu cashwilliams_core
Module appears to already exist in sites/all/modules/features/cashwilliams_core
Do you really want to continue? (y/n): y
Created module: cashwilliams_core in sites/all/modules/features/cashwilliams_core [ok]
li117-19:/var/www/cashwilliams/sites/default# drush fl
Name Feature Status State
CashWilliams Core cashwilliams_core Enabled Overridden
CashWilliams Blog cashwilliams_blog Enabled
CashWilliams Twitter cashwilliams_twitter Enabled
Date Migration Example date_migrate_example Disabled
<p>This is a post I'm digging up from an old blog of mine, but refreshed. I needed to remove the table prefix from an existing Drupal site. The site had tables in the form of <code>drup_TABLENAME</code> and needed to be in the standard Drupal format as <code>TABLENAME</code>. I wrote a quick php script which can be called from Drush.</p>
<p>The script does not delete any existing tables unless needed, and but will drop a table by the same name (without the prefix) if it exists before trying to rename it. The database I was working in was pretty dirty and had a fresh install mixed amongst the prefixed tables.</p>
<p>I've tested it and run the against the site using the following steps:</p>
<ol>
<li><p>Run the file with drush</p>
<pre><code>drush php-script fix_prefix.php
#!/bin/bash
for i in {`drush $1 pml --status=enabled -p | grep ntlp | cut -d " " -f 1`}
do
drush $1 coder critical $i > $i.md
done
@CashWilliams
CashWilliams / coder_6x-2x_markdown.patch
Created July 12, 2012 04:35
Coder 6.x-2.x Markdown Patch
diff --git a/coder.drush.inc b/coder.drush.inc
index 47ab9bf..33b85d9 100644
--- a/coder.drush.inc
+++ b/coder.drush.inc
@@ -53,6 +53,7 @@ function coder_drush_command() {
'security' => 'Drupal Security Checks',
'sql' => 'Drupal SQL Standards',
'style' => 'Drupal Coding Standards',
+ 'markdown' => 'Output in markdown',
),