Skip to content

Instantly share code, notes, and snippets.

View jameswilson's full-sized avatar

James Wilson jameswilson

View GitHub Profile
@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 / mytheme.info.yml
Last active August 17, 2020 14:28
Integrate Drupal 8 Toolbar w/ Bootstrap Fixed Top Nav
libraries-extend:
# Improve interoperability between MyTheme and the Drupal admin toolbar.
toolbar/toolbar:
- mytheme/toolbar
@jameswilson
jameswilson / localized_placeholder_node_and_menu_item.php
Created August 25, 2014 23:55
Programmatically create a placeholder node with translations and localized main menu links.
<?php
// The following code snippet is used to add a placeholder page and companion
// localized menu items to a site with i18n_menu and entity_translation enabled.
/**
* Create an About page.
*/
function mymodule_create_about_page() {
// Config data.
@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 / git_remote_branch_rename.sh
Last active March 9, 2018 23:17 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git checkout old_branch_name # Ensure you're on the local branch.
git branch -M new_branch_name # Rename branch locally.
git branch --unset-upstream # unset
git push origin :old_branch_name # Delete the old branch
git push -u origin new_branch_name # Push the new branch, set local branch to track the new remote
@jameswilson
jameswilson / node.html.twig
Created January 25, 2018 00:22
Drupal 8 has_page_title
{#
/**
* @file
* Theme override to display a node.
*
* Available variables:
* - see Stable Theme's node.twig.html for standard variables.
* - has_page_title: Flag for page title block visibility. Will be true when
* the iu_page_title block is present on the page. This is useful to add the
* H1 inside the article when page title block not present.
@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 / 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 / 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 */