Skip to content

Instantly share code, notes, and snippets.

@davidecaruso
davidecaruso / prepare-commit-msg
Last active November 16, 2023 10:58
Git hook to prefix commit with Jira ticket
#!/bin/bash
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
if [ -n "$BRANCH_NAME" ] && [ "$BRANCH_NAME" != "HEAD" ] && [ "$SKIP_PREPARE_COMMIT_MSG" != 1 ]; then
PREFIX_PATTERN='[A-Z]{2,}\-[0-9]{2,}'
[[ $BRANCH_NAME =~ $PREFIX_PATTERN ]]
PREFIX=${BASH_REMATCH[0]}
PREFIX_IN_COMMIT=$(grep -c "^$PREFIX\:" "$1")
if [[ -n "$PREFIX" ]] && ! [[ $PREFIX_IN_COMMIT -ge 1 ]]; then
@litzinger
litzinger / ee-tips.md
Last active August 24, 2023 18:17
ExpressionEngine Quick Tips

Forcing a database update

If you're in a situation where you've already updated EE, but then need to run the database upgrades again, this will help force the installer to run the updates again. This situation may occur if you've upgrade a local or dev version of a site, but need to grab a newer version of the production database to get it up-to-date too.

  1. Change $config['app_version'] to the previous version you've already upgraded from.

  2. Add define('INSTALL_MODE', TRUE); to your admin.php file, then reload admin.php. Clicking the version number in the footer should show an update is available, even though it may match what says is currently installed. Run the update normally, then remove define('INSTALL_MODE', TRUE); from your admin.php file.

OR

@mul14
mul14 / index.js
Created July 25, 2018 14:29
JavaScript DocBlock Cheat Sheet
/**
* Description of this function.
*
* @param {string} name
* @param {Date} birthday
* @param {boolean=} isMarried Optional parameter.
* @param {string|null} [bloodType]
* @param {number=} [weight=0] Optional parameter with default value.
* @param {string[]} favoriteFoods Array of String.
*