Skip to content

Instantly share code, notes, and snippets.

View jameswilson's full-sized avatar

James Wilson jameswilson

View GitHub Profile
@jameswilson
jameswilson / QLColorCode-drupal.patch
Created May 12, 2012 15:38
Patch for Drupal QuickLook Syntax Highlighting with QLColorCode.qlgenerator
diff --git a/Contents/Info.plist b/Contents/Info.plist
index 30088e8..6516736 100644
--- a/Contents/Info.plist
+++ b/Contents/Info.plist
@@ -170,6 +170,8 @@
<key>public.filename-extension</key>
<array>
<string>ini</string>
+ <string>info</string>
+ <string>diz</string>
@jameswilson
jameswilson / QLColorCode-sass-less-compass.patch
Created May 12, 2012 16:19
Patch for SASS, LESS, Compass QuickLook Syntax Highlighting with QLColorCode.qlgenerator
diff --git a/Contents/Info.plist b/Contents/Info.plist
index 30088e8..1fba4c8 100644
--- a/Contents/Info.plist
+++ b/Contents/Info.plist
@@ -284,6 +284,9 @@
<key>public.filename-extension</key>
<array>
<string>css</string>
+ <string>less</string>
+ <string>scss</string>
@jameswilson
jameswilson / responsive-modal.css
Last active March 5, 2021 19:59
Drupal Ctools Responsive Modal
/* Override inline dom styles from modal.js */
#modalContent {
position: fixed !important;
top: 12% !important;
bottom: 12% !important;
right: 4% !important;
left: 4% !important;
}
/* Limit max width to 1000px */
div.ctools-modal-content {
@jameswilson
jameswilson / _more-link.sass
Created May 23, 2014 16:16
More Link with triangle after
@jameswilson
jameswilson / myfeature.php
Created May 28, 2014 14:53
Clean up Bean edit forms
<?php
/**
* Implements hook_form_ID_alter().
*/
function myfeature_form_bean_form_alter(&$form, &$form_state, $form_id) {
// Simplify the log message field.
if (isset($form['revision'])) {
$form['revision']['log']['#type'] = 'textfield';
@jameswilson
jameswilson / drupal_multilanguage_date_formats.php
Last active August 29, 2015 14:02
Multi-language date formats for Drupal 7
<?php
// Place this in a custom module, eg "mymodule.module"
/**
* Implements hook_date_format_types().
*/
function mymodule_date_format_types() {
return array(
'post_date' => t('Post date'),
);
@jameswilson
jameswilson / drupal_menu_rebuild.php
Created June 16, 2014 21:56
Rebuild a Drupal 7 menu.
<?php
// To clear the Drupal 7 menu structure, temporarily add this file to the root
// of your drupal project and run it from a webbrowser or the command line.
error_reporting(E_ALL);
define('DRUPAL_ROOT', getcwd());
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
menu_rebuild();
// Place this in mymodule.module
/**
* Implements hook_panels_pre_render().
*/
function mymodule_panels_pre_render($panels_display, $renderer) {
// Add a body class for all panel layouts present on a given page. This
// functionality piggy-backs on Panels 'body_classes_to_add' functionality.
// And let's us do clever things like null out the max-width of container
@jameswilson
jameswilson / drupal_check_dead_mods.php
Created July 23, 2014 23:30
Check for Dead Drupal Modules
<?php
// Place script in root directory of Drupal installation.
// From https://www.drupal.org/node/1080330#comment-6520842
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
function nobueno() {
$startingtime = microtime(true);
$o = '<p>Checking for dead modules ...</p>';
$result = db_select('system')
@jameswilson
jameswilson / columns.css
Created August 1, 2014 22:53
Columns based on number of siblings
/**
* Technique from http://lea.verou.me/2011/01/styling-children-based-on-their-number-with-css3/
*/
/* one item */
li:first-child:nth-last-child(1) {
width: 100%;
}
/* two items */