Skip to content

Instantly share code, notes, and snippets.

View alexfinnarn's full-sized avatar
🐙
Curious with tentacles

Alex Finnarn alexfinnarn

🐙
Curious with tentacles
View GitHub Profile
# This function takes the output of the last command and exits if it failed.
earlyexit() {
CODE="$?"
if [ "${CODE}" != "0" ]; then
echo ---
echo Exiting on failure...
echo ---
exit 1
fi
echo Script succeeded.
@alexfinnarn
alexfinnarn / build-express.sh
Last active August 21, 2018 17:31
running some drush commands
# Install a site.
$HOME/.composer/vendor/bin/drush si --db-url=mysql://backdrop:backdrop@127.0.0.1/backdrop -y
# Boot up the server.
$HOME/.composer/vendor/bin/drush backdrop-runserver 127.0.0.1:8057 > /dev/null 2>&1
# Enable a module.
$HOME/.composer/vendor/bin/drush en ${MODULE_NAME} -y
@alexfinnarn
alexfinnarn / behat.travis.yml
Created August 21, 2018 16:58
behat config file
default:
# Ignore certain tags so they don't have to be excluded on the commandline.
gherkin:
filters:
tags: "~@broken"
# Not sure if this is the best, but it sounds nice.
formatters:
pretty: true
suites:
my_suite:
@alexfinnarn
alexfinnarn / composer.json
Created August 21, 2018 16:49
behat composer file
{
"require": {
"behat/mink-extension": "~2.3",
"behat/mink-goutte-driver": "~1.2",
"behat/mink-selenium2-driver": "~1.3"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"bin-dir": "bin/"
<?php
/**
* Implements hook_page_alter().
*/
function code_syntax_highlighting_bundle_page_alter() {
// Add the JS and CSS assets if the page is supposed to have code syntax highlighting.
$current_object = menu_get_object();
if (in_array($current_object->type, config_get('code_syntax_highlighting_bundle.settings','csh_enabled_node_types'), TRUE)) {
backdrop_add_css(backdrop_get_path('module', 'code_syntax_highlighting_bundle')
. '/libraries/highlightjs/styles/' . config_get('code_syntax_highlighting_bundle.settings','csh_theme') . '.css');
@alexfinnarn
alexfinnarn / plugin.js
Created August 9, 2018 17:03
final plugin code
(function ($, Backdrop, CKEDITOR) {
"use strict";
CKEDITOR.plugins.add('csh', {
init: function (editor) {
editor.addCommand('csh_command', new CKEDITOR.dialogCommand('code_sc_generatorDialog'));
if (editor.ui.addButton) {
editor.ui.addButton('CSH', {
@alexfinnarn
alexfinnarn / plugin.js
Last active August 8, 2018 21:56
need to add variables to pass into function
(function ($) {
CKEDITOR.plugins.add('code_sc', {
// more code...
})(jQuery);
@alexfinnarn
alexfinnarn / code_syntax_highlighting_bundle.php
Last active August 8, 2018 20:54
WYSIWYG to CKEdtior hooks
<?php
/**
* Implements of hook_wysiwyg_plugin().
*/
function code_syntax_highlighting_bundle_wysiwyg_plugin($editor, $version) {
// Add the code button for the ckeditor.
if ($editor === 'ckeditor') {
return array(
'code_sc' => array(
@alexfinnarn
alexfinnarn / example.lando.yml
Created May 17, 2018 16:47
My Half-assed Lando Config File
name: express
recipe: drupal7
config:
webroot: web
xdebug: true
php: "7.1"
conf:
php: config/php/zzzzzz-express-custom.ini
#database: config/mysql/.my.cnf
services:
@alexfinnarn
alexfinnarn / much-better-than-medium.sh
Last active May 6, 2018 15:26
Showing how much better Gists look than Medium code blocks.
# Run JS tests if merging PR into dev or has JS in it.
if [ "${TRAVIS_EVENT_TYPE}" == "push" ] || [ "${EXPRESS_COMMIT_HAS_JS}" ]; then
echo "Running Express JS tests..."
${ROOT_DIR}/drupal/profiles/express/tests/behat/bin/behat --stop-on-failure --strict --config ${ROOT_DIR}/drupal/profiles/express/tests/behat/behat.travis.yml --verbose --tags ${EXPRESS_JS_BEHAT_TAGS}
earlyexit
else
echo "Not Running Express JS tests..."
fi