Skip to content

Instantly share code, notes, and snippets.

View crittermike's full-sized avatar

Mike Crittenden crittermike

View GitHub Profile
@crittermike
crittermike / jira_template.md
Last active November 15, 2022 17:54
JIRA ticket template in the 3 C's format (Card, Conversation, and Confirmation)

h2. Card

Also known as the User Story. Explain the requirement in a sentence or two. This should just enough text to identify the requirement, including any crucial information about site/environment.

As a [user role], I want [function], so that [value].

If this doesn't fit as a user story (e.g., a bug ticket), that's fine, just explain it as a concise sentence.

h2. Conversation

@crittermike
crittermike / delete_branch.sh
Created May 3, 2017 14:03
Delete already-merged git branches (except for specific ones you name)
git branch --merged | grep -v "\*" | grep -v master | grep -v develop | grep -v release | xargs -n 1 git branch -d
@crittermike
crittermike / App.js
Last active May 9, 2022 08:18
Using Google API (gapi) with React
/* global gapi */
const API_KEY = 'YOURAPIKEYHERE';
import React, { Component } from 'react';
class App extends Component {
loadYoutubeApi() {
const script = document.createElement("script");
@crittermike
crittermike / parent.php
Created April 11, 2017 17:28
Find the parent of a taxonomy term in Drupal 8
<?php
$parents = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadParents($term_id);
$parent_term = reset($parents);
@crittermike
crittermike / rig.sh
Last active March 9, 2017 18:03
Overwrite Devtools with Outrigger
devtools stop
brew unlink devtools
brew tap phase2/outrigger
brew install phase2/outrigger/rig
rig start
@crittermike
crittermike / migration.md
Last active May 24, 2017 13:33
Track Drupal migration process

Tracking migration progress of 14705 files (or any other arbitrary pre-known number)...

watch -n 10 'PROGRESS=$(drush @your-alias sqlq "SELECT COUNT(*) FROM file_managed") && echo "$PROGRESS => "$(awk "BEGIN {printf \"%.2f%\n\", $PROGRESS/14705 * 100}")'

Which outputs something like:

12074 =&gt; 82.11%
@crittermike
crittermike / pomodoro.crontab
Last active May 24, 2017 13:36
Cron tasks for Pomodoro spoken reminders on macOS
25,55 8-16 * * 1-5 say -v Amelie "take a break"
00,30 8-16 * * 1-5 say -v Anna "back to work stupid"
@crittermike
crittermike / db_access.md
Created January 17, 2017 02:45
Drush gets "access denied" for a Drupal database?

If you're having an issue where Drush gets access denied for the database whenever you try to run a command, try running drush sql-connect. Doing so will return a mysql command line string you can paste to try to connect manually.

Paste that mysql command and run it. If that works fine, but Drush gets "access denied" when you try other commands such as drush sql-console, then see if there's a ~/.my.cnf file.

Sometimes, that file will hide itself away in the home directory and quiety do things like override passwords you pass in, etc. Check it out, and delete it if it's not helping you, then try again.

@crittermike
crittermike / lolcommits-flowdock.md
Created December 20, 2016 21:24
How to post lolcommits to Flowdock
  • Install lolcommits following the normal instructions (make sure you get version 0.8.1 or higher).
  • In your repo, enable lolcommits using lolcommits --enable
  • Then add Flowdock support using lolcommits --config -p flowdock
    • The organization will always be "phase2"
    • Follow the instructions that pop up for getting the flow name and your user token
  • You're done
@crittermike
crittermike / chmod.md
Last active October 19, 2024 14:50
How to chmod only directories

Use chmod +X (as opposed to +x) which will make only directories executable and leave files alone.

This is great for recursively fixing a Drupal files directory. For example:

chmod -R 664 sites/default/files && chmod -R a+X sites/default/files

That will make all your files writeable by you and the server, but not executable, but will also make directories executable (i.e., listable).