Skip to content

Instantly share code, notes, and snippets.

@jacks0n
jacks0n / remote-jquery-migrate.php
Created January 14, 2015 03:08
Remove/un-enqueue the jQuery migrate file, which is often not required.
<?php
/**
* Removes the jquery-migrate file, often not-required.
*/
add_filter('wp_default_scripts', 'remove_jquery_migrate');
function remove_jquery_migrate(&$scripts)
{
if (!is_admin()) {
$scripts->remove('jquery');
$scripts->add('jquery', false, array('jquery-core'), '');
@jacks0n
jacks0n / font-anti-aliasing.css
Created January 14, 2015 03:10
Enables font anti-aliasing, nice and crisp text!
body {
/* Crisp text - antialiase */
font-smoothing: antialiased !important;
-moz-osx-font-smoothing: grayscale !important;
-webkit-font-smoothing: antialiased !important;
-moz-font-smoothing: antialiased !important;
/* Kerning */
text-rendering: optimizeLegibility !important;
@jacks0n
jacks0n / utility-classes.css
Created January 14, 2015 03:12
CSS Utility Classes
/* Text colours */
.text-white { color: white; }
.text-black { color: black; }
/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }
.text-nowrap { white-space: nowrap; }
@jacks0n
jacks0n / scss-lint-disable-inline
Created July 13, 2015 00:40
Disable scss-lint errors/warnings inline.
// scss-lint:enable DuplicateProperty
Linter list: https://github.com/brigade/scss-lint/blob/master/lib/scss_lint/linter/README.md
@jacks0n
jacks0n / jira-git-branch.bookmarklet.js
Last active June 15, 2017 17:20
Generate a Git branch name from a JIRA ticket's project and title slug.
// Generated with http://chriszarate.github.io/bookmarkleter/
javascript:!function(){var%20e=document.getElementById(%22key-val%22).text,t=document.getElementById(%22summary-val%22).textContent,a=t.trim().replace(%22+%22,%22and%22).replace(/[^a-z0-9+]+/gi,%22_%22),n=%22feature/%22+e+%22_%22+a;window.prompt(%22Copy%20to%20clipboard%22,n)}();
@jacks0n
jacks0n / drupal-hide-admin-menu.bookmarklet.js
Created August 4, 2016 22:50
Bookmarklet to hide the Drupal admin menu.
// Generated with http://chriszarate.github.io/bookmarkleter/
javascript:void%20function(){(function(n){n(%22%23admin-menu,%20.header-wrap%22).hide(),n(%22body.admin-menu%22).css(%22cssText%22,%22margin-top:%200%20!important%22)})(jQuery)}();
/**
* Execute a function only once per instance.
*
* @param {...*} arguments
*
* @return {*}
* The return value of the function's first execution.
*/
Function.prototype.once = function() {
var _self = this,
@jacks0n
jacks0n / git-maintain.sh
Created November 21, 2016 13:04
Git maintenance commands
# Remove dangling commits/blobs.
git reflog expire --expire=now --all
# Verify connectivity and validity of the DB objects.
git fsck --full --unreachable
# Cleanup unused branches.
git remote | xargs --no-run-if-empty git remote prune
# Re-pack repository objects.
@jacks0n
jacks0n / Remove Drupal's Contextual Destination Parameters.js
Created December 15, 2016 05:22
Tampermonkey / Greasemonkey script which removes the `destination=` query parameter from Drupal's contextual links (e.g. edit panel, menu item, block, etc).
// ==UserScript==
// @name Remove Drupal's Contextual Destination Parameters
// @namespace http://jacksonc.com
// @version 1.0
// @description Removes the `?destination=` parameter from Drupal's contextual links.
// @author Jackson Cooper <jackson@jacksonc.com>
// @grant none
// @require https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.18.4/URI.min.js
// ==/UserScript==
@jacks0n
jacks0n / Fill the GitHub PR Review Summary.js
Created December 20, 2016 00:31
Tampermonkey / Greasemonkey script to fill the GitHub PR review summary based on the resolution chosen.
// ==UserScript==
// @name Auto-fill GitHub PR Review Summary
// @namespace http://jacksonc.com/
// @version 0.1
// @description Fill the GitHub PR review summary based on the resolution chosen.
// @author Jackson Cooper <jackson@jacksonc.com>
// @match https://github.com/*/*/pull/*/files
// @grant none
// ==/UserScript==