Skip to content

Instantly share code, notes, and snippets.

@chrisfree
chrisfree / drupal-8-drush-deployment.sh
Created January 8, 2016 14:35
Example Drupal 8 Deployment with Drush
#!/bin/bash
echo ""
echo "Switching to project docroot."
cd /var/www/chromatichq.com/docroot
echo ""
echo "Pulling down the latest code."
git pull origin master
echo ""
echo "Clearing drush caches."
@grasmash
grasmash / travis-deploy.sh
Created December 15, 2015 21:38
Triggers a deployment when Travis performs a build on specified branch and test suite.
#!/usr/bin/env bash
# What does this script do?
# This script will watch for a specific Travis $build_job on a specific
# $source_branch on the canonical GitHub repository and deploy build artifacts
# to $dest_branch on the git.remote specified in project.yml.
# How to use this script?
# This script should be executed in the `after_success` section of .travis.yml.
# It requires three arguments. Example call:
@gabalis
gabalis / tabindex-for-all.js
Created September 29, 2015 10:31
Add tabindex to all elements which do not have one yet
// adding tabindex to all relevant elements which need it
// so we exclude the tabindexed elements
// tabindex = 0 will come after the positively numbered elements
// cf http://www.w3.org/TR/html401/interact/forms.html#adef-tabindex
jQuery(document).ready(function($) {
$('a, input, select, button, textarea').not('[tabindex]').attr('tabindex',0);
});
@grasmash
grasmash / custom.php
Last active August 19, 2016 21:08
Symfony-based VM tasks
<?php
/**
* Download Drupal VM for the project.
*
* This is accomplished through a `git clone` to the 'box' directory. The
* '.git' directory is then removed from 'box'.
*
* @param InputInterface $input
* @param OutputInterface $output
@grasmash
grasmash / compile-sass.php
Last active August 19, 2016 21:09
Executes compile sass for a project
<?php
namespace Acquia\Console\Command;
use Acquia\Utilities;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
@facine
facine / __INDEX.txt
Last active August 6, 2023 15:33
Drupal 8 - Examples
# Taxonomy terms:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_taxonomy_term-php
# Menu links:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_menu_link-php
# File items:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_file-php
# Nodes:
@grasmash
grasmash / usasearch-php-sdk-example.php
Last active August 19, 2016 21:09
Example of implementing USASearch's PHP SDK to create a new document in the USASearch index.
<?php
// Set up variables.
$document = create_dummy_document();
$username = 'test_index';
$password = 'test_key';
// Create document in USASearch Index.
$client = new UsaSearchClient($affiliate, $password);
$response = $client->createDocument($document);
@melnikovdv
melnikovdv / setup.sh
Last active August 25, 2016 12:18
Mac OS X setup from scratch
#!/bin/sh
##### Preparations #####
#-----------------------
# Description is available at http://mlayer.org/tech/2014/11/25/setup-mac-os-x.html
# install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install caskroom/cask/brew-cask # makes available to install apps as packages
brew tap caskroom/versions # for beta version available through cask
@agentrickard
agentrickard / gist:27b83d78109565ae1a16
Created August 16, 2014 18:29
Sampe Drupal 8 build script
#!/bin/bash
# be in the right directory
# edit this line as appropriate
cd /Applications/MAMP/htdocs
# assign the path to drush.
# if drush is not in your path, or if you use multiple versions.
drush='/Applications/MAMP/drush/drush'
@webchick
webchick / gist:956a2d7a49c7490fefb5
Last active December 3, 2019 09:25
Most popular D7 modules (as of July 16, 2015)
SELECT n.title, SUM(w.count) as total
FROM project_usage_week_release w
INNER JOIN field_data_field_release_project r ON w.nid = r.entity_id
INNER JOIN node n ON n.nid = r.field_release_project_target_id
INNER JOIN
field_data_field_release_version v ON v.entity_id = r.entity_id
WHERE LEFT(v.field_release_version_value, 3) = '7.x'
AND FROM_UNIXTIME(w.timestamp) BETWEEN CURDATE()-INTERVAL 2 WEEK AND CURDATE()
GROUP BY n.title
ORDER BY total DESC;