Skip to content

Instantly share code, notes, and snippets.

View jameswilson's full-sized avatar

James Wilson jameswilson

View GitHub Profile
@datagrok
datagrok / git-branch-simplify.md
Last active April 16, 2024 17:26
How to simplify the graph produced by git log --graph

Ideas for improvements to git log --graph

I will maybe someday get around to dusting off my C and making these changes myself unless someone else does it first.

Make the graph for --topo-order less wiggly

Imagine a long-running development branch periodically merges from master. The git log --graph --all --topo-order is not as simple as it could be, as of git version 1.7.10.4.

It doesn't seem like a big deal in this example, but when you're trying to follow the history trails in ASCII and you've got several different branches displayed at once, it gets difficult quickly.

@nsciacca
nsciacca / #github-to-acquia
Last active May 5, 2023 22:48
GitHub to Acquia workflow recipe and helper scripts
Project structure:
.github/workflows/deploy-acquia.yml
scripts/ci/push.sh
scripts/composer/ScriptHandler.php
.gitignore
composer.json
@WengerK
WengerK / databaseService.php
Created September 4, 2017 09:46
Drupal 8 - Print raw SQL queries for debugging
<?php
/**
* Debugging using the database connection.
*/
/** @var \Drupal\Core\Database\Connection */
$connection = \Drupal::service('database');
$query = $connection->select('node', 'node');
$query->fields('node', ['nid'])
@datvance
datvance / install-libraries.php
Created January 20, 2022 15:56
A composer post-update/post-install command to find, download, copy, whatever front-end library files specified in a drupal module's "composer.libraries.json" file (which is non-standard).
<?php
/**
* A hack.
*
* A composer post-update/post-install command to find, download, copy, whatever front-end library files
* specified in a drupal module's "composer.libraries.json" file (which is non-standard). This is a replacement
* for the wikimedia/composer-merge-plugin package which is deprecated and causes issues on Pantheon
* See: https://www.drupal.org/project/webform/issues/3088336#comment-13312823
* And: https://www.drupal.org/project/documentation/issues/2605130
@frjo
frjo / contact.php
Last active January 20, 2023 07:22
PHP script for contact form
<?php
// Set the e-mail address that submission should be sent to.
$address = 'info@example.com';
// Set the e-mail subject prefix.
$prefix = 'Website feedback';
// DO NOT EDIT ANYTHING BELOW UNLESS YOU KNOW WHAT YOU ARE DOING.
@axelav
axelav / gist:1839777
Created February 15, 2012 22:51 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@cimmanon
cimmanon / flexbox.scss
Last active September 17, 2020 15:05 — forked from anonymous/Flexbox mixins
This collection of Sass mixins to cover all 3 flexbox specifications that have been implemented. More information can be found here: https://gist.github.com/cimmanon/727c9d558b374d27c5b6
@import "compass/css3/shared";
// NOTE:
// All mixins for the 2009 spec have been written assuming they'll be fed property values that
// correspond to the standard spec. Some mixins can be fed values from the 2009 spec, but don't
// rely on it. The `legacy-order` mixin will increment the value fed to it because the 2009
// `box-ordinal-group` property begins indexing at 1, while the modern `order` property begins
// indexing at 0.
// if `true`, the 2009 properties will be emitted as part of the normal mixin call
@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.
*
@peterlozano
peterlozano / lambda @ edge
Last active April 6, 2018 22:52
Redirect to www domain using AWS CloudFront Lambda @ Edge. Attach this function to the Viewer Request event.
exports.handler = (event, context, callback) => {
const request = event.Records[0].cf.request;
if (request.headers['host'][0].value !== 'www.example.com') {
/*
* Generate HTTP redirect response with 302 status code and Location header.
*/
const response = {
status: '302',
statusDescription: 'Found',
@xavez
xavez / Gruntfile.js
Last active August 2, 2016 05:20
Grunt: Compass, Autoprefixer, CSS/JS minification and Livereload. Use the `npm install`and `grunt` commands consecutively to execute.
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.initConfig({