Skip to content

Instantly share code, notes, and snippets.

View jameswilson's full-sized avatar

James Wilson jameswilson

View GitHub Profile
@jameswilson
jameswilson / git-mdiff
Last active September 22, 2017 23:39
Git list merged branches in one branch, but not on another
#!/bin/bash
# Git command to compare which branches are merged into one branch but not
# present in another. Useful for comparing which branches have been merged
# into a release branch that are already on the mainline branch.
#
# Usage:
#
# git mdiff origin/master origin/integration
#
@jameswilson
jameswilson / jquery.custom.fluiddialog.js
Created May 12, 2017 15:08
A script to make the jquery-ui dialog Responsive.
/*!
* Custom script to make jquery-ui dialog responsive.
* http://stackoverflow.com/a/16471891/413538
*/
(function ($) {
"use strict";
function fluidDialog() {
var $visible = $(".ui-dialog:visible");
@jameswilson
jameswilson / .gitconfig
Created February 15, 2017 19:40
git tree - a shorthand alias for a pretty cli git log graph
# Place this in your home directory's ~/.gitconfig file
[alias]
# a shorthand alias for a pretty cli git log graph
tree = "!git log --graph --decorate --pretty=format:'%C(yellow)%h %Cred%cr %Cblue(%an)%C(cyan)%d%Creset %s' --abbrev-commit --all"
@jameswilson
jameswilson / mig.py
Last active April 21, 2016 17:24 — forked from Jach/mig.py
Dirty migration script from Jira issues to Github issues
#!/usr/bin/env python
'''
Steps:
1. Create any milestones
2. Create any labels
3. Create each issue, linking them to milestones and labels
3.1: Update status for new issue if closed
4: Create all the comments for each issue
'''
import getpass
@jameswilson
jameswilson / MrMoneyMustache.css
Last active December 10, 2015 14:32
MrMoneyMustache.com CSS file for GreaseMonkey Script https://greasyfork.org/en/scripts/13870-mr-money-mustache
body {
background: #fff;
}
.postbg {
background: transparent;
box-shadow: none;
}
.header_area {
@jameswilson
jameswilson / throbber.svg
Last active September 25, 2015 14:12
A basic rotating throbber.svg for Drupal 8
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jameswilson
jameswilson / pager.tpl.php
Last active August 19, 2020 15:42
Drupal 7 Accessible Pager (Backport from Drupal 8)
<?php
// Place this file your theme's "templates" folder.
/**
* @file
* Theme override to display a pager.
*
* This is a backport of pager.html.twig from Drupal 8 to Drupal 7, which add
* accessibility support for WCAG 2.0 section 2.4.9.
*
@jameswilson
jameswilson / update-module-location.sh
Last active August 29, 2015 14:13
Update module locations in Drupal 7 from sites/all/modules/contrib to profiles/distroname/modules/contrib
#!/usr/bin/php
<?php
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
db_query("UPDATE {system} SET filename = replace(filename, 'sites/all/modules/contrib', 'profiles/distroname/modules/contrib');")->execute();
@jameswilson
jameswilson / node_counts_by_type.mysql
Created November 21, 2014 18:03
Drupal Node Count by Type
# Tested with Drupal 6 and Drupal 7.
SELECT
COUNT(node.nid) AS count,
node_type.type AS type
FROM
node_type
LEFT JOIN
node ON node.type = node_type.type
GROUP BY
node.type
@jameswilson
jameswilson / remove_body_field.php
Created November 12, 2014 14:38
Remove the body field from a specific content type.
/**
* Remove the instance of the body field from my_content_type
*/
function my_feature_update_7000() {
$instance = field_info_instance('node', 'body', 'my_content_type');
field_delete_instance($instance);
}