Skip to content

Instantly share code, notes, and snippets.

Avatar

James Wilson jameswilson

View GitHub Profile
@jameswilson
jameswilson / QLColorCode-drupal.patch
Created May 12, 2012
Patch for Drupal QuickLook Syntax Highlighting with QLColorCode.qlgenerator
View QLColorCode-drupal.patch
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
Patch for SASS, LESS, Compass QuickLook Syntax Highlighting with QLColorCode.qlgenerator
View QLColorCode-sass-less-compass.patch
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 Mar 5, 2021
Drupal Ctools Responsive Modal
View responsive-modal.css
/* 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
More Link with triangle after
View _more-link.sass
@jameswilson
jameswilson / myfeature.php
Created May 28, 2014
Clean up Bean edit forms
View myfeature.php
<?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 Aug 29, 2015
Multi-language date formats for Drupal 7
View drupal_multilanguage_date_formats.php
<?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'),
);
View drupal_menu_rebuild.php
<?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();
View drupal_panel_layout_body_class.php
// 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 Jul 23, 2014
Check for Dead Drupal Modules
View drupal_check_dead_mods.php
<?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 Aug 1, 2014
Columns based on number of siblings
View columns.css
/**
* 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 */