Skip to content

Instantly share code, notes, and snippets.

View q0rban's full-sized avatar
👋

James Sansbury q0rban

👋
View GitHub Profile
@q0rban
q0rban / module_enable.php
Created October 22, 2014 00:10
Enabling Drupal modules in an update hook
<?php
function hook_update_n() {
if (!drupal_check_module('foo')) {
throw new DrupalUpdateException('Foo does not have requirements needed to be enabled.');
}
module_enable(array('foo'));
return t('Enabled Foo module.');
}
@q0rban
q0rban / 00-tugboat-private-gitlab-howto.md
Last active September 20, 2022 14:39
How to add a self-hosted GitLab repo to Tugboat.qa

How to add a self-hosted GitLab repo to Tugboat

By default, Tugboat's GitLab integration uses OAuth to connect to GitLab Cloud. To add a repository to Tugboat that is hosted on a private or self-hosted GitLab instance, you'll need to use the Tugboat API.

Prerequisites

  1. You must have administrator permissions on GitLab for the repo you would like to add to Tugboat.
  2. You must already have an account on Tugboat and have created a Tugboat project. More on this below.
  3. You must be an Admin or Owner on Tugboat for the aforementioned project in #2.
@q0rban
q0rban / gitosnap.sh
Created November 16, 2012 16:03
Monosnap/Github Shell Script
#!/usr/bin/env sh
# https://gist.github.com/4088499
FIND="^monosnap.com\/image\/\([a-zA-Z0-9]*\)"
REPLACE="![](https:\/\/api.monosnap.com\/image\/download\?id=\1)"
pbpaste |
# Different versions of monosnap have this formatted differently, so we grep
# first for just what we need.
grep -o monosnap.com/image/[a-zA-Z0-9]* |
# Grab the current cliboard contents and do our replacement.
@q0rban
q0rban / pipedrive.js
Created March 19, 2020 18:24
PipeDrive Fluid App Userscript
// PipeDrive Fluid App Activity Dock Badge.
// Authored by @q0rban
// 1. Set Patterns to *pipedrive.com*.
// 2. Paste this script.
// 3. Refresh your Fluid App.
// 4. If you still don't see badges, you might have to edit ~/Library/com.apple.ncprefs.plist
// and set flags for the app to "41,951,254". Then log out and log back in.
window.fluid.dockBadge = '';
// Set the dock badge after one second.
@q0rban
q0rban / config.yml
Last active February 19, 2020 19:25
Script to periodically create a new Tugboat Base Preview and an example circle
# An example CircleCI config.yml to periodically build a new Tugboat base preview.
version: 2
jobs:
rebuild-tugboat:
docker:
- image: circleci/node:10-stretch
steps:
- run:
name: Install Tugboat
command: |
@q0rban
q0rban / jgd_pull_request_builder.sh
Created December 7, 2012 20:53
Example Job for Jenkins Github Drupal Pull Request Builder
#!/usr/bin/env bash
set -e
# Jenkins job script for use with the Jenkins Github Drupal, which can be found
# at https://github.com/Lullabot/jenkins_github_drupal. NOTE, all shell scripts
# have been symlinked to /usr/local/bin to make them easier to call here. For
# example:
# ln -s /usr/local/share/jenkins_github_drupal/prepare_dir.sh \
# /usr/local/bin/jgd-prepare-dir
@q0rban
q0rban / Makefile.d7
Last active March 27, 2018 13:36
Example Tugboat Makefiles
packages:
apt-get update
apt-get install -y mysql-client rsync
curl -L "https://github.com/drush-ops/drush/releases/download/8.1.15/drush.phar" > /usr/local/bin/drush
chmod +x /usr/local/bin/drush
drupalconfig:
cp /var/www/html/sites/default/tugboat.settings.php /var/www/html/sites/default/settings.local.php
createdb:
#!/bin/bash
####
# Split MySQL dump SQL file into one file per table
# based on http://blog.tty.nl/2011/12/28/splitting-a-database-dump
####
if [ $# -lt 1 ] ; then
echo "USAGE $0 DUMP_FILE [TABLE]"
exit
@q0rban
q0rban / jenkins_log_parser_drush
Created December 7, 2012 21:04
Jenkins Drush Log Parser rules
warning /\[warning\]/
error /\[error\]/
info /\[completed\]/
info /\[success\]/
info /\[ok\]/
error /Processed 0/
--- uat.txt 2016-04-12 17:27:28.000000000 -0400
+++ prod.txt 2016-04-12 17:26:35.000000000 -0400
@@ -19,7 +19,7 @@
[instance] => Array
(
[label] => Title
- [description] =>
+ [description] =>
[required] => 1
[settings] => Array